2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 18:59:33 +00:00

ZWave: old-perl fix, small battery mode enhancement

git-svn-id: https://svn.fhem.de/fhem/trunk@4471 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2013-12-27 09:10:41 +00:00
parent ba3e21d404
commit 7cc55da014
2 changed files with 20 additions and 5 deletions

View File

@ -233,7 +233,8 @@ ZWDongle_Set($@)
$cmd =~ s/\@/$c/g;
}
my $nargs = int(split("%", $cmd, -1))-1;
my @ca = split("%", $cmd, -1);
my $nargs = int(@ca)-1;
return "set $name $type needs $nargs arguments" if($nargs != int(@a));
ZWDongle_Write($hash, "00", sprintf($cmd, @a));
@ -254,7 +255,8 @@ ZWDongle_Get($@)
return "Unknown argument $type, choose one of " . join(" ", sort keys %gets)
if(!defined($gets{$type}));
my $nargs = int(split("%", $gets{$type}, -1))-1;
my @ga = split("%", $gets{$type}, -1);
my $nargs = int(@ga)-1;
return "get $name $type needs $nargs arguments" if($nargs != int(@a));
return "No $type for dummies" if(IsDummy($name));

View File

@ -344,7 +344,10 @@ ZWave_Cmd($$@)
my $cmdId = $cmdList{$cmd}{id};
my $nArg = 0;
$nArg = int(split("%", $cmdFmt))-1 if($cmdFmt =~ m/%/);
if($cmdFmt =~ m/%/) {
my @ca = split("%", $cmdFmt);
$nArg = int(@ca)-1;
}
my $parTxt = ($nArg == 0 ? "no parameter" :
($nArg == 1 ? "one parameter" :
"$nArg parameters"));
@ -532,6 +535,7 @@ ZWave_Parse($$@)
# Controller commands
my $evt;
Log3 $ioName, 4, "$ioName CMD: $cmd";
if($cmd eq 'ZW_ADD_NODE_TO_NETWORK' ||
$cmd eq 'ZW_REMOVE_NODE_FROM_NETWORK') {
my @vals = ("learnReady", "nodeFound", "slave",
@ -546,7 +550,13 @@ ZWave_Parse($$@)
} elsif($cmd eq "ZW_APPLICATION_UPDATE" && $arg =~ m/....(..)..(.*)$/) {
my ($type6,$classes) = ($1, $2, $3);
return ZWave_SetClasses($homeId, $id, $type6, $classes);
my $ret = ZWave_SetClasses($homeId, $id, $type6, $classes);
my $hash = $modules{ZWave}{defptr}{"$homeId $id"};
if($hash->{WakeUp} && @{$hash->{WakeUp}}) {
IOWrite($hash, "00", shift @{$hash->{WakeUp}});
}
return $ret;
}
@ -564,7 +574,10 @@ ZWave_Parse($$@)
######################################
# device messages
return "" if($cmd ne "APPLICATION_COMMAND_HANDLER");
if($cmd ne "APPLICATION_COMMAND_HANDLER") {
Log3 $ioName, 4, "$ioName unhandled command $cmd";
return ""
}
if($arg =~ /^..600d(..)(..)(.*)/) { # MULTI_CHANNEL CMD_ENCAP
$id = "$id$1";