mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-04 11:26:55 +00:00
valveCtrl over reboot, lazy config support
git-svn-id: https://svn.fhem.de/fhem/trunk@4804 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
8325bfc8e6
commit
9f407adbb8
@ -417,13 +417,18 @@ sub HMLAN_Write($$$) {#########################################################
|
|||||||
if (!$hash->{assIDs}{$dst} && $dst ne "000000"){
|
if (!$hash->{assIDs}{$dst} && $dst ne "000000"){
|
||||||
HMLAN_SimpleWrite($hash, $IDadd);
|
HMLAN_SimpleWrite($hash, $IDadd);
|
||||||
my $dN = CUL_HM_id2Name($dst);
|
my $dN = CUL_HM_id2Name($dst);
|
||||||
if (!($dN eq $dst) && # name not found
|
if (!($dN eq $dst) ){# name not found
|
||||||
!(CUL_HM_Get(CUL_HM_id2Hash($dst),$dN,"param","rxType") & ~0x04)){#config only
|
my $rxt = CUL_HM_Get(CUL_HM_id2Hash($dst),$dN,"param","rxType");
|
||||||
|
if (!($rxt & ~0x04)){#config only
|
||||||
$hash->{helper}{$dst}{newChn} = '+'.$dst.",01,01,FE1F";
|
$hash->{helper}{$dst}{newChn} = '+'.$dst.",01,01,FE1F";
|
||||||
}
|
}
|
||||||
|
elsif($rxt & 0x10){#lazyConfig
|
||||||
|
$hash->{helper}{$dst}{newChn} = '+'.$dst.',03,01,1E';
|
||||||
|
}
|
||||||
else{
|
else{
|
||||||
$hash->{helper}{$dst}{newChn} = '+'.$dst.',00,01,';
|
$hash->{helper}{$dst}{newChn} = '+'.$dst.',00,01,';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$hash->{helper}{$dst}{name} = CUL_HM_id2Name($dst);
|
$hash->{helper}{$dst}{name} = CUL_HM_id2Name($dst);
|
||||||
$hash->{assIDs}{$dst} = 1;
|
$hash->{assIDs}{$dst} = 1;
|
||||||
$hash->{assignedIDs}=join(',',keys %{$hash->{assIDs}});
|
$hash->{assignedIDs}=join(',',keys %{$hash->{assIDs}});
|
||||||
|
@ -1666,7 +1666,9 @@ sub CUL_HM_Parse($$) {##############################
|
|||||||
$devH->{helper}{rpt}{ack} = \@ack;
|
$devH->{helper}{rpt}{ack} = \@ack;
|
||||||
$devH->{helper}{rpt}{ts} = gettimeofday();
|
$devH->{helper}{rpt}{ts} = gettimeofday();
|
||||||
my $i=0;
|
my $i=0;
|
||||||
|
my $rr = $respRemoved;
|
||||||
CUL_HM_SndCmd($ack[$i++],$ack[$i++])while ($i<@ack);
|
CUL_HM_SndCmd($ack[$i++],$ack[$i++])while ($i<@ack);
|
||||||
|
$respRemoved = $rr;
|
||||||
Log3 $name,6,"CUL_HM $name sent ACK:".(int(@ack));
|
Log3 $name,6,"CUL_HM $name sent ACK:".(int(@ack));
|
||||||
}
|
}
|
||||||
CUL_HM_ProcessCmdStack($shash) if ($respRemoved); # cont if complete
|
CUL_HM_ProcessCmdStack($shash) if ($respRemoved); # cont if complete
|
||||||
@ -1692,9 +1694,10 @@ sub CUL_HM_parseCommon(@){#####################################################
|
|||||||
# TC wakes up with 8270, not with A258
|
# TC wakes up with 8270, not with A258
|
||||||
# VD wakes up with 8202
|
# VD wakes up with 8202
|
||||||
# 9610
|
# 9610
|
||||||
|
my $rxt = CUL_HM_getRxType($shash);
|
||||||
if(CUL_HM_getRxType($shash) & 0x08){ #wakeup device
|
my $mFlgH = hex($mFlg);
|
||||||
if((hex($mFlg) & 0xA2) == 0x82){ #wakeup signal
|
if($rxt & 0x08){ #wakeup device
|
||||||
|
if(($mFlgH & 0xA2) == 0x82){ #wakeup signal
|
||||||
CUL_HM_appFromQ($shash->{NAME},"wu");# stack cmds if waiting
|
CUL_HM_appFromQ($shash->{NAME},"wu");# stack cmds if waiting
|
||||||
if ($shash->{cmdStack}){
|
if ($shash->{cmdStack}){
|
||||||
CUL_HM_SndCmd($shash, '++A112'.CUL_HM_IOid($shash).$src);
|
CUL_HM_SndCmd($shash, '++A112'.CUL_HM_IOid($shash).$src);
|
||||||
@ -1703,9 +1706,21 @@ sub CUL_HM_parseCommon(@){#####################################################
|
|||||||
}
|
}
|
||||||
elsif($shash->{helper}{prt}{sProc} != 1){ # no wakeup signal,
|
elsif($shash->{helper}{prt}{sProc} != 1){ # no wakeup signal,
|
||||||
# this is an autonom message send ACK but dont process further
|
# this is an autonom message send ACK but dont process further
|
||||||
$shash->{helper}{prt}{sleeping} = 1 if(hex($mFlg) & 0x20) ;
|
$shash->{helper}{prt}{sleeping} = 1 if($mFlgH & 0x20) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
elsif($rxt & 0x10){ # lazy config
|
||||||
|
if($mFlgH & 0x02 #wakeup device
|
||||||
|
&& $defs{$shash->{IODev}{NAME}}{TYPE} eq "HMLAN"){
|
||||||
|
CUL_HM_appFromQ($shash->{NAME},"cf");# stack cmds if waiting
|
||||||
|
$shash->{helper}{prt}{sleeping} = 0;
|
||||||
|
CUL_HM_ProcessCmdStack($shash);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$shash->{helper}{prt}{sleeping} = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
my $repeat;
|
my $repeat;
|
||||||
if ($mTp eq "02"){# Ack/Nack ###########################
|
if ($mTp eq "02"){# Ack/Nack ###########################
|
||||||
|
|
||||||
@ -3245,7 +3260,7 @@ sub CUL_HM_Set($@) {
|
|||||||
|
|
||||||
$hash->{helper}{vd}{idh} = hex(substr($dst,2,2))*20077;
|
$hash->{helper}{vd}{idh} = hex(substr($dst,2,2))*20077;
|
||||||
$hash->{helper}{vd}{idl} = hex(substr($dst,4,2))*256;
|
$hash->{helper}{vd}{idl} = hex(substr($dst,4,2))*256;
|
||||||
$hash->{helper}{vd}{msgCnt} = 1 if (!defined $hash->{helper}{vd}{msgCnt});
|
CUL_HM_UpdtReadSingle($hash,".msgCnt",ReadingsVal($name,".msgCnt",1),0);
|
||||||
if (!$hash->{helper}{virtTC}){
|
if (!$hash->{helper}{virtTC}){
|
||||||
$hash->{helper}{vd}{ackT} = "" if (!defined$hash->{helper}{vd}{ackT});
|
$hash->{helper}{vd}{ackT} = "" if (!defined$hash->{helper}{vd}{ackT});
|
||||||
$hash->{helper}{vd}{miss} = 0 if (!defined$hash->{helper}{vd}{miss});
|
$hash->{helper}{vd}{miss} = 0 if (!defined$hash->{helper}{vd}{miss});
|
||||||
@ -3555,7 +3570,8 @@ sub CUL_HM_valvePosUpdt(@) {#update valve position periodically to please valve
|
|||||||
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 $msgCnt = ($hash->{helper}{vd}{msgCnt} + 1)%255;
|
my $name = $hash->{NAME};
|
||||||
|
my $msgCnt = (ReadingsVal($name,".msgCnt",0) + 1)%255;
|
||||||
|
|
||||||
# int32_t result = (((_address << 8) | messageCounter) * 1103515245 + 12345) >> 16;
|
# int32_t result = (((_address << 8) | messageCounter) * 1103515245 + 12345) >> 16;
|
||||||
# 4e6d = 20077 12996205 = C64E6D
|
# 4e6d = 20077 12996205 = C64E6D
|
||||||
@ -3564,7 +3580,6 @@ sub CUL_HM_valvePosUpdt(@) {#update valve position periodically to please valve
|
|||||||
my $lo = int(($idl*0x4e6d +12345)/0x10000)&0xff;
|
my $lo = int(($idl*0x4e6d +12345)/0x10000)&0xff;
|
||||||
my $hi = ($hash->{helper}{vd}{idh}+$idl*198)&0xff;
|
my $hi = ($hash->{helper}{vd}{idh}+$idl*198)&0xff;
|
||||||
my $nextTimer = (($lo+$hi)&0xff)/4 + 120;#original - instable
|
my $nextTimer = (($lo+$hi)&0xff)/4 + 120;#original - instable
|
||||||
my $name = $hash->{NAME};
|
|
||||||
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"
|
||||||
@ -3588,8 +3603,8 @@ sub CUL_HM_valvePosUpdt(@) {#update valve position periodically to please valve
|
|||||||
|
|
||||||
my $tn = gettimeofday();
|
my $tn = gettimeofday();
|
||||||
$hash->{helper}{vd}{nextF} = ReadingsVal($name,".next",0) + $nextTimer;
|
$hash->{helper}{vd}{nextF} = ReadingsVal($name,".next",0) + $nextTimer;
|
||||||
CUL_HM_UpdtReadSingle($hash,".next",$tn+$nextTimer,1);
|
CUL_HM_UpdtReadBulk($hash,0,".next:".($tn+$nextTimer)
|
||||||
$hash->{helper}{vd}{msgCnt} = $msgCnt;
|
,".msgCnt:$msgCnt");
|
||||||
$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);
|
InternalTimer($tn+10,"CUL_HM_valvePosTmr","valveTmr:$vId",0);
|
||||||
@ -4206,7 +4221,7 @@ sub CUL_HM_respPendTout($) {
|
|||||||
CUL_HM_ProcessCmdStack($hash) if(CUL_HM_getRxType($hash) & 0x03);#burst/all
|
CUL_HM_ProcessCmdStack($hash) if(CUL_HM_getRxType($hash) & 0x03);#burst/all
|
||||||
}
|
}
|
||||||
elsif ($pHash->{rspWait}{reSent} > AttrVal($name,"msgRepeat",3)#too many
|
elsif ($pHash->{rspWait}{reSent} > AttrVal($name,"msgRepeat",3)#too many
|
||||||
||(!(CUL_HM_getRxType($hash) & 0x8B))){#config/lacyConfig cannot retry
|
||(!(CUL_HM_getRxType($hash) & 0x9B))){#config cannot retry
|
||||||
|
|
||||||
my $pendCmd = "MISSING ACK";
|
my $pendCmd = "MISSING ACK";
|
||||||
if ($pHash->{rspWait}{Pending}){
|
if ($pHash->{rspWait}{Pending}){
|
||||||
@ -4229,7 +4244,7 @@ sub CUL_HM_respPendTout($) {
|
|||||||
CUL_HM_SndCmd($hash,"++B112$addr$HMid");
|
CUL_HM_SndCmd($hash,"++B112$addr$HMid");
|
||||||
$hash->{helper}{prt}{awake}=4;# start re-wakeup
|
$hash->{helper}{prt}{awake}=4;# start re-wakeup
|
||||||
}
|
}
|
||||||
elsif(CUL_HM_getRxType($hash) & 0x08){# wakeup devices
|
elsif(CUL_HM_getRxType($hash) & 0x18){# wakeup/lazy devices
|
||||||
#need to fill back command to queue and wait for next wakeup
|
#need to fill back command to queue and wait for next wakeup
|
||||||
if ($pHash->{mmcA}){#fillback multi-message command
|
if ($pHash->{mmcA}){#fillback multi-message command
|
||||||
unshift @{$hash->{cmdStack}},$_ foreach (reverse@{$pHash->{mmcA}});
|
unshift @{$hash->{cmdStack}},$_ foreach (reverse@{$pHash->{mmcA}});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user