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