mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-21 14:04:15 +00:00
10_ZWave.pm: wakeup fixes (Forum #37418)
git-svn-id: https://svn.fhem.de/fhem/trunk@8749 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
840027be38
commit
a03099c095
@ -516,15 +516,20 @@ ZWDongle_Write($$$)
|
|||||||
# assure that wakeupNoMoreInformation is the last message on the sendStack
|
# assure that wakeupNoMoreInformation is the last message on the sendStack
|
||||||
if($msg =~ m/^01....13(..)/) {
|
if($msg =~ m/^01....13(..)/) {
|
||||||
my $wNMIre = '01....13..028408';
|
my $wNMIre = '01....13..028408';
|
||||||
|
|
||||||
|
if($ss->[0] =~ m/$wNMIre/) {
|
||||||
|
Log3 $hash, 2,
|
||||||
|
"ZWDongle_Write: command after wakeupNoMoreInformation dropped";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
my $wNMI;
|
my $wNMI;
|
||||||
my $w1 = shift @{$ss} if($ss->[0] =~ m/$wNMIre/); # keep the first, #35126
|
|
||||||
my @s = grep { /^$wNMIre/ ? ($wNMI=$_,0):1 } @{$ss};
|
my @s = grep { /^$wNMIre/ ? ($wNMI=$_,0):1 } @{$ss};
|
||||||
if($wNMI) {
|
if($wNMI) {
|
||||||
Log3 $hash, 5, "ZWDongle_Write reordered sendStack";
|
Log3 $hash, 5, "ZWDongle_Write wakeupNoMoreInformation moved to the end";
|
||||||
push @s, $wNMI;
|
push @s, $wNMI;
|
||||||
$hash->{SendStack} = \@s;
|
$hash->{SendStack} = \@s;
|
||||||
}
|
}
|
||||||
unshift($hash->{SendStack}, $w1) if($w1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ZWave_ProcessSendStack($hash);
|
ZWave_ProcessSendStack($hash);
|
||||||
|
@ -1525,6 +1525,31 @@ ZWave_getHash($$$)
|
|||||||
return $ptr;
|
return $ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub
|
||||||
|
ZWave_sendWakeup($)
|
||||||
|
{
|
||||||
|
my ($hash) = @_;
|
||||||
|
|
||||||
|
my $wu = $hash->{WakeUp};
|
||||||
|
if($wu && @{$wu}) {
|
||||||
|
foreach my $wuCmd (@{$wu}) {
|
||||||
|
IOWrite($hash, "00", ZWave_clockAdjust($wuCmd));
|
||||||
|
Log3 $hash, 4, "Sending stored command: $wuCmd";
|
||||||
|
}
|
||||||
|
@{$hash->{WakeUp}}=();
|
||||||
|
#send a final wakeupNoMoreInformation
|
||||||
|
my $nodeId = $hash->{id};
|
||||||
|
Log3 $hash, 4, "Sending wakeupNoMoreInformation to node: $nodeId";
|
||||||
|
IOWrite($hash, "00", "13${nodeId}02840805");
|
||||||
|
|
||||||
|
} else { # Wait for commands via notify
|
||||||
|
InternalTimer(gettimeofday()+0.1, sub($) {
|
||||||
|
my $nodeId = $hash->{id};
|
||||||
|
IOWrite($hash, "00", "13${nodeId}02840805");
|
||||||
|
}, $hash, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
###################################
|
###################################
|
||||||
# 0004000a03250300 (sensor binary off for id 11)
|
# 0004000a03250300 (sensor binary off for id 11)
|
||||||
# { ZWave_Parse($defs{zd}, "0004000c028407", "") }
|
# { ZWave_Parse($defs{zd}, "0004000c028407", "") }
|
||||||
@ -1613,18 +1638,14 @@ ZWave_Parse($$@)
|
|||||||
my $ret = ZWave_SetClasses($homeId, $id, $type6, $classes);
|
my $ret = ZWave_SetClasses($homeId, $id, $type6, $classes);
|
||||||
|
|
||||||
my $hash = $modules{ZWave}{defptr}{"$homeId $id"};
|
my $hash = $modules{ZWave}{defptr}{"$homeId $id"};
|
||||||
if($hash && $hash->{WakeUp} && @{$hash->{WakeUp}}) { # Always the base hash
|
if($hash) {
|
||||||
foreach my $wuCmd (@{$hash->{WakeUp}}) {
|
ZWave_sendWakeup($hash) if($hash);
|
||||||
IOWrite($hash, "00", ZWave_clockAdjust($wuCmd));
|
$hash->{lastMsgTimestamp} = time();
|
||||||
Log3 $hash, 4, "Sending stored command: $wuCmd";
|
|
||||||
}
|
|
||||||
@{$hash->{WakeUp}}=();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$ret) {
|
if(!$ret) {
|
||||||
readingsSingleUpdate($hash, "CMD", $cmd, 1); # forum:20884
|
readingsSingleUpdate($hash, "CMD", $cmd, 1); # forum:20884
|
||||||
return $hash->{NAME};
|
return $hash->{NAME};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $ret;
|
return $ret;
|
||||||
|
|
||||||
} elsif($cmd eq "ZW_SEND_DATA") {
|
} elsif($cmd eq "ZW_SEND_DATA") {
|
||||||
@ -1751,25 +1772,7 @@ ZWave_Parse($$@)
|
|||||||
push @event, "UNPARSED:$className $arg" if(!$matched);
|
push @event, "UNPARSED:$className $arg" if(!$matched);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($arg =~ m/^028407/) {
|
ZWave_sendWakeup($baseHash) if($arg =~ m/^028407/);
|
||||||
my $wu = $baseHash->{WakeUp};
|
|
||||||
if($wu && @{$wu}) {
|
|
||||||
foreach my $wuCmd (@{$wu}) {
|
|
||||||
IOWrite($hash, "00", ZWave_clockAdjust($wuCmd));
|
|
||||||
Log3 $hash, 4, "Sending stored command: $wuCmd";
|
|
||||||
}
|
|
||||||
@{$baseHash->{WakeUp}}=();
|
|
||||||
#send a final wakeupNoMoreInformation
|
|
||||||
my $nodeId = $baseHash->{id};
|
|
||||||
Log3 $hash, 4, "Sending wakeupNoMoreInformation to node: $nodeId";
|
|
||||||
IOWrite($hash, "00", "13${nodeId}02840805");
|
|
||||||
} else {
|
|
||||||
InternalTimer(gettimeofday()+0.1, sub($) {
|
|
||||||
my $nodeId = $hash->{id};
|
|
||||||
IOWrite($hash, "00", "13${nodeId}02840805");
|
|
||||||
}, $hash, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$baseHash->{lastMsgTimestamp} = time();
|
$baseHash->{lastMsgTimestamp} = time();
|
||||||
|
|
||||||
return "" if(!@event);
|
return "" if(!@event);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user