FHEMWEB fixes (set)

git-svn-id: https://svn.fhem.de/fhem/trunk@412 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2009-07-11 09:26:37 +00:00
parent 0037191961
commit 7f84c62dc4
4 changed files with 9 additions and 20 deletions

View File

@ -515,3 +515,4 @@
- =DATE= (4.7)
- bugfix: Reattached corrupted CUL device caused uninitialized message
- bugfix: CUL/HMS changes, HMS cleanup
- bugfix: EM/EMWZ/EMGZ set changed to work in FHEMWEB

View File

@ -134,7 +134,7 @@ EM_Set($@)
} else {
return "Unknown argument $a[1], choose one of reset,time"
return "Unknown argument $a[1], choose one of reset time"
}
return undef;

View File

@ -125,31 +125,26 @@ sub
EMWZ_Set($@)
{
my ($hash, @a) = @_;
my $u = "Usage: set <name> <type> <value>, " .
"<type> is one of price,alarm,rperkw";
return $u if(int(@a) != 3);
my $name = $hash->{NAME};
return "" if(IsIoDummy($name));
my $v = $a[2];
my $d = $hash->{DEVNR};
my $msg;
if($a[1] eq "price") {
if($a[1] eq "price" && int(@a) == 3) {
$v *= 10000; # Make display and input the same
$msg = sprintf("79%02x2f02%02x%02x", $d-1, $v%256, int($v/256));
} elsif($a[1] eq "alarm") {
} elsif($a[1] eq "alarm" && int(@a) == 3) {
$msg = sprintf("79%02x2d02%02x%02x", $d-1, $v%256, int($v/256));
} elsif($a[1] eq "rperkw") {
} elsif($a[1] eq "rperkw" && int(@a) == 3) {
$v *= 10; # Make display and input the same
$msg = sprintf("79%02x3102%02x%02x", $d-1, $v%256, int($v/256));
} else {
return "Unknown argument $a[1], choose one of price alarm rperkw";
}
return "" if(IsIoDummy($name));
my $ret = IOWrite($hash, $msg);
if(!defined($ret)) {
my $msg = "EMWZ $name read error (Set)";

View File

@ -103,12 +103,10 @@ EMGZ_Get($@)
{
my ($hash, @a) = @_;
return "argument is missing" if(int(@a) != 2);
my $d = $hash->{DEVNR};
my $msg;
if($a[1] ne "status") {
if($a[1] ne "status" && int(@a) != 2) {
return "unknown get value, valid is status";
}
$hash->{LOCAL} = 1;
@ -122,19 +120,13 @@ sub
EMGZ_Set($@)
{
my ($hash, @a) = @_;
my $u = "Usage: set <name> <type> <value>, " .
"<type> is price";
return $u if(int(@a) != 3);
my $name = $hash->{NAME};
return "" if(IsIoDummy($name));
my $v = $a[2];
my $d = $hash->{DEVNR};
my $msg;
if($a[1] eq "price") {
if($a[1] eq "price" && int(@a) != 3) {
$v *= 10000; # Make display and input the same
$msg = sprintf("79%02x2f02%02x%02x", $d-1, $v%256, int($v/256));
} else {
@ -142,6 +134,7 @@ EMGZ_Set($@)
}
return "" if(IsIoDummy($name));
my $ret = IOWrite($hash, $msg);
if(!defined($ret)) {
$msg = "EMWZ $name read error (Set)";