mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
VD simulation
git-svn-id: https://svn.fhem.de/fhem/trunk@4558 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
03120b170a
commit
16b1e44d68
@ -3096,7 +3096,18 @@ sub CUL_HM_Set($@) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
my $vp = $a[2];
|
my $vp = $a[2];
|
||||||
|
foreach my $peer (split(',',AttrVal($name,"peerIDs",""))) {
|
||||||
|
next if (length($peer) != 8);
|
||||||
|
my $ph = CUL_HM_id2Hash($peer);
|
||||||
|
CUL_HM_UpdtReadBulk($ph,1,
|
||||||
|
"state:set_$vp %",
|
||||||
|
"ValveDesired:$vp %")
|
||||||
|
if ($ph);
|
||||||
|
}
|
||||||
readingsSingleUpdate($hash,"valvePosTC","$vp %",0);
|
readingsSingleUpdate($hash,"valvePosTC","$vp %",0);
|
||||||
|
$hash->{helper}{vd}{idh} = hex(substr($dst,2,2))*20077;
|
||||||
|
$hash->{helper}{vd}{idl} = hex(substr($dst,4,2))*256;
|
||||||
|
$hash->{helper}{vd}{msgCnt} = 1;
|
||||||
CUL_HM_valvePosUpdt("valvePos:$dst$chn") if (!$hash->{helper}{virtTC});
|
CUL_HM_valvePosUpdt("valvePos:$dst$chn") if (!$hash->{helper}{virtTC});
|
||||||
$hash->{helper}{virtTC} = "03";
|
$hash->{helper}{virtTC} = "03";
|
||||||
$state = "ValveAdjust:$vp %";
|
$state = "ValveAdjust:$vp %";
|
||||||
@ -3402,13 +3413,13 @@ sub CUL_HM_valvePosUpdt(@) {#update valve position periodically to please valve
|
|||||||
my(undef,$vId) = split(':',$in);
|
my(undef,$vId) = split(':',$in);
|
||||||
my $hash = CUL_HM_id2Hash($vId);
|
my $hash = CUL_HM_id2Hash($vId);
|
||||||
my $vDevId = substr($vId,0,6);
|
my $vDevId = substr($vId,0,6);
|
||||||
my $nextTimer = 150;
|
my $msgCnt = ($hash->{helper}{vd}{msgCnt} + 1)%255;
|
||||||
|
|
||||||
|
my $idl = $hash->{helper}{vd}{idl}+$msgCnt;
|
||||||
|
my $lo = int(($idl*20077+12345)/65536)&0xff;
|
||||||
|
my $hi = ($hash->{helper}{vd}{idh}+$idl*198)&0xff;
|
||||||
|
my $nextTimer = (($lo+$hi)&0xff)/4 +120;
|
||||||
|
|
||||||
# if ($updtValveCnt++ %2){
|
|
||||||
# $nextTimer = 20;
|
|
||||||
# CUL_HM_PushCmdStack($hash,"++8670".$vDevId."00000000D036");# some weather event -
|
|
||||||
# }
|
|
||||||
# else{
|
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
my $vp = ReadingsVal($name,"valvePosTC","15 %");
|
my $vp = ReadingsVal($name,"valvePosTC","15 %");
|
||||||
$vp =~ s/ %//;
|
$vp =~ s/ %//;
|
||||||
@ -3416,10 +3427,10 @@ sub CUL_HM_valvePosUpdt(@) {#update valve position periodically to please valve
|
|||||||
foreach my $peer (sort(split(',',AttrVal($name,"peerIDs","")))) {
|
foreach my $peer (sort(split(',',AttrVal($name,"peerIDs","")))) {
|
||||||
next if (length($peer) != 8);
|
next if (length($peer) != 8);
|
||||||
$peer = substr($peer,0,6);
|
$peer = substr($peer,0,6);
|
||||||
CUL_HM_PushCmdStack($hash,sprintf("++A258%s%s%s%02X",$vDevId
|
CUL_HM_PushCmdStack($hash,sprintf("%02XA258%s%s%s%02X",$msgCnt,$vDevId
|
||||||
,$peer,$hash->{helper}{virtTC},$vp));
|
,$peer,$hash->{helper}{virtTC},$vp));
|
||||||
}
|
}
|
||||||
# }
|
$hash->{helper}{vd}{msgCnt} = $msgCnt;
|
||||||
$hash->{helper}{virtTC} = "00";
|
$hash->{helper}{virtTC} = "00";
|
||||||
CUL_HM_ProcessCmdStack($hash);
|
CUL_HM_ProcessCmdStack($hash);
|
||||||
InternalTimer(gettimeofday()+$nextTimer,"CUL_HM_valvePosUpdt","valvePos:$vId",0);
|
InternalTimer(gettimeofday()+$nextTimer,"CUL_HM_valvePosUpdt","valvePos:$vId",0);
|
||||||
@ -4148,12 +4159,16 @@ sub CUL_HM_ID2PeerList ($$$) {
|
|||||||
my $st = AttrVal($dHash->{NAME},"subType","");
|
my $st = AttrVal($dHash->{NAME},"subType","");
|
||||||
if ($st eq "virtual"){
|
if ($st eq "virtual"){
|
||||||
#if any of the peers is an SD we are team master
|
#if any of the peers is an SD we are team master
|
||||||
my $tMstr = 0;
|
my ($tMstr,$tcSim) = (0,0);
|
||||||
foreach (split(",",$peerNames)){
|
foreach (split(",",$peerNames)){
|
||||||
$tMstr = 1 if(AttrVal($_,"subType","") eq "smokeDetector");
|
$tMstr = 1 if(AttrVal($_,"subType","") eq "smokeDetector");
|
||||||
|
$tcSim = 1 if(AttrVal($_,"model","") eq "HM-CC-VD");
|
||||||
}
|
}
|
||||||
if($tMstr){$hash->{sdTeam}="sdLead";$hash->{helper}{fkt}="sdLead";}
|
if ($tMstr){$hash->{helper}{fkt}="sdLead";$hash->{sdTeam}="sdLead";}
|
||||||
else {delete $hash->{sdTeam}; delete $hash->{helper}{fkt};}
|
elsif($tcSim){$hash->{helper}{fkt}="vdCtrl";}
|
||||||
|
else {delete $hash->{helper}{fkt};}
|
||||||
|
|
||||||
|
if(!$tMstr) {delete $hash->{sdTeam};}
|
||||||
}
|
}
|
||||||
elsif ($st eq "smokeDetector"){
|
elsif ($st eq "smokeDetector"){
|
||||||
foreach (split(",",$peerNames)){
|
foreach (split(",",$peerNames)){
|
||||||
@ -5316,10 +5331,13 @@ sub CUL_HM_autoReadReady($){# capacity for autoread available?
|
|||||||
|
|
||||||
sub CUL_HM_getAttrInt($@){#return attrValue as integer
|
sub CUL_HM_getAttrInt($@){#return attrValue as integer
|
||||||
my ($name,$attrName,$default) = @_;
|
my ($name,$attrName,$default) = @_;
|
||||||
my $val = $attr{$name}{$attrName}?$attr{$name}{$attrName}:"";
|
$default = 0 if (!defined $default);
|
||||||
|
my $val = ($attr{$name} &&
|
||||||
|
$attr{$name}{$attrName})
|
||||||
|
?$attr{$name}{$attrName}
|
||||||
|
:"";
|
||||||
no warnings 'numeric';
|
no warnings 'numeric';
|
||||||
my $devN = $defs{$name}{device}?$defs{$name}{device}:$name;
|
my $devN = $defs{$name}{device}?$defs{$name}{device}:$name;
|
||||||
$default = 0 if (!defined $default);
|
|
||||||
$val = int($attr{$devN}{$attrName}?$attr{$devN}{$attrName}:$default)+0
|
$val = int($attr{$devN}{$attrName}?$attr{$devN}{$attrName}:$default)+0
|
||||||
if($val eq "");
|
if($val eq "");
|
||||||
use warnings 'numeric';
|
use warnings 'numeric';
|
||||||
|
@ -1122,7 +1122,6 @@ $culHmRegChan{"HM-TC-IT-WM-W-EU06"}= $culHmRegType{"HM-CC-RT-DN06"};
|
|||||||
,press =>"[long|short]..."
|
,press =>"[long|short]..."
|
||||||
,postEvent =>"<condition>"
|
,postEvent =>"<condition>"
|
||||||
,postWeather =>"<off| -80..80 degree>"
|
,postWeather =>"<off| -80..80 degree>"
|
||||||
# ,valvePos =>"<position>"
|
|
||||||
},
|
},
|
||||||
smokeDetector =>{ peerChan =>"<btnNumber> <actChn> ... single [set|unset] actor"},
|
smokeDetector =>{ peerChan =>"<btnNumber> <actChn> ... single [set|unset] actor"},
|
||||||
winMatic =>{ matic =>"<btn>"
|
winMatic =>{ matic =>"<btn>"
|
||||||
@ -1259,6 +1258,8 @@ $culHmChanSets{"HM-ES-PMSw1-Pl06"} = $culHmChanSets{"HM-ES-PMSw1-Pl03"};
|
|||||||
sdLead =>{ alarmOn =>""
|
sdLead =>{ alarmOn =>""
|
||||||
,alarmOff =>""
|
,alarmOff =>""
|
||||||
,teamCall =>""
|
,teamCall =>""
|
||||||
|
},
|
||||||
|
vdCtrl =>{ valvePos =>"<position>"
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1463,32 +1464,4 @@ $culHmChanSets{"HM-ES-PMSw1-Pl06"} = $culHmChanSets{"HM-ES-PMSw1-Pl03"};
|
|||||||
HUM => '04,2,$val=(hex($val))', } },
|
HUM => '04,2,$val=(hex($val))', } },
|
||||||
);
|
);
|
||||||
|
|
||||||
#sub HMConfig_getHash($){
|
|
||||||
# my $hn = shift;
|
|
||||||
# return %culHmModel if($hn eq "culHmModel" );
|
|
||||||
# return %culHmRegDefShLg if($hn eq "culHmRegDefShLg" );
|
|
||||||
# return %culHmRegDefine if($hn eq "culHmRegDefine" );
|
|
||||||
# return %culHmRegGeneral if($hn eq "culHmRegGeneral" );
|
|
||||||
# return %culHmRegType if($hn eq "culHmRegType" );
|
|
||||||
# return %culHmRegModel if($hn eq "culHmRegModel" );
|
|
||||||
# return %culHmRegChan if($hn eq "culHmRegChan" );
|
|
||||||
#
|
|
||||||
# return %culHmGlobalGets if($hn eq "culHmGlobalGets" );
|
|
||||||
# return %culHmSubTypeGets if($hn eq "culHmSubTypeGets" );
|
|
||||||
# return %culHmModelGets if($hn eq "culHmModelGets" );
|
|
||||||
#
|
|
||||||
# return %culHmGlobalSetsDevice if($hn eq "culHmGlobalSetsDevice");
|
|
||||||
# return %culHmSubTypeDevSets if($hn eq "culHmSubTypeDevSets" );
|
|
||||||
# return %culHmGlobalSetsChn if($hn eq "culHmGlobalSetsChn" );
|
|
||||||
# return %culHmGlobalSets if($hn eq "culHmGlobalSets" );
|
|
||||||
# return %culHmGlobalSetsVrtDev if($hn eq "culHmGlobalSetsVrtDev");
|
|
||||||
# return %culHmSubTypeSets if($hn eq "culHmSubTypeSets" );
|
|
||||||
# return %culHmModelSets if($hn eq "culHmModelSets" );
|
|
||||||
# return %culHmChanSets if($hn eq "culHmChanSets" );
|
|
||||||
# return %culHmFunctSets if($hn eq "culHmFunctSets" );
|
|
||||||
#
|
|
||||||
# return %culHmBits if($hn eq "culHmBits" );
|
|
||||||
# return @culHmCmdFlags if($hn eq "culHmCmdFlags" );
|
|
||||||
# return $K_actDetID if($hn eq "K_actDetID" );
|
|
||||||
#}
|
|
||||||
1;
|
1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user