From 3cdda294fc6d946bd95cf64ecf3fc64b7a2261d0 Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Tue, 9 Dec 2014 18:46:27 +0000 Subject: [PATCH] 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 --- fhem/FHEM/10_ZWave.pm | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/fhem/FHEM/10_ZWave.pm b/fhem/FHEM/10_ZWave.pm index 0e8b2eb2c..32c062151 100755 --- a/fhem/FHEM/10_ZWave.pm +++ b/fhem/FHEM/10_ZWave.pm @@ -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();