2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-21 14:04:15 +00:00

obey comma values for virtHum

git-svn-id: https://svn.fhem.de/fhem/trunk@4841 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876 2014-02-08 06:19:51 +00:00
parent 51fa0ca46d
commit cf0dc3f138

View File

@ -279,6 +279,7 @@ sub CUL_HM_updateConfig($){
CUL_HM_Set($hash,$name,"virtTemp",ReadingsVal($name,"temperature","")); CUL_HM_Set($hash,$name,"virtTemp",ReadingsVal($name,"temperature",""));
CUL_HM_Set($hash,$name,"virtHum" ,ReadingsVal($name,"humidity","")); CUL_HM_Set($hash,$name,"virtHum" ,ReadingsVal($name,"humidity",""));
RemoveInternalTimer("valvePos:$vId"); RemoveInternalTimer("valvePos:$vId");
RemoveInternalTimer("valveTmr:$vId");
InternalTimer(ReadingsVal($name,".next",1) InternalTimer(ReadingsVal($name,".next",1)
,"CUL_HM_valvePosUpdt","valvePos:$vId",0); ,"CUL_HM_valvePosUpdt","valvePos:$vId",0);
} }
@ -3670,19 +3671,22 @@ sub CUL_HM_valvePosUpdt(@) {#update valve position periodically to please valve
$hash->{helper}{vd}{nextM} = $tn+$nextTimer; $hash->{helper}{vd}{nextM} = $tn+$nextTimer;
$hash->{helper}{vd}{msgCnt} = $msgCnt; $hash->{helper}{vd}{msgCnt} = $msgCnt;
if ($hash->{helper}{vd}{cmd}){ if ($hash->{helper}{vd}{cmd}){
if ($hash->{helper}{vd}{typ} == 1){ if ($hash->{helper}{vd}{typ} == 1){
CUL_HM_PushCmdStack($hash,sprintf("%02X%s%s%s" CUL_HM_PushCmdStack($hash,sprintf("%02X%s%s%s"
,$msgCnt ,$msgCnt
,$hash->{helper}{vd}{cmd} ,$hash->{helper}{vd}{cmd}
,$hash->{helper}{virtTC} ,$hash->{helper}{virtTC}
,$hash->{helper}{vd}{val})) ,$hash->{helper}{vd}{val}))
if(ReadingsVal($name,"valveCtrl","init") ne "init"); if(ReadingsVal($name,"valveCtrl","init") ne "init");
InternalTimer($tn+10,"CUL_HM_valvePosTmr","valveTmr:$vId",0);
} }
else{ elsif ($hash->{helper}{vd}{typ} == 2){
CUL_HM_PushCmdStack($hash,sprintf("%02X%s%s" CUL_HM_PushCmdStack($hash,sprintf("%02X%s%s"
,$msgCnt ,$msgCnt
,$hash->{helper}{vd}{cmd} ,$hash->{helper}{vd}{cmd}
,$hash->{helper}{vd}{val})); ,$hash->{helper}{vd}{val}));
$hash->{helper}{vd}{next} = $hash->{helper}{vd}{nextM};
InternalTimer($hash->{helper}{vd}{next},"CUL_HM_valvePosUpdt","valvePos:$vId",0);
} }
} }
else{ else{
@ -3692,40 +3696,37 @@ sub CUL_HM_valvePosUpdt(@) {#update valve position periodically to please valve
} }
$hash->{helper}{virtTC} = "00"; $hash->{helper}{virtTC} = "00";
CUL_HM_ProcessCmdStack($hash); CUL_HM_ProcessCmdStack($hash);
InternalTimer($tn+10,"CUL_HM_valvePosTmr","valveTmr:$vId",0);
} }
sub CUL_HM_valvePosTmr(@) {#calc next vd wakeup sub CUL_HM_valvePosTmr(@) {#calc next vd wakeup
my($in ) = @_; my($in ) = @_;
my(undef,$vId) = split(':',$in); my(undef,$vId) = split(':',$in);
my $hash = CUL_HM_id2Hash($vId); my $hash = CUL_HM_id2Hash($vId);
my $name = $hash->{NAME}; my $name = $hash->{NAME};
if ($hash->{helper}{vd}{typ} == 1){ if (ReadingsVal($name,"valveCtrl","init") eq "init") {
if (ReadingsVal($name,"valveCtrl","init") eq "init") { $hash->{helper}{vd}{next} = $hash->{helper}{vd}{nextF};
CUL_HM_UpdtReadSingle($hash,"valveCtrl","ready",1);
}
else {
my $pn = CUL_HM_id2Name($hash->{helper}{vd}{id});
my $ackTime = ReadingsTimestamp($pn, "ValvePosition", "");
my $vc;
if (!$ackTime || $ackTime eq $hash->{helper}{vd}{ackT} ){
$hash->{helper}{vd}{next} = $hash->{helper}{vd}{nextF}; $hash->{helper}{vd}{next} = $hash->{helper}{vd}{nextF};
CUL_HM_UpdtReadSingle($hash,"valveCtrl","ready",1); $vc = (++$hash->{helper}{vd}{miss} > 5)
?"lost"
:"miss_".$hash->{helper}{vd}{miss};
Log3 $name,5,"CUL_HM $name virtualTC use fail-timer";
} }
else { else{
my $pn = CUL_HM_id2Name($hash->{helper}{vd}{id}); CUL_HM_UpdtReadBulk($hash,0,".next:".$hash->{helper}{vd}{next}
my $ackTime = ReadingsTimestamp($pn, "ValvePosition", ""); ,".msgCnt:".($hash->{helper}{vd}{msgCnt}-1));
my $vc; $hash->{helper}{vd}{next} = $hash->{helper}{vd}{nextM};
if (!$ackTime || $ackTime eq $hash->{helper}{vd}{ackT} ){ $vc = "ok";
$hash->{helper}{vd}{next} = $hash->{helper}{vd}{nextF}; $hash->{helper}{vd}{miss} = 0;
$vc = (++$hash->{helper}{vd}{miss} > 5)
?"lost"
:"miss_".$hash->{helper}{vd}{miss};
Log3 $name,5,"CUL_HM $name virtualTC use fail-timer";
}
else{
CUL_HM_UpdtReadBulk($hash,0,".next:".$hash->{helper}{vd}{next}
,".msgCnt:".($hash->{helper}{vd}{msgCnt}-1));
$hash->{helper}{vd}{next} = $hash->{helper}{vd}{nextM};
$vc = "ok";
$hash->{helper}{vd}{miss} = 0;
}
CUL_HM_UpdtReadSingle($hash,"valveCtrl",$vc,1)
if(ReadingsVal($name,"valveCtrl","") ne $vc);
$hash->{helper}{vd}{ackT} = $ackTime;
} }
CUL_HM_UpdtReadSingle($hash,"valveCtrl",$vc,1)
if(ReadingsVal($name,"valveCtrl","") ne $vc);
$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);
} }