mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-04 05:16:45 +00:00
00_ZWDongle.pm/10_ZWave.pm: fix initialization issues. (Forum #40594)
git-svn-id: https://svn.fhem.de/fhem/trunk@9208 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
1da758f2a5
commit
a6fac0aab9
@ -36,6 +36,7 @@ my %sets = (
|
||||
"sendNIF" => { cmd => "12%02x05@" },# ZW_SEND_NODE_INFORMATION
|
||||
"setNIF" => { cmd => "03%02x%02x%02x%02x" },
|
||||
# SERIAL_API_APPL_NODE_INFORMATION
|
||||
"timeouts" => { cmd => "06%02x%02x" }, # SERIAL_API_SET_TIMEOUTS
|
||||
"reopen" => { cmd => "" },
|
||||
);
|
||||
|
||||
@ -50,8 +51,8 @@ my %gets = (
|
||||
"nodeInfo" => "41%02x", # ZW_GET_NODE_PROTOCOL_INFO
|
||||
"nodeList" => "02", # SERIAL_API_GET_INIT_DATA
|
||||
"random" => "1c%02x", # ZW_GET_RANDOM
|
||||
"timeouts" => "06%02x%02x", # SERIAL_API_SET_TIMEOUTS
|
||||
"version" => "15", # ZW_GET_VERSION
|
||||
"timeouts" => "06", # SERIAL_API_SET_TIMEOUTS
|
||||
|
||||
"raw" => "%s", # hex
|
||||
);
|
||||
@ -291,7 +292,7 @@ ZWDongle_Set($@)
|
||||
my $par = $sets{$type}{param};
|
||||
if($par && !$par->{noArg}) {
|
||||
return "Unknown argument for $type, choose one of ".join(" ",keys %{$par})
|
||||
if(!defined($par->{$a[0]}));
|
||||
if(!$a[0] || !defined($par->{$a[0]}));
|
||||
$a[0] = $par->{$a[0]};
|
||||
}
|
||||
|
||||
@ -620,6 +621,11 @@ ZWDongle_Read($@)
|
||||
Log3 $name, 4, "ZWDongle_Read $name: CAN received";
|
||||
$hash->{MaxSendRetries}++ if($hash->{MaxSendRetries}<7);
|
||||
$data = substr($data, 2);
|
||||
if(!$init_done) { # InternalTimer wont work
|
||||
$hash->{WaitForAck} = 0;
|
||||
$hash->{SendRetries}++;
|
||||
select(undef, undef, undef, 0.1);
|
||||
}
|
||||
next;
|
||||
}
|
||||
|
||||
|
@ -2369,9 +2369,9 @@ ZWave_getHash($$$)
|
||||
}
|
||||
|
||||
sub
|
||||
ZWave_wakeupTimer($)
|
||||
ZWave_wakeupTimer($$)
|
||||
{
|
||||
my ($hash) = @_;
|
||||
my ($hash, $direct) = @_;
|
||||
my $now = gettimeofday();
|
||||
|
||||
if(!$hash->{wakeupAlive}) {
|
||||
@ -2379,7 +2379,7 @@ ZWave_wakeupTimer($)
|
||||
$hash->{lastMsgSent} = $now;
|
||||
InternalTimer($now+0.1, "ZWave_wakeupTimer", $hash, 0);
|
||||
|
||||
} elsif($now - $hash->{lastMsgSent} > 1) {
|
||||
} elsif(!$direct && $now - $hash->{lastMsgSent} > 2) {
|
||||
if(!$hash->{SendStack}) {
|
||||
my $nodeId = $hash->{id};
|
||||
my $cmdEf = (AttrVal($hash->{NAME},"noExplorerFrames",0)==0 ? "25":"05");
|
||||
@ -2389,6 +2389,7 @@ ZWave_wakeupTimer($)
|
||||
delete $hash->{wakeupAlive};
|
||||
|
||||
} else {
|
||||
return if($direct);
|
||||
InternalTimer($now+0.1, "ZWave_wakeupTimer", $hash, 0);
|
||||
|
||||
}
|
||||
@ -2551,6 +2552,8 @@ ZWave_Parse($$@)
|
||||
"SECURITY disabled, device does not support SECURITY command class";
|
||||
}
|
||||
}
|
||||
ZWave_wakeupTimer($dh, 1)
|
||||
if(index(AttrVal($dh->{NAME}, "classes", ""), "WAKE_UP") >= 0);
|
||||
return ZWave_execInits($dh, 0);
|
||||
}
|
||||
|
||||
@ -2562,7 +2565,7 @@ ZWave_Parse($$@)
|
||||
my $hash = $modules{ZWave}{defptr}{"$homeId $id"};
|
||||
if($hash) {
|
||||
if(index(AttrVal($hash->{NAME}, "classes", ""), "WAKE_UP") >= 0) {
|
||||
ZWave_wakeupTimer($hash);
|
||||
ZWave_wakeupTimer($hash, 1);
|
||||
ZWave_processSendStack($hash, undef, 0);
|
||||
}
|
||||
|
||||
@ -2716,7 +2719,7 @@ ZWave_Parse($$@)
|
||||
}
|
||||
|
||||
if($arg =~ m/^028407/) { # wakeup:notification
|
||||
ZWave_wakeupTimer($hash);
|
||||
ZWave_wakeupTimer($hash, 1);
|
||||
ZWave_processSendStack($hash, undef, 0);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user