2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-07 19:04:20 +00:00

00_HMlan:set state after restart correct

git-svn-id: https://svn.fhem.de/fhem/trunk@13605 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876 2017-03-05 10:25:35 +00:00
parent 6c1507a424
commit 5cb2f45e83

View File

@ -694,7 +694,7 @@ sub HMLAN_Parse($$) {##########################################################
$hash->{helper}{ids}{$src}{flg} = 0 if ($type eq "00"); $hash->{helper}{ids}{$src}{flg} = 0 if ($type eq "00");
if ($stat){# message with status information if ($stat){# message with status information
HMLAN_condUpdate($hash,$HMcnd)if ($hash->{helper}{q}{HMcndN} != $HMcnd); HMLAN_condUpdate($hash,$HMcnd) if ($hash->{helper}{q}{HMcndN} != $HMcnd);
my $myId = $attr{$name}{hmId}; my $myId = $attr{$name}{hmId};
if ($stat & 0x03 && $dst eq $myId){HMLAN_qResp($hash,$src,0);} if ($stat & 0x03 && $dst eq $myId){HMLAN_qResp($hash,$src,0);}
elsif ($stat & 0x08 && $src eq $myId){HMLAN_qResp($hash,$dst,0);} elsif ($stat & 0x08 && $src eq $myId){HMLAN_qResp($hash,$dst,0);}
@ -1028,7 +1028,7 @@ sub HMLAN_KeepAliveCheck($) {##################################################
my $hash = $defs{$name}; my $hash = $defs{$name};
if ($hash->{helper}{q}{keepAliveRec} != 1){# no answer if ($hash->{helper}{q}{keepAliveRec} != 1){# no answer
if ($hash->{helper}{q}{keepAliveRpt} >2){# give up here if ($hash->{helper}{q}{keepAliveRpt} >2){# give up here
HMLAN_condUpdate($hash,252);# trigger timeout event HMLAN_condUpdate($hash,253);# trigger timeout event
DevIo_Disconnected($hash); DevIo_Disconnected($hash);
} }
else{ else{
@ -1037,9 +1037,9 @@ sub HMLAN_KeepAliveCheck($) {##################################################
} }
} }
else{ else{
$hash->{helper}{q}{keepAliveRpt}=0; $hash->{helper}{q}{keepAliveRpt} = 0;
HMLAN_condUpdate($hash,0) if ($hash->{helper}{q}{HMcndN} == 255);
} }
} }
sub HMLAN_secSince2000() {##################################################### sub HMLAN_secSince2000() {#####################################################
# Calculate the local time in seconds from 2000. # Calculate the local time in seconds from 2000.
@ -1090,6 +1090,11 @@ sub HMLAN_clearQ($) {#clear pending acks due to timeout########################
sub HMLAN_condUpdate($$) {##################################################### sub HMLAN_condUpdate($$) {#####################################################
my($hash,$HMcnd) = @_; my($hash,$HMcnd) = @_;
my $name = $hash->{NAME}; my $name = $hash->{NAME};
if (AttrVal($name,"dummy",undef)){
readingsUpdateSingle($hash,"state","disconnected");
$hash->{XmitOpen} = 0;
return;
}
my $hashCnd = $hash->{helper}{cnd};#short to helper my $hashCnd = $hash->{helper}{cnd};#short to helper
my $hashQ = $hash->{helper}{q};#short to helper my $hashQ = $hash->{helper}{q};#short to helper
$hash->{helper}{cnd}{$HMcnd} = 0 if (!$hash->{helper}{cnd} || $hash->{helper}{cnd}{$HMcnd} = 0 if (!$hash->{helper}{cnd} ||
@ -1107,7 +1112,7 @@ sub HMLAN_condUpdate($$) {#####################################################
if (InternalVal($name,"STATE","") eq "overload"); if (InternalVal($name,"STATE","") eq "overload");
} }
my $HMcndTxt = $HMcond{$HMcnd}?$HMcond{$HMcnd}:"Unknown:$HMcnd"; my $HMcndTxt = $HMcond{$HMcnd} ? $HMcond{$HMcnd} : "Unknown:$HMcnd";
Log3 $hash, 1, "HMLAN_Parse: $name new condition $HMcndTxt"; Log3 $hash, 1, "HMLAN_Parse: $name new condition $HMcndTxt";
my $txt; my $txt;
$txt .= $HMcond{$_}.":".$hash->{helper}{cnd}{$_}." " $txt .= $HMcond{$_}.":".$hash->{helper}{cnd}{$_}." "