2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-19 12:46:03 +00:00

valvPos again

git-svn-id: https://svn.fhem.de/fhem/trunk@4711 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876 2014-01-22 11:32:56 +00:00
parent c3fc0176ce
commit 070559fede
2 changed files with 17 additions and 19 deletions

View File

@ -896,7 +896,6 @@ sub CUL_HM_Parse($$) {##############################
my $dHash = $shash; my $dHash = $shash;
$shash = $modules{CUL_HM}{defptr}{"$src$chn"} $shash = $modules{CUL_HM}{defptr}{"$src$chn"}
if($modules{CUL_HM}{defptr}{"$src$chn"}); if($modules{CUL_HM}{defptr}{"$src$chn"});
my %errTbl=( 0=>"ok", 1=>"ValveTight", 2=>"adjustRangeTooLarge" my %errTbl=( 0=>"ok", 1=>"ValveTight", 2=>"adjustRangeTooLarge"
,3=>"adjustRangeTooSmall" , 4=>"communicationERR" ,3=>"adjustRangeTooSmall" , 4=>"communicationERR"
,5=>"unknown" , 6=>"lowBat" , 7=>"ValveErrorPosition" ); ,5=>"unknown" , 6=>"lowBat" , 7=>"ValveErrorPosition" );
@ -1709,7 +1708,7 @@ sub CUL_HM_parseCommon(@){#####################################################
$reply = "ACKStatus"; $reply = "ACKStatus";
my $chnHash = CUL_HM_id2Hash($src.substr($p,2,2)); my $chnHash = CUL_HM_id2Hash($src.substr($p,2,2));
readingsSingleUpdate($chnHash,"recentStateType","ack",0); CUL_HM_UpdtReadSingle($chnHash,"recentStateType","ack",0);
if ($shash->{helper}{tmdOn}){ if ($shash->{helper}{tmdOn}){
if (not hex(substr($p,6,2))&0x40){# not timedOn, we have to repeat if (not hex(substr($p,6,2))&0x40){# not timedOn, we have to repeat
@ -1749,7 +1748,7 @@ sub CUL_HM_parseCommon(@){#####################################################
my $chn = sprintf("%02X",hex(substr($p,2,2))&0x3f); my $chn = sprintf("%02X",hex(substr($p,2,2))&0x3f);
my $chnhash = $modules{CUL_HM}{defptr}{$chn?$src.$chn:$src}; my $chnhash = $modules{CUL_HM}{defptr}{$chn?$src.$chn:$src};
$chnhash = $shash if(!$chnhash); $chnhash = $shash if(!$chnhash);
readingsSingleUpdate($chnhash,"CommandAccepted",$success,0); CUL_HM_UpdtReadSingle($chnhash,"CommandAccepted",$success,0);
CUL_HM_ProcessCmdStack($shash) if(CUL_HM_IOid($shash) eq $dst); CUL_HM_ProcessCmdStack($shash) if(CUL_HM_IOid($shash) eq $dst);
delete $shash->{helper}{prt}{wuReSent} delete $shash->{helper}{prt}{wuReSent}
if (!$shash->{helper}{prt}{mmcS}); if (!$shash->{helper}{prt}{mmcS});
@ -1892,7 +1891,8 @@ sub CUL_HM_parseCommon(@){#####################################################
if ( defined $lastAddr if ( defined $lastAddr
&& ( $lastAddr > $shash->{helper}{prt}{rspWait}{nAddr} && ( $lastAddr > $shash->{helper}{prt}{rspWait}{nAddr}
|| $lastAddr == 0)){ || $lastAddr == 0)){
readingsSingleUpdate($chnHash,$regLN,
CUL_HM_UpdtReadSingle($chnHash,$regLN,
ReadingsVal($chnName,$regLN,"")." ".$data,0); ReadingsVal($chnName,$regLN,"")." ".$data,0);
$shash->{helper}{prt}{rspWait}{nAddr} = $lastAddr; $shash->{helper}{prt}{rspWait}{nAddr} = $lastAddr;
} }
@ -1900,7 +1900,7 @@ sub CUL_HM_parseCommon(@){#####################################################
if ($data =~ m/00:00$/){ # this was the last message in the block if ($data =~ m/00:00$/){ # this was the last message in the block
if($list eq "00"){ if($list eq "00"){
my $name = CUL_HM_id2Name($src); my $name = CUL_HM_id2Name($src);
readingsSingleUpdate($shash,"PairedTo", CUL_HM_UpdtReadSingle($shash,"PairedTo",
CUL_HM_getRegFromStore($name,"pairCentral",0,""),0); CUL_HM_getRegFromStore($name,"pairCentral",0,""),0);
} }
CUL_HM_respPendRm($shash); CUL_HM_respPendRm($shash);
@ -1943,7 +1943,7 @@ sub CUL_HM_parseCommon(@){#####################################################
$chnHash->{helper}{shadowReg}{$regLNp} = $shdwReg; $chnHash->{helper}{shadowReg}{$regLNp} = $shdwReg;
$lN = join(' ',sort(split(' ',$lN)));# re-order $lN = join(' ',sort(split(' ',$lN)));# re-order
if ($lN =~ s/00:00//){$lN .= " 00:00"}; if ($lN =~ s/00:00//){$lN .= " 00:00"};
readingsSingleUpdate($chnHash,$regLN,$lN,0); CUL_HM_UpdtReadSingle($chnHash,$regLN,$lN,0);
CUL_HM_updtRegDisp($chnHash,$list,$peerID); CUL_HM_updtRegDisp($chnHash,$list,$peerID);
$ret= "parsed"; $ret= "parsed";
} }
@ -1956,7 +1956,7 @@ sub CUL_HM_parseCommon(@){#####################################################
@{$modules{CUL_HM}{helper}{qReqStat}} = grep { $_ ne $shash->{NAME} } @{$modules{CUL_HM}{helper}{qReqStat}} = grep { $_ ne $shash->{NAME} }
@{$modules{CUL_HM}{helper}{qReqStat}}; @{$modules{CUL_HM}{helper}{qReqStat}};
my $chnHash = CUL_HM_id2Hash($src.substr($p,2,2)); my $chnHash = CUL_HM_id2Hash($src.substr($p,2,2));
readingsSingleUpdate($chnHash,"recentStateType","info",0); CUL_HM_UpdtReadSingle($chnHash,"recentStateType","info",0);
if ($pendType eq "StatusReq"){#it is the answer to our request if ($pendType eq "StatusReq"){#it is the answer to our request
my $chnSrc = $src.$shash->{helper}{prt}{rspWait}{forChn}; my $chnSrc = $src.$shash->{helper}{prt}{rspWait}{forChn};
@ -3528,21 +3528,21 @@ sub CUL_HM_valvePosTmr(@) {#calc next vd wakeup
my $pn = CUL_HM_id2Name($hash->{helper}{vd}{id}); my $pn = CUL_HM_id2Name($hash->{helper}{vd}{id});
my $ackTime = ReadingsTimestamp($pn, "ValvePosition", ""); my $ackTime = ReadingsTimestamp($pn, "ValvePosition", "");
my $vc;
if (!$ackTime || $ackTime eq $hash->{helper}{vd}{ackT} ){ if (!$ackTime || $ackTime eq $hash->{helper}{vd}{ackT} ){
$hash->{helper}{vd}{next} = $hash->{helper}{vd}{nextF}; $hash->{helper}{vd}{next} = $hash->{helper}{vd}{nextF};
$hash->{helper}{vd}{miss}++; $vc = (++$hash->{helper}{vd}{miss} > 5)
CUL_HM_UpdtReadSingle($hash,"valveCtrl","lost",1) ?"lost"
if( $hash->{helper}{vd}{miss} > 6 :"miss_".$hash->{helper}{vd}{miss};
&& ReadingsVal($hash->{NAME},"valveCtrl","") ne "lost");
Log3 $hash->{NAME},5,"CUL_HM $hash->{NAME} virtualTC use fail-timer"; Log3 $hash->{NAME},5,"CUL_HM $hash->{NAME} virtualTC use fail-timer";
} }
else{ else{
$hash->{helper}{vd}{next} = $hash->{helper}{vd}{nextM}; $hash->{helper}{vd}{next} = $hash->{helper}{vd}{nextM};
CUL_HM_UpdtReadSingle($hash,"valveCtrl","ok",1) $vc = "ok";
if(ReadingsVal($hash->{NAME},"valveCtrl","") ne "ok");
$hash->{helper}{vd}{miss} = 0; $hash->{helper}{vd}{miss} = 0;
} }
CUL_HM_UpdtReadSingle($hash,"valveCtrl",$vc,1)
if(ReadingsVal($hash->{NAME},"valveCtrl","") ne $vc);
$hash->{helper}{vd}{ackT} = $ackTime; $hash->{helper}{vd}{ackT} = $ackTime;
InternalTimer($hash->{helper}{vd}{next},"CUL_HM_valvePosUpdt","valvePos:$vId",0); InternalTimer($hash->{helper}{vd}{next},"CUL_HM_valvePosUpdt","valvePos:$vId",0);
} }

View File

@ -1123,9 +1123,9 @@ sub HMinfo_status($){##########################################################
$hash->{I_autoReadPend} = join ",",@{$modules{CUL_HM}{helper}{qReqConf}}; $hash->{I_autoReadPend} = join ",",@{$modules{CUL_HM}{helper}{qReqConf}};
push @updates,"I_autoReadPend:". scalar @{$modules{CUL_HM}{helper}{qReqConf}}; push @updates,"I_autoReadPend:". scalar @{$modules{CUL_HM}{helper}{qReqConf}};
} }
else{ # else{
# delete $hash->{I_autoReadPend}; # delete $hash->{I_autoReadPend};
} # }
# ------- what about rssi low readings ------ # ------- what about rssi low readings ------
foreach (grep {$rssiMin{$_} != 0}keys %rssiMin){ foreach (grep {$rssiMin{$_} != 0}keys %rssiMin){
@ -1140,10 +1140,8 @@ sub HMinfo_status($){##########################################################
$d .= "$_:$rssiMinCnt{$_} " foreach (sort keys %rssiMinCnt); $d .= "$_:$rssiMinCnt{$_} " foreach (sort keys %rssiMinCnt);
push @updates,"I_rssiMinLevel:".$d; push @updates,"I_rssiMinLevel:".$d;
$hash->{ERR___rssiCrit} = join(",",@rssiNames) if (@rssiNames); $hash->{ERR___rssiCrit} = join(",",@rssiNames) if (@rssiNames);
# push @updates,":".$hash->{ERR___rssiCrit} if(@rssiNames);
# ------- what about others ------ # ------- what about others ------
$hash->{W_unConfRegs} = join(",",@shdwNames) if (@shdwNames > 0); $hash->{W_unConfRegs} = join(",",@shdwNames) if (@shdwNames > 0);
# push @updates,":".$hash->{W_unConfRegs} if(@shdwNames > 0);
# ------- update own status ------ # ------- update own status ------
$hash->{STATE} = "updated:".TimeNow(); $hash->{STATE} = "updated:".TimeNow();
my $updt = join",",@updates; my $updt = join",",@updates;