2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-01 01:09:47 +00:00

improve valveCtrl

git-svn-id: https://svn.fhem.de/fhem/trunk@4823 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876 2014-02-06 19:23:26 +00:00
parent 1a528a4b34
commit 98720cb6a1
2 changed files with 27 additions and 19 deletions

View File

@ -281,7 +281,7 @@ sub CUL_HM_updateConfig($){
RemoveInternalTimer("valvePos:$vId");
InternalTimer(ReadingsVal($name,".next",1)
,"CUL_HM_valvePosUpdt","valvePos:$vId",0);
}
}
}
next if ($nAttr);# stop if default setting if attributes is not desired
@ -3605,7 +3605,8 @@ sub CUL_HM_valvePosUpdt(@) {#update valve position periodically to please valve
$hash->{helper}{vd}{nextM} = $tn+$nextTimer;
$hash->{helper}{vd}{msgCnt} = $msgCnt;
if ($hash->{helper}{vd}{cmd}){
if ($hash->{helper}{vd}{typ} == 1){
if ( $hash->{helper}{vd}{typ} == 1
&& ReadingsVal($name,"valveCtrl","init") ne "init"){
CUL_HM_PushCmdStack($hash,sprintf("%02X%s%s%s"
,$msgCnt
,$hash->{helper}{vd}{cmd}
@ -3634,26 +3635,32 @@ sub CUL_HM_valvePosTmr(@) {#calc next vd wakeup
my $hash = CUL_HM_id2Hash($vId);
my $name = $hash->{NAME};
if ($hash->{helper}{vd}{typ} == 1){
my $pn = CUL_HM_id2Name($hash->{helper}{vd}{id});
my $ackTime = ReadingsTimestamp($pn, "ValvePosition", "");
my $vc;
if (!$ackTime || $ackTime eq $hash->{helper}{vd}{ackT} ){
if (ReadingsVal($name,"valveCtrl","init") eq "init") {
$hash->{helper}{vd}{next} = $hash->{helper}{vd}{nextF};
$vc = (++$hash->{helper}{vd}{miss} > 5)
?"lost"
:"miss_".$hash->{helper}{vd}{miss};
Log3 $name,5,"CUL_HM $name virtualTC use fail-timer";
CUL_HM_UpdtReadSingle($hash,"valveCtrl","ready",1);
}
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;
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};
$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);
}

View File

@ -434,6 +434,7 @@ my $K_actDetID = '000000'; # id of actionDetector
# Blind 9:00 10:00 20:00
# BL1TPBU 02:01 21:FF
# Dim1TPBU 02:01 21:FF 22:00
# TC-IT 16:00
#Keymatic 3.3 unknown, seen 1 here
#--- list 1, Channel level------------------