2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-21 07:56:03 +00:00

some bugs, change in autoReadReg handling

git-svn-id: https://svn.fhem.de/fhem/trunk@4153 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876 2013-11-05 09:27:26 +00:00
parent ebd73f06e1
commit 2aed50919d
4 changed files with 188 additions and 129 deletions

View File

@ -342,7 +342,8 @@ sub HMLAN_Write($$$) {#########################################################
substr($msg, 16, 6)); substr($msg, 16, 6));
my $ll5 = GetLogLevel($hash->{NAME},5); my $ll5 = GetLogLevel($hash->{NAME},5);
if ($mtype eq "02" && $src eq $hash->{owner} && length($msg) == 24){ if ( $mtype eq "02" && $src eq $hash->{owner} && length($msg) == 24
&& $hash->{assignIDs} =~ m/$dst/){
# Acks are generally send by HMLAN autonomously # Acks are generally send by HMLAN autonomously
# Special # Special
Log $ll5, "HMLAN: Skip ACK" if (!$debug); Log $ll5, "HMLAN: Skip ACK" if (!$debug);
@ -358,7 +359,7 @@ sub HMLAN_Write($$$) {#########################################################
if (!$lhash{$dst} && $dst ne "000000"){ if (!$lhash{$dst} && $dst ne "000000"){
HMLAN_SimpleWrite($hash, $IDadd); HMLAN_SimpleWrite($hash, $IDadd);
delete $hash->{helper}{$dst}; # delete $hash->{helper}{$dst};
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 !(CUL_HM_Get(CUL_HM_id2Hash($dst),$dN,"param","rxType") & ~0x04)){#config only

View File

@ -111,6 +111,7 @@ sub CUL_HM_storeRssi(@);
sub CUL_HM_qStateUpdatIfEnab($@); sub CUL_HM_qStateUpdatIfEnab($@);
sub CUL_HM_getAttrInt($@); sub CUL_HM_getAttrInt($@);
sub CUL_HM_putHash($); sub CUL_HM_putHash($);
sub CUL_HM_appFromQ($$);
# ----------------modul globals----------------------- # ----------------modul globals-----------------------
my $respRemoved; # used to control trigger of stack processing my $respRemoved; # used to control trigger of stack processing
@ -157,9 +158,11 @@ sub CUL_HM_Initialize($) {
$hash->{prot}{rspPend} = 0;#count Pending responses $hash->{prot}{rspPend} = 0;#count Pending responses
my @statQArr = (); my @statQArr = ();
my @statQWuArr = ();
my @confQArr = (); my @confQArr = ();
my @confQWuArr = (); my @confQWuArr = ();
$hash->{helper}{qReqStat} = \@statQArr; $hash->{helper}{qReqStat} = \@statQArr;
$hash->{helper}{qReqStatWu} = \@statQWuArr;
$hash->{helper}{qReqConf} = \@confQArr; $hash->{helper}{qReqConf} = \@confQArr;
$hash->{helper}{qReqConfWu} = \@confQWuArr; $hash->{helper}{qReqConfWu} = \@confQWuArr;
CUL_HM_initRegHash(); CUL_HM_initRegHash();
@ -333,6 +336,8 @@ sub CUL_HM_Define($$) {##############################
else{# define a device else{# define a device
$hash->{helper}{role}{dev}=1; $hash->{helper}{role}{dev}=1;
$hash->{helper}{role}{chn}=1;# take role of chn 01 until it is defined $hash->{helper}{role}{chn}=1;# take role of chn 01 until it is defined
$hash->{helper}{q}{qReqConf}=""; # queue autoConfig requests for this device
$hash->{helper}{q}{qReqStat}=""; # queue autoConfig requests for this device
CUL_HM_prtInit ($hash); CUL_HM_prtInit ($hash);
AssignIoPort($hash); AssignIoPort($hash);
} }
@ -525,13 +530,15 @@ sub CUL_HM_Parse($$) {##############################
my @event; #events to be posted for main entity my @event; #events to be posted for main entity
my @entities; #additional entities with events to be notifies my @entities; #additional entities with events to be notifies
my $name = $shash->{NAME};
return if (CUL_HM_getAttrInt($name,"ignore"));
if ($msgStat && $msgStat =~ m/AESKey/){ if ($msgStat && $msgStat =~ m/AESKey/){
push @entities,CUL_HM_UpdtReadSingle($shash,"aesKeyNbr",substr($msgStat,7),1); push @entities,CUL_HM_UpdtReadSingle($shash,"aesKeyNbr",substr($msgStat,7),1);
$msgStat = ""; # already processed $msgStat = ""; # already processed
} }
CUL_HM_eventP($shash,"Evt_$msgStat")if ($msgStat);#log io-events CUL_HM_eventP($shash,"Evt_$msgStat")if ($msgStat);#log io-events
CUL_HM_eventP($shash,"Rcv"); CUL_HM_eventP($shash,"Rcv");
my $name = $shash->{NAME};
my $dname = ($dst eq "000000") ? "broadcast" : my $dname = ($dst eq "000000") ? "broadcast" :
($dhash ? $dhash->{NAME} : ($dhash ? $dhash->{NAME} :
($dst eq $id ? $ioName : ($dst eq $id ? $ioName :
@ -545,7 +552,6 @@ sub CUL_HM_Parse($$) {##############################
$myRSSI); $myRSSI);
my $msgX = "No:$mNo - t:$mTp s:$src d:$dst ".($p?$p:""); my $msgX = "No:$mNo - t:$mTp s:$src d:$dst ".($p?$p:"");
if($shash->{lastMsg} && $shash->{lastMsg} eq $msgX) { #duplicate -lost 'ack'? if($shash->{lastMsg} && $shash->{lastMsg} eq $msgX) { #duplicate -lost 'ack'?
if( $shash->{helper}{rpt} #was responded if( $shash->{helper}{rpt} #was responded
&& $shash->{helper}{rpt}{IO} eq $ioName #from same IO && $shash->{helper}{rpt}{IO} eq $ioName #from same IO
@ -1019,7 +1025,7 @@ sub CUL_HM_Parse($$) {##############################
} }
else{ #invalid PhysLevel else{ #invalid PhysLevel
$rSUpdt = 1; $rSUpdt = 1;
CUL_HM_stateUpdatDly($shash->{NAME},3); # update to get level CUL_HM_stateUpdatDly($shash->{NAME},5); # update to get level
} }
} }
} }
@ -1028,6 +1034,7 @@ sub CUL_HM_Parse($$) {##############################
my $vs = ($val==100 ? "on":($val==0 ? "off":"$val %")); # user string... my $vs = ($val==100 ? "on":($val==0 ? "off":"$val %")); # user string...
push @event,"level:$val %"; push @event,"level:$val %";
push @event,"pct:$val"; # duplicate to level - necessary for "slider"
push @event,"deviceMsg:$vs$target" if($chn ne "00"); push @event,"deviceMsg:$vs$target" if($chn ne "00");
push @event,"state:".(($physLvl ne $val." %")?"chn:$vs phys:$physLvl": push @event,"state:".(($physLvl ne $val." %")?"chn:$vs phys:$physLvl":
$vs); $vs);
@ -1526,7 +1533,7 @@ sub CUL_HM_parseCommon(@){#####################################################
if( ((hex($mFlg) & 0xA2) == 0x82) && if( ((hex($mFlg) & 0xA2) == 0x82) &&
(CUL_HM_getRxType($shash) & 0x08)){ #wakeup and process stack (CUL_HM_getRxType($shash) & 0x08)){ #wakeup and process stack
CUL_HM_qPend($shash->{NAME});# 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);
CUL_HM_ProcessCmdStack($shash); CUL_HM_ProcessCmdStack($shash);
@ -1645,8 +1652,9 @@ sub CUL_HM_parseCommon(@){#####################################################
CUL_HM_ProcessCmdStack($shash); # start processing immediately CUL_HM_ProcessCmdStack($shash); # start processing immediately
} }
elsif(CUL_HM_getRxType($shash) & 0x04){# nothing to pair - maybe send config elsif(CUL_HM_getRxType($shash) & 0x04){# nothing to pair - maybe send config
CUL_HM_qPend($shash->{NAME}); # stack cmds if waiting CUL_HM_appFromQ($shash->{NAME},"cf"); # stack cmds if waiting
CUL_HM_ProcessCmdStack($shash) ;#config if (hex($mFlg)&0x20){CUL_HM_SndCmd($shash,$mNo."8002".$id.$src."00");}
else{ CUL_HM_ProcessCmdStack($shash);} ;#config
} }
$ret = "done"; $ret = "done";
} }
@ -1809,7 +1817,10 @@ sub CUL_HM_parseCommon(@){#####################################################
} }
elsif($mTp =~ m /^4[01]/){ #someone is triggered########## elsif($mTp =~ m /^4[01]/){ #someone is triggered##########
CUL_HM_qStateUpdatIfEnab($dst)if (hex($mFlg) & 0x20 && $dhash); CUL_HM_qStateUpdatIfEnab($dst)if (hex($mFlg) & 0x20 && $dhash);
my $cName = CUL_HM_id2Hash($src.sprintf("%02X",hex(substr($p,0,2))& 0x3f)); my $chn = hex(substr($p,0,2));
my $long = ($chn & 0x40)?"long":"short";
$chn = $chn & 0x3f;
my $cName = CUL_HM_id2Hash($src.sprintf("%02X",$chn));
$cName = $cName->{NAME}; $cName = $cName->{NAME};
my $level = "-"; my $level = "-";
@ -1819,6 +1830,9 @@ sub CUL_HM_parseCommon(@){#####################################################
elsif ($lvlStr{st}{$st} && $lvlStr{st}{$st}{$l}){$level = $lvlStr{st}{$st}{$l}} elsif ($lvlStr{st}{$st} && $lvlStr{st}{$st}{$l}){$level = $lvlStr{st}{$st}{$l}}
else {$level = hex($l)}; else {$level = hex($l)};
} }
elsif($mTp eq "40"){
$level = $long;
}
my @peers = split(",",AttrVal($cName,"peerIDs","")); my @peers = split(",",AttrVal($cName,"peerIDs",""));
my @entities; my @entities;
@ -2263,9 +2277,8 @@ sub CUL_HM_Set($@) {
@{$modules{CUL_HM}{$hash->{IODev}{NAME}}{pendDev}} = @{$modules{CUL_HM}{$hash->{IODev}{NAME}}{pendDev}} =
grep !/$name/,@{$modules{CUL_HM}{$hash->{IODev}{NAME}}{pendDev}}; grep !/$name/,@{$modules{CUL_HM}{$hash->{IODev}{NAME}}{pendDev}};
} }
@{$modules{CUL_HM}{helper}{qReqConf}} = CUL_HM_unQEntity($name,"qReqConf");
grep !/$name/,@{$modules{CUL_HM}{helper}{qReqConf}} CUL_HM_unQEntity($name,"qReqStat");
if ($modules{CUL_HM}{helper}{qReqConf});
CUL_HM_protState($hash,"Info_Cleared"); CUL_HM_protState($hash,"Info_Cleared");
} }
elsif($sect eq "rssi"){ elsif($sect eq "rssi"){
@ -2304,7 +2317,6 @@ sub CUL_HM_Set($@) {
$state = ""; $state = "";
} }
elsif($cmd eq "getConfig") { ################################################ elsif($cmd eq "getConfig") { ################################################
CUL_HM_unQEntity($name,"qReqConfWu");
CUL_HM_unQEntity($name,"qReqConf"); CUL_HM_unQEntity($name,"qReqConf");
CUL_HM_getConfig($hash); CUL_HM_getConfig($hash);
$state = ""; $state = "";
@ -3133,6 +3145,7 @@ sub CUL_HM_Set($@) {
my $rxType = CUL_HM_getRxType($devHash); my $rxType = CUL_HM_getRxType($devHash);
Log GetLogLevel($name,2), "CUL_HM set $name $act"; Log GetLogLevel($name,2), "CUL_HM set $name $act";
Log 1,"General send $name rxt:$rxType p:".$devHash->{helper}{prt}{sProc};
if($rxType & 0x03){#all/burst if($rxType & 0x03){#all/burst
CUL_HM_ProcessCmdStack($devHash); CUL_HM_ProcessCmdStack($devHash);
} }
@ -3905,13 +3918,13 @@ sub CUL_HM_name2Hash($) {#in: name, out:hash
sub CUL_HM_name2Id(@) { #in: name or HMid ==>out: HMid, "" if no match sub CUL_HM_name2Id(@) { #in: name or HMid ==>out: HMid, "" if no match
my ($name,$idHash) = @_; my ($name,$idHash) = @_;
my $hash = $defs{$name}; my $hash = $defs{$name};
return $hash->{DEF} if($hash); #name is entity return $hash->{DEF} if($hash && $hash->{TYPE} eq "CUL_HM");#name is entity
return "000000" if($name eq "broadcast"); #broadcast return "000000" if($name eq "broadcast"); #broadcast
return $defs{$1}->{DEF}.$2 if($name =~ m/(.*)_chn:(..)/); #<devname> chn:xx return $defs{$1}->{DEF}.$2 if($name =~ m/(.*)_chn:(..)/); #<devname> chn:xx
return $name if($name =~ m/^[A-F0-9]{6,8}$/i);#was already HMid return $name if($name =~ m/^[A-F0-9]{6,8}$/i);#was already HMid
return substr($idHash->{DEF},0,6).sprintf("%02X",$1) return substr($idHash->{DEF},0,6).sprintf("%02X",$1)
if($idHash && ($name =~ m/self(.*)/)); if($idHash && ($name =~ m/self(.*)/));
return ""; return AttrVal($name,"hmId",""); # could be IO device
} }
sub CUL_HM_id2Name($) { #in: name or HMid out: name sub CUL_HM_id2Name($) { #in: name or HMid out: name
my ($p) = @_; my ($p) = @_;
@ -4783,115 +4796,159 @@ sub CUL_HM_qStateUpdatIfEnab($@){#in:name or id, queue stat-request after 12 s
return if (!$defs{$name}); #device unknown, ignore return if (!$defs{$name}); #device unknown, ignore
if ($force || ((CUL_HM_getAttrInt($name,"autoReadReg") & 0x0f) > 3)){ if ($force || ((CUL_HM_getAttrInt($name,"autoReadReg") & 0x0f) > 3)){
CUL_HM_qEntity($name,"qReqStat") ; CUL_HM_qEntity($name,"qReqStat") ;
RemoveInternalTimer("CUL_HM_procQs");
InternalTimer(gettimeofday()+ .5,"CUL_HM_procQs","CUL_HM_procQs", 0);
} }
} }
sub CUL_HM_qAutoRead($$){ sub CUL_HM_qAutoRead($$){
my ($name,$lvl) = @_; my ($name,$lvl) = @_;
return if (!$defs{$name} return if (!$defs{$name}
||$lvl >= (0x07 & CUL_HM_getAttrInt($name,"autoReadReg"))); ||$lvl >= (0x07 & CUL_HM_getAttrInt($name,"autoReadReg")));
CUL_HM_qEntity($name,(CUL_HM_getRxType($defs{$name}) & 0x1C)?"qReqConfWu" CUL_HM_qEntity($name,"qReqConf");
:"qReqConf");
RemoveInternalTimer("CUL_HM_procQs");
InternalTimer(gettimeofday()+ .5,"CUL_HM_procQs","CUL_HM_procQs", 0);
} }
sub CUL_HM_unQEntity($$){# remove entity from q - task no longer necesary sub CUL_HM_unQEntity($$){# remove entity from q
my ($name,$q) = @_; my ($name,$q) = @_;
$q = $modules{CUL_HM}{helper}{$q};
return if (AttrVal($name,"subType","") eq "virtual"); my $devN = CUL_HM_getDeviceName($name);
if ($defs{$name}{helper}{role}{dev}){ return if (AttrVal($devN,"subType","") eq "virtual");
foreach (grep /channel_/,keys %{$defs{$name}}){# remove potential chn my $dq = $defs{$devN}{helper}{q};
my $ch = $defs{$name}{$_}; return if ($dq->{$q} eq "");
@{$q} = grep !/^$ch$/,@{$q};
if ($devN eq $name){#all channels included
$dq->{$q}="";
} }
else{
my @chns = split(",",$dq->{$q});
my $chn = substr(CUL_HM_name2Id($name),6,2);
@chns = grep !/$chn/,@chns;
$dq->{$q} = join",",@chns;
} }
@{$q} = grep !/^$name$/,@{$q}; my $mQ = $q."Wu" if (CUL_HM_getRxType($defs{$name}) & 0x1C);
$mQ = $modules{CUL_HM}{helper}{$q};
@{$mQ} = grep !/^$devN$/,@{$mQ} if ($dq->{$q} eq "");
RemoveInternalTimer("sUpdt:$name") if ($q eq "qReqStat");#remove delayed
} }
sub CUL_HM_qEntity($$){ sub CUL_HM_qEntity($$){ # add to queue
my ($name,$q) = @_; my ($name,$q) = @_;
return if ($modules{CUL_HM}{helper}{hmManualOper});#no autoaction when manual return if ($modules{CUL_HM}{helper}{hmManualOper});#no autoaction when manual
my $devN = CUL_HM_getDeviceName($name);
return if (AttrVal($devN,"subType","") eq "virtual");
return if ($defs{$devN}{helper}{q}{$q} eq "00"); #already requesting all
if ($devN eq $name){#config for all device
$defs{$devN}{helper}{q}{$q}="00";
}
else{
$defs{$devN}{helper}{q}{$q} = CUL_HM_noDupInString(
$defs{$devN}{helper}{q}{$q}
.",".substr(CUL_HM_name2Id($name),6,2));
}
$q .= "Wu" if (CUL_HM_getRxType($defs{$name}) & 0x1C);#normal or wakeup q?
$q = $modules{CUL_HM}{helper}{$q}; $q = $modules{CUL_HM}{helper}{$q};
return if (AttrVal($name,"subType","") eq "virtual"); @{$q} = CUL_HM_noDup(@{$q},$devN);
if ($defs{$name}{helper}{role}{dev}){
foreach (grep /channel_/,keys %{$defs{$name}}){# remove potential chn my $wT = (@{$modules{CUL_HM}{helper}{qReqStat}})?
my $ch = $defs{$name}{$_}; "1":
@{$q} = grep !/^$ch$/,@{$q}; $modules{CUL_HM}{hmAutoReadScan};
RemoveInternalTimer("CUL_HM_procQs");
InternalTimer(gettimeofday()+ $wT,"CUL_HM_procQs","CUL_HM_procQs", 0);
} }
@{$q} = CUL_HM_noDup(@{$q},$name);
sub CUL_HM_procQs($){#process non-wakeup queues
# --- verify send is possible
my $mq = $modules{CUL_HM}{helper};
foreach my $q ("qReqStat","qReqConf"){
if (@{$mq->{$q}}){
my $devN = ${$mq->{$q}}[0];
my $ioName = $defs{$devN}{IODev}{NAME};
if ( ( ReadingsVal($ioName,"cond","") =~ m /^(ok|Overload-released|init)$/
&& $q eq "qReqStat")
||( CUL_HM_autoReadReady($ioName)
&& $q eq "qReqConf")){
my $dq = $defs{$devN}{helper}{q};
my @chns = split(",",$dq->{$q});
if (@chns > 1){$dq->{$q} = join ",",@chns[1..@chns];}
else{ $dq->{$q} = "";
@{$mq->{$q}} = grep !/^$devN$/,@{$mq->{$q}};
} }
elsif (!grep /^$defs{$name}{device}$/,@{$q}){# chn - only if device not in my $dId = CUL_HM_name2Id($devN);
@{$q} = CUL_HM_noDup(@{$q},$name); my $eN=($chns[0]ne "00")?CUL_HM_id2Name($dId.$chns[0]):$devN;
if ($q eq "qReqConf"){
$mq->{autoRdActive} = $devN;
CUL_HM_Set($defs{$eN},$eN,"getConfig");
}
else{
CUL_HM_Set($defs{$eN},$eN,"statusRequest");
}
}
last; # execute only one!
} }
} }
sub CUL_HM_procQs($){ delete $mq->{autoRdActive}
# --- verify send is possible if ($mq->{autoRdActive} &&
my $next; $defs{$mq->{autoRdActive}}{helper}{prt}{sProc} != 1);
if (defined $modules{CUL_HM}{helper}{qReqStat} my $next;# how long to wait for next timer
&& @{$modules{CUL_HM}{helper}{qReqStat}}){ if (@{$mq->{qReqStat}}){$next = 1}
while(@{$modules{CUL_HM}{helper}{qReqStat}}){ elsif (@{$mq->{qReqConf}}){$next = $modules{CUL_HM}{hmAutoReadScan}}
$next = .5;
my $tName = CUL_HM_getDeviceName(${$modules{CUL_HM}{helper}{qReqStat}}[0]);
my $ioName = $defs{$tName}{IODev}{NAME};
last if (ReadingsVal($ioName,"cond","") !~ m /^(ok|Overload-released|init)$/);
my $name = shift(@{$modules{CUL_HM}{helper}{qReqStat}});
last if (CUL_HM_Set($defs{$name},$name,"statusRequest") eq "1"); #skip?
}
}
elsif(defined $modules{CUL_HM}{helper}{qReqConf}
&& @{$modules{CUL_HM}{helper}{qReqConf}}){
$next = $modules{CUL_HM}{hmAutoReadScan};
CUL_HM_autoReadConfig();
}
else{
delete $modules{CUL_HM}{helper}{autoRdActive};
}
InternalTimer(gettimeofday()+$next,"CUL_HM_procQs","CUL_HM_procQs",0) InternalTimer(gettimeofday()+$next,"CUL_HM_procQs","CUL_HM_procQs",0)
if ($next); if ($next);
} }
sub CUL_HM_autoReadConfig(){ sub CUL_HM_appFromQ($$){#stack commands if pend in WuQ
return if (!CUL_HM_autoReadReady($modules{CUL_HM}{helper}{qReqConf})); my ($name,$reason) = @_;
my $devN = CUL_HM_getDeviceName($name);
my $name = shift(@{$modules{CUL_HM}{helper}{qReqConf}}); my $dId = CUL_HM_name2Id($devN);
my $hash = $defs{$name}; my $dq = $defs{$devN}{helper}{q};
if ($reason eq "cf"){# reason is config. add all since User has control
CUL_HM_Set($hash,$name,"getConfig"); foreach my $q ("qReqStat","qReqConf"){
my $mId = CUL_HM_getMId($hash); if ($dq->{$q} ne ""){# need update
$modules{CUL_HM}{helper}{autoRdActive} = $name; my @eName;
} if ($dq->{$q} eq "00"){
sub CUL_HM_qPend($){ push @eName,$devN;
my $name = shift;
my $q = $modules{CUL_HM}{helper}{qReqConfWu};
return if (!CUL_HM_autoReadReady($q));
my $eName = "";
if (grep /^$name$/,@{$q}){
$eName = $name
} }
else{ else{
foreach (grep /channel_/,keys %{$defs{$name}}){ my @chns = split(",",$dq->{$q});
my $ch = $defs{$name}{$_}; push @eName,CUL_HM_id2Name($dId.$_)foreach (@chns);
if (grep /^$ch$/,@{$q}){ }
$eName = $ch; $dq->{$q} = "";
@{$modules{CUL_HM}{helper}{$q."Wu"}} =
grep !/^$devN$/,@{$modules{CUL_HM}{helper}{$q."Wu"}};
foreach my $eN(@eName){
next if (!$eN);
CUL_HM_Set($defs{$eN},$eN,"getConfig") if ($q eq "qReqConf");
CUL_HM_Set($defs{$eN},$eN,"statusRequest") if ($q eq "qReqStat");
} }
} }
} }
if ($eName){ }
@{$q} = grep !/^$eName$/,@{$q}; elsif($reason eq "wu"){#wakeup - just add one step
CUL_HM_Set($defs{$eName},$eName,"getConfig"); my $ioName = $defs{$devN}{IODev}{NAME};
return if (!CUL_HM_autoReadReady($ioName));# no sufficient performance
foreach my $q ("qReqStat","qReqConf"){
if ($dq->{$q} ne ""){# need update
my @chns = split(",",$dq->{$q});
my $nOpen = scalar @chns;
if ($nOpen > 1){$dq->{$q} = join ",",@chns[1..$nOpen];}
else{ $dq->{$q} = "";
@{$modules{CUL_HM}{helper}{$q."Wu"}} =
grep !/^$devN$/,@{$modules{CUL_HM}{helper}{$q."Wu"}};
}
my $eN=($chns[0]ne "00")?CUL_HM_id2Name($dId.$chns[0]):$devN;
CUL_HM_Set($defs{$eN},$eN,"getConfig") if ($q eq "qReqConf");
CUL_HM_Set($defs{$eN},$eN,"statusRequest") if ($q eq "qReqStat");
return;# Only one per step - very defensive.
} }
} }
sub CUL_HM_autoReadReady($){# capacity for autoread? }
my $q = shift; }
return if (!@{$q}); sub CUL_HM_autoReadReady($){# capacity for autoread available?
my $ioName = shift;
my $mHlp = $modules{CUL_HM}{helper}; my $mHlp = $modules{CUL_HM}{helper};
if ( $mHlp->{autoRdActive} # predecisor available if ( $mHlp->{autoRdActive} # predecessor available
&& $defs{$mHlp->{autoRdActive}}){ && $defs{$mHlp->{autoRdActive}}){
my $dName = CUL_HM_getDeviceName($mHlp->{autoRdActive}); return 0 if ($defs{$mHlp->{autoRdActive}}{helper}{prt}{sProc} == 1); # predecessor still on
return 0 if ($defs{$dName}{helper}{prt}{sProc} == 1); # predecisor still on
} }
my $tName = CUL_HM_getDeviceName(${$q}[0]);
my $ioName = $defs{$tName}{IODev}{NAME};
if ( ReadingsVal($ioName,"cond","") !~ m /^(ok|Overload-released|init)$/ if ( ReadingsVal($ioName,"cond","") !~ m /^(ok|Overload-released|init)$/
|| ( $defs{$ioName}{helper}{q} || ( $defs{$ioName}{helper}{q}
&& ($defs{$ioName}{helper}{q}{cap}{sum}/16.8)> && ($defs{$ioName}{helper}{q}{cap}{sum}/16.8)>
@ -4929,6 +4986,7 @@ sub CUL_HM_peerUsed($) {# are peers expected?
my $mId = CUL_HM_getMId($hash); my $mId = CUL_HM_getMId($hash);
my $cNo = hex(substr($hash->{DEF}."01",6,2))."p"; #default to channel 01 my $cNo = hex(substr($hash->{DEF}."01",6,2))."p"; #default to channel 01
return 0 if (!$mId || !$culHmModel{$mId});
foreach my $ls (split ",",$culHmModel{$mId}{lst}){ foreach my $ls (split ",",$culHmModel{$mId}{lst}){
my ($l,$c) = split":",$ls; my ($l,$c) = split":",$ls;
if ( ($l =~ m/^(p|3|4)$/ && !$c ) # 3,4,p without chanspec if ( ($l =~ m/^(p|3|4)$/ && !$c ) # 3,4,p without chanspec
@ -4958,9 +5016,13 @@ sub CUL_HM_reglUsed($) {# provide data for HMinfo
foreach (grep !/00000000/,split(",",AttrVal($name,"peerIDs",""))); foreach (grep !/00000000/,split(",",AttrVal($name,"peerIDs","")));
my @lsNo; my @lsNo;
push @lsNo,"0:" if ($hash->{helper}{role}{dev});
if ($hash->{helper}{role}{chn}){
my $mId = CUL_HM_getMId($hash); my $mId = CUL_HM_getMId($hash);
return undef if (!$mId || !$culHmModel{$mId});
if ($hash->{helper}{role}{dev}){
push @lsNo,"0:";
}
elsif ($hash->{helper}{role}{chn}){
foreach my $ls (split ",",$culHmModel{$mId}{lst}){ foreach my $ls (split ",",$culHmModel{$mId}{lst}){
my ($l,$c) = split":",$ls; my ($l,$c) = split":",$ls;
if ($l ne "p"){# ignore peer-only entries if ($l ne "p"){# ignore peer-only entries
@ -6078,14 +6140,14 @@ sub CUL_HM_reglUsed($) {# provide data for HMinfo
test:from $src<br> test:from $src<br>
</li> </li>
<li><B>threeStateSensor</B><br> <li><B>threeStateSensor</B><br>
[open|tilted|closed]]<br> [open|tilted|closed]<br>
[wet|damp|dry] #HM-SEC-WDS only<br> [wet|damp|dry] #HM-SEC-WDS only<br>
cover [open|closed] #HM-SEC-WDS only<br> cover [open|closed] #HM-SEC-WDS and HM-Sec-RHS<br>
alive yes<br> alive yes<br>
battery [low|ok]<br> battery [low|ok]<br>
contact [open|tilted|closed]<br> contact [open|tilted|closed]<br>
contact [wet|damp|dry] #HM-SEC-WDS only<br> contact [wet|damp|dry] #HM-SEC-WDS only<br>
sabotageError [on|off] #HM-SEC-SC and HM-Sec-RHS only<br> sabotageError [on|off] #HM-SEC-SC only<br>
</li> </li>
<li><B>winMatic</B><br> <li><B>winMatic</B><br>
[locked|$value]<br> [locked|$value]<br>

View File

@ -336,17 +336,13 @@ sub HMinfo_SetFn($@) {#########################################################
$ret = $cmd." done:" ."\n ".$hdr ."\n ".(join "\n ",sort @paramList) $ret = $cmd." done:" ."\n ".$hdr ."\n ".(join "\n ",sort @paramList)
; ;
$ret .= "\n\n CUL_HM queue:$modules{CUL_HM}{prot}{rspPend}"; $ret .= "\n\n CUL_HM queue:$modules{CUL_HM}{prot}{rspPend}";
$ret .= "\n autoRegRead pending:" $ret .= "\n";
.join(",",@{$modules{CUL_HM}{helper}{qReqConf}}) $ret .= "\n autoReadReg pending:" .join(",",@{$modules{CUL_HM}{helper}{qReqConf}})
.($modules{CUL_HM}{helper}{autoRdActive}?" recent:".$modules{CUL_HM}{helper}{autoRdActive}:"") .($modules{CUL_HM}{helper}{autoRdActive}?" recent:".$modules{CUL_HM}{helper}{autoRdActive}:" recent:none");
if ($modules{CUL_HM}{helper}{qReqConf}); $ret .= "\n status request pending:" .join(",",@{$modules{CUL_HM}{helper}{qReqStat}}) ;
$ret .= "\n autoRegRead wakeup pending:" $ret .= "\n autoReadReg wakeup pending:" .join(",",@{$modules{CUL_HM}{helper}{qReqConfWu}});
.join(",",@{$modules{CUL_HM}{helper}{qReqConfWu}}) $ret .= "\n status request wakeup pending:".join(",",@{$modules{CUL_HM}{helper}{qReqStatWu}});
.($modules{CUL_HM}{helper}{autoRdActive}?" recent:".$modules{CUL_HM}{helper}{autoRdActive}:"") $ret .= "\n";
if ($modules{CUL_HM}{helper}{qReqConfWu});
$ret .= "\n status request pending:".
join(",",@{$modules{CUL_HM}{helper}{qReqStat}})
if ($modules{CUL_HM}{helper}{qReqStat});
@IOlist = HMinfo_noDup(@IOlist); @IOlist = HMinfo_noDup(@IOlist);
foreach(@IOlist){ foreach(@IOlist){
$_ .= ":".$defs{$_}{STATE} $_ .= ":".$defs{$_}{STATE}

View File

@ -609,8 +609,8 @@ my %culHmRegDefine = (
heatCool =>{a=> 15.7,s=>0.1,l=>7,min=>0 ,max=>1 ,c=>'lit' ,f=>'' ,u=>'' ,d=>1,t=>"select heating or cooling" ,lit=>{heating=>0,cooling=>1}}, heatCool =>{a=> 15.7,s=>0.1,l=>7,min=>0 ,max=>1 ,c=>'lit' ,f=>'' ,u=>'' ,d=>1,t=>"select heating or cooling" ,lit=>{heating=>0,cooling=>1}},
weekPrgSel =>{a=> 16.0,s=>1.0,l=>7,min=>0 ,max=>2 ,c=>'lit' ,f=>'' ,u=>'' ,d=>1,t=>"select week program" ,lit=>{prog1=>0,prog2=>1,prog1=>2}}, weekPrgSel =>{a=> 16.0,s=>1.0,l=>7,min=>0 ,max=>2 ,c=>'lit' ,f=>'' ,u=>'' ,d=>1,t=>"select week program" ,lit=>{prog1=>0,prog2=>1,prog1=>2}},
modePrioParty =>{a=> 18.0,s=>0.3,l=>7,min=>0 ,max=>5 ,c=>'lit' ,f=>'' ,u=>'' ,d=>1,t=>"allow tempChange for party by..." ,lit=>{RT_SC=>0,all=>1,RT_CCU=>3,CCU=>4,self=>5}}, modePrioParty =>{a=> 18.0,s=>0.3,l=>7,min=>0 ,max=>5 ,c=>'lit' ,f=>'' ,u=>'' ,d=>1,t=>"allow tempChange for party only by..." ,lit=>{RT_TC_SC_SELF=>0,all=>1,RT_TC_CCU_SELF=>3,CCU=>4,self=>5}},
modePrioManu =>{a=> 18.3,s=>0.3,l=>7,min=>0 ,max=>5 ,c=>'lit' ,f=>'' ,u=>'' ,d=>1,t=>"allow tempChange for manual by..." ,lit=>{RT_SC=>0,all=>1,RT_CCU=>3,CCU=>4,self=>5}}, modePrioManu =>{a=> 18.3,s=>0.3,l=>7,min=>0 ,max=>5 ,c=>'lit' ,f=>'' ,u=>'' ,d=>1,t=>"allow tempChange for manual only by..." ,lit=>{RT_TC_SC_SELF=>0,all=>1,RT_TC_CCU_SELF=>3,CCU=>4,self=>5}},
winOpnMode =>{a=> 19.5,s=>0.3,l=>7,min=>0 ,max=>4 ,c=>'lit' ,f=>'' ,u=>'' ,d=>1,t=>"enable internal Windoe open in modes: " ,lit=>{off=>0,auto=>1,auto_manu=>2,auto_party=>3,on=>4}}, winOpnMode =>{a=> 19.5,s=>0.3,l=>7,min=>0 ,max=>4 ,c=>'lit' ,f=>'' ,u=>'' ,d=>1,t=>"enable internal Windoe open in modes: " ,lit=>{off=>0,auto=>1,auto_manu=>2,auto_party=>3,on=>4}},
winOpnDetFall =>{a=> 19.0,s=>0.5,l=>7,min=>0.5,max=>2.5 ,c=>'' ,f=>'10' ,u=>'K' ,d=>1,t=>"detect Window Open if temp falls more then..."}, winOpnDetFall =>{a=> 19.0,s=>0.5,l=>7,min=>0.5,max=>2.5 ,c=>'' ,f=>'10' ,u=>'K' ,d=>1,t=>"detect Window Open if temp falls more then..."},
@ -1016,7 +1016,7 @@ my %culHmSubTypeDevSets = (# device of this subtype
threeStateSensor =>{ statusRequest =>""}, threeStateSensor =>{ statusRequest =>""},
# THSensor =>{ statusRequest =>""}, at least OT/OT2 do not support this # THSensor =>{ statusRequest =>""}, at least OT/OT2 do not support this
# virtual =>{ }, # virtual =>{ },
smokeDetector =>{ statusRequest => ""}, # smokeDetector =>{ statusRequest => ""},
winMatic =>{ statusRequest => ""}, winMatic =>{ statusRequest => ""},
keyMatic =>{ statusRequest => ""}, keyMatic =>{ statusRequest => ""},
repeater =>{ statusRequest => "", repeater =>{ statusRequest => "",