2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-01 07:19:24 +00:00

10_ZWave.pm: better handling of WakeUp devices, by krikan and hanske (Forum #27984)

git-svn-id: https://svn.fhem.de/fhem/trunk@7175 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2014-12-09 18:46:27 +00:00
parent bc11f2ea14
commit 3cdda294fc

View File

@ -936,8 +936,13 @@ ZWave_Parse($$@)
my $hash = $modules{ZWave}{defptr}{"$homeId $id"};
if($hash && $hash->{WakeUp} && @{$hash->{WakeUp}}) { # Always the base hash
IOWrite($hash, "00", shift @{$hash->{WakeUp}});
foreach my $wuCmd (@{$hash->{WakeUp}}) {
IOWrite($hash, "00", $wuCmd);
Log3 $hash, 4, "Sending stored command: $wuCmd";
}
@{$hash->{WakeUp}}=();
}
if(!$ret) {
readingsSingleUpdate($hash, "CMD", $cmd, 1); # forum:20884
return $hash->{NAME};
@ -945,10 +950,15 @@ ZWave_Parse($$@)
return $ret;
} elsif($cmd eq "ZW_SEND_DATA") {
if($id ne "00") {
Log3 $ioName, 2, "$ioName ERROR: SEND_DATA returned $id";
} else {
if ($id eq "00") {
ZWave_HandleSendStack($iodev);
Log3 $ioName, 4,
"$ioName OK: SEND_DATA returned $id - TRANSMIT_COMPLETE_OK";
} else {
my %err = { "01" => "NO_ACK", "02" => "FAIL",
"03" => "NOT_IDLE", "04" => "NOROUTE" };
my $msg = $err{$id} ? "TRANSMIT_COMPLETE_".$err{$id} : "UNKOWN_ERROR";
Log3 $ioName, 2, "$ioName ERROR: SEND_DATA returned $id - $msg";
}
return "";
@ -1038,9 +1048,16 @@ ZWave_Parse($$@)
}
my $wu = $baseHash->{WakeUp};
if($wu && @{$wu}) {
shift @{$wu} if($wu->[0] eq "");
IOWrite($hash, "00", shift @{$wu}) if(@{$wu});
if($arg =~ m/028407/ && $wu && @{$wu}) {
foreach my $wuCmd (@{$wu}) {
IOWrite($hash, "00", $wuCmd);
Log3 $hash, 4, "Sending stored command: $wuCmd";
}
@{$baseHash->{WakeUp}}=();
#send a final wakeupNoMoreInformation
my $nodeId = $baseHash->{id};
IOWrite($hash, "00", "13${nodeId}02840805");
Log3 $hash, 4, "Sending wakeupNoMoreInformation to node: $nodeId";
}
$baseHash->{lastMsgTimestamp} = time();