2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-01 19:30:31 +00:00

HMlan remove testAttr, HMconfigadd FS and WDS40 register, HMinfo correct templateCheck

git-svn-id: https://svn.fhem.de/fhem/trunk@3483 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876 2013-07-23 10:19:10 +00:00
parent afb1149085
commit 1a9c20195f
4 changed files with 77 additions and 65 deletions

View File

@ -64,7 +64,6 @@ sub HMLAN_Initialize($) {
"respTime wdStrokeTime:5,10,15,20,25 " . "respTime wdStrokeTime:5,10,15,20,25 " .
"hmProtocolEvents:0_off,1_dump,2_dumpFull,3_dumpTrigger ". "hmProtocolEvents:0_off,1_dump,2_dumpFull,3_dumpTrigger ".
"wdTimer ". "wdTimer ".
"hmOvTo ".#General remove
$readingFnAttributes; $readingFnAttributes;
} }
sub HMLAN_Define($$) {######################################################### sub HMLAN_Define($$) {#########################################################
@ -576,10 +575,9 @@ sub HMLAN_condUpdate($$) {#####################################################
my $name = $hash->{NAME}; my $name = $hash->{NAME};
$hash->{helper}{cnd}{$HMcnd} = 0 if (!$hash->{helper}{cnd}{$HMcnd}); $hash->{helper}{cnd}{$HMcnd} = 0 if (!$hash->{helper}{cnd}{$HMcnd});
$hash->{helper}{cnd}{$HMcnd}++; $hash->{helper}{cnd}{$HMcnd}++;
if ($HMcnd == 4){ InternalTimer(gettimeofday()+$HMOvLdRcvr,"HMLAN_relOvrLd","Overload:".$name,1)
InternalTimer(gettimeofday()+AttrVal($name,"hmOvTo",$HMOvLdRcvr),#General remove Attr, testing only if ($HMcnd == 4);
"HMLAN_relOvrLd","Overload:".$name,1);
}
my $HMcndTxt = $HMcond{$HMcnd}?$HMcond{$HMcnd}:"Unknown:$HMcnd"; my $HMcndTxt = $HMcond{$HMcnd}?$HMcond{$HMcnd}:"Unknown:$HMcnd";
Log GetLogLevel($name,2), "HMLAN_Parse: $name new condition $HMcndTxt"; Log GetLogLevel($name,2), "HMLAN_Parse: $name new condition $HMcndTxt";
readingsSingleUpdate($hash,"cond",$HMcndTxt,1); readingsSingleUpdate($hash,"cond",$HMcndTxt,1);

View File

@ -424,6 +424,14 @@ sub CUL_HM_Attr(@) {#################################
} }
#+++++++++++++++++ msg receive, parsing++++++++++++++++++++++++++++++++++++++++ #+++++++++++++++++ msg receive, parsing++++++++++++++++++++++++++++++++++++++++
# translate level to readable
my %lvlStr = ( md =>{ "HM-SEC-WDS" =>{"00"=>"dry" ,"64"=>"damp" ,"C8"=>"wet" }
,"HM-CC-SCD" =>{"00"=>"normal" ,"64"=>"added" ,"C8"=>"addedStrong"}
}
,st =>{ "smokeDetector" =>{"01"=>"no alarm","C7"=>"tone off","C8"=>"Smoke Alarm"}
,"threeStateSensor"=>{"00"=>"closed" ,"64"=>"tilted" ,"C8"=>"open"}
}
);
sub CUL_HM_Parse($$) {############################## sub CUL_HM_Parse($$) {##############################
my ($iohash, $msgIn) = @_; my ($iohash, $msgIn) = @_;
my $id = CUL_HM_Id($iohash); my $id = CUL_HM_Id($iohash);
@ -763,16 +771,14 @@ sub CUL_HM_Parse($$) {##############################
if (($mTp eq "02" && $p =~ m/^01/) || # handle Ack_Status if (($mTp eq "02" && $p =~ m/^01/) || # handle Ack_Status
($mTp eq "10" && $p =~ m/^06/) || #or Info_Status message here ($mTp eq "10" && $p =~ m/^06/) || #or Info_Status message here
($mTp eq "41")) { ($mTp eq "41")) {
my $level = substr($p,4,2); my $lvl = substr($p,4,2);
my %lvl=("00"=>"normal","64"=>"added","C8"=>"addedStrong");
if($model eq "HM-Sen-Wa-Od"){
$level = hex($level)/2 ;
push @event, "level:$level %";
}
$level = $lvl{$level} if($model eq "HM-CC-SCD");
push @event, "state:".$level." %";
my $err = hex(substr($p,6,2)); my $err = hex(substr($p,6,2));
if ($lvlStr{md}{$model}){$lvl = $lvlStr{md}{$model}{$lvl}}
elsif ($lvlStr{st}{$st}) {$lvl = $lvlStr{st}{$st}{$lvl} }
else {$lvl = hex($lvl)/2}
push @event, "level:$lvl %" if($model eq "HM-Sen-Wa-Od");
push @event, "state:$lvl %";
push @event, "battery:".($err&0x80?"low":"ok") if (defined $err); push @event, "battery:".($err&0x80?"low":"ok") if (defined $err);
} }
} }
@ -1181,12 +1187,11 @@ sub CUL_HM_Parse($$) {##############################
if($modules{CUL_HM}{defptr}{"$src$chn"}); if($modules{CUL_HM}{defptr}{"$src$chn"});
} }
if (defined($state)){# if state was detected post events if (defined($state)){# if state was detected post events
my %txt; my $txt;
%txt = ("C8"=>"open", "64"=>"tilted", "00"=>"closed"); if ($lvlStr{md}{$model}){$txt = $lvlStr{md}{$model}{$state}}
%txt = ("C8"=>"wet", "64"=>"damp", "00"=>"dry") elsif ($lvlStr{st}{$st}) {$txt = $lvlStr{st}{$st}{$state} }
if($model eq "HM-SEC-WDS"); else {$txt = "unknown:$state"}
my $txt = $txt{$state};
$txt = "unknown:$state" if(!$txt);
push @event, "state:$txt"; push @event, "state:$txt";
push @event, "contact:$txt$target"; push @event, "contact:$txt$target";
} }
@ -1353,15 +1358,6 @@ sub CUL_HM_Parse($$) {##############################
return $name ;#general notification to the device return $name ;#general notification to the device
} }
# translate level to readable
my %lvlStr = ( model =>{ "HM-SEC-WDS" =>{"00"=>"dry" ,"64"=>"damp" ,"C8"=>"wet" }
,"HM-Sen-Wa-Od" =>{"00"=>"normal" ,"64"=>"added" ,"C8"=>"addedStrong"}
,"HM-CC-SCD" =>{"00"=>"normal" ,"64"=>"added" ,"C8"=>"addedStrong"}
}
,subType =>{ "smokeDetector" =>{"01"=>"no alarm","C7"=>"tone off","C8"=>"Smoke Alarm"}
,"threeStateSensor"=>{"00"=>"closed" ,"64"=>"tilted" ,"C8"=>"open"}
}
);
sub CUL_HM_parseCommon(@){##################################################### sub CUL_HM_parseCommon(@){#####################################################
# parsing commands that are device independant # parsing commands that are device independant
my ($mNo,$mFlg,$mTp,$src,$dst,$p,$st,$md) = @_; my ($mNo,$mFlg,$mTp,$src,$dst,$p,$st,$md) = @_;
@ -1589,8 +1585,8 @@ sub CUL_HM_parseCommon(@){#####################################################
if (length($p)>5){ if (length($p)>5){
my $l = substr($p,4,2); my $l = substr($p,4,2);
if ($lvlStr{model}{$md} && $lvlStr{model}{$md}{$l}) {$level = $lvlStr{model}{$md}{$l}} if ($lvlStr{md}{$md} && $lvlStr{md}{$md}{$l}){$level = $lvlStr{md}{$md}{$l}}
elsif ($lvlStr{subType}{$st} && $lvlStr{subType}{$st}{$l}){$level = $lvlStr{subType}{$st}{$l}} elsif ($lvlStr{st}{$st} && $lvlStr{st}{$st}{$l}){$level = $lvlStr{st}{$st}{$l}}
else {$level = hex($l)}; else {$level = hex($l)};
} }

View File

@ -841,10 +841,12 @@ sub HMinfo_templateSet(@){#####################################################
} }
sub HMinfo_templateChk(@){##################################################### sub HMinfo_templateChk(@){#####################################################
my ($aName,$tmpl,$pSet,@p) = @_; my ($aName,$tmpl,$pSet,@p) = @_;
$pSet = "" if (!$pSet); $pSet = "" if (!$pSet || $pSet eq "none");
my ($pName,$pTyp) = split(":",$pSet); my ($pName,$pTyp) = split(":",$pSet);
return "template undefined $tmpl" if(!$tpl{$tmpl}); return "template undefined $tmpl\n" if(!$tpl{$tmpl});
return "aktor $aName unknown" if(!$defs{$aName}); return "aktor $aName unknown\n" if(!$defs{$aName});
return "give <peer>:[short|long|all] wrong:$pTyp\n" if($pTyp && $pTyp !~ m/(short|long|all)/);
my @pNames; my @pNames;
if ($pName eq "all"){ if ($pName eq "all"){
my $dId = substr(CUL_HM_name2Id($aName),0,6); my $dId = substr(CUL_HM_name2Id($aName),0,6);
@ -853,25 +855,36 @@ sub HMinfo_templateChk(@){#####################################################
push @pNames,CUL_HM_peerChName($_,$dId,"").":short" if (!$pTyp || $pTyp ne "long"); push @pNames,CUL_HM_peerChName($_,$dId,"").":short" if (!$pTyp || $pTyp ne "long");
} }
} }
elsif(($pName && !$pTyp) || $pTyp eq "all"){
push @pNames,$pName.":long";
push @pNames,$pName.":short";
}
else{ else{
push @pNames,$pSet; push @pNames,$pSet;
} }
my $repl = ""; my $repl = "";
foreach my $pS (@pNames){ foreach my $pS (@pNames){
($pName,$pTyp) = split(":",$pS); ($pName,$pTyp) = split(":",$pS);
return "give <peer>:[short|long] with peer, not $pS" if($pName && $pTyp !~ m/(short|long)/);
my $pRnm = $pName?($pName."-".($pS eq "long"?"lg":"sh")):"";
my $replPeer=""; my $replPeer="";
if($pName && (grep !/$pName/,ReadingsVal($aName,"peerList" ,undef))){
$replPeer=" no peer:$pName\n";
}
else{
my $pRnm = $pName?($pName."-".($pS eq "long"?"lg":"sh")):"";
foreach my $rn (keys%{$tpl{$tmpl}{reg}}){ foreach my $rn (keys%{$tpl{$tmpl}{reg}}){
my $regV = ReadingsVal($aName,"R-$pRnm$rn" ,undef); my $regV = ReadingsVal($aName,"R-$pRnm$rn" ,undef);
$regV = ReadingsVal($aName,".R-$pRnm$rn",undef) if (!defined $regV);
$regV = ReadingsVal($aName,"R-".$rn ,undef) if (!defined $regV); $regV = ReadingsVal($aName,"R-".$rn ,undef) if (!defined $regV);
$regV = ReadingsVal($aName,".R-".$rn ,undef) if (!defined $regV);
if (defined $regV){ if (defined $regV){
$regV =~s/ .*//;#strip unit $regV =~s/ .*//;#strip unit
my $tplV = $tpl{$tmpl}{reg}{$rn}; my $tplV = $tpl{$tmpl}{reg}{$rn};
if ($tplV =~m /^p(.)$/) {#replace with User parameter if ($tplV =~m /^p(.)$/) {#replace with User parameter
return "insufficient values - at least ".$tpl{p}." are $1 necessary" if (@p < ($1+1)); return "insufficient data - at least ".$tpl{p}." are $1 necessary"
if (@p < ($1+1));
$tplV = $p[$1]; $tplV = $p[$1];
} }
$replPeer .= " $rn :$regV should $tplV \n" if ($regV ne $tplV); $replPeer .= " $rn :$regV should $tplV \n" if ($regV ne $tplV);
@ -880,7 +893,8 @@ sub HMinfo_templateChk(@){#####################################################
$replPeer .= " reg not found: $rn\n"; $replPeer .= " reg not found: $rn\n";
} }
} }
$repl .= "$aName $pS:".($replPeer?"\n$replPeer":"match\n"); }
$repl .= "$aName $pS-> ".($replPeer?"failed\n$replPeer":"match\n");
} }
return ($repl?$repl:"template $tmpl match actor:$aName peer:$pSet"); return ($repl?$repl:"template $tmpl match actor:$aName peer:$pSet");
} }
@ -1117,16 +1131,18 @@ sub HMinfo_cpRegs(@){#########################################################
<li><a name="#HMinfotemplateChk">templateChk <a href="HMinfoFilter">[filter]</a> &lt;template&gt; &lt;peer:[long|short]&gt; [&lt;param1&gt; ...]</a><br> <li><a name="#HMinfotemplateChk">templateChk <a href="HMinfoFilter">[filter]</a> &lt;template&gt; &lt;peer:[long|short]&gt; [&lt;param1&gt; ...]</a><br>
verifies if the register-readings comply to the template <br> verifies if the register-readings comply to the template <br>
Parameter are identical to <a href="#HMinfotemplateSet">templateSet</a><br> Parameter are identical to <a href="#HMinfotemplateSet">templateSet</a><br>
The procedure will check if the register values match the ones provided by the template The procedure will check if the register values match the ones provided by the template<br>
If no peer is necessary use <B>none</B> to skip this entry<br>
Examples <br> Examples <br>
<code> <code>
set hm templateChk -f RolloNord BlStopUpLg none 1 2 # verify RolloNord, no peer, parameter 1 and 2 given<br>
set hm templateChk -f RolloNord BlStopUpLg peerName:long # verify RolloNord peerName, long match template?<br> set hm templateChk -f RolloNord BlStopUpLg peerName:long # verify RolloNord peerName, long match template?<br>
set hm templateChk -f RolloNord BlStopUpLg peerName # verify RolloNord peerName, long and short match template?<br> set hm templateChk -f RolloNord BlStopUpLg peerName # verify RolloNord peerName, long and short match template?<br>
set hm templateChk -f RolloNord BlStopUpLg peerName:all # verify RolloNord peerName, long and short match template?<br> set hm templateChk -f RolloNord BlStopUpLg peerName:all # verify RolloNord peerName, long and short match template?<br>
set hm templateChk -f RolloNord BlStopUpLg all:long # verify RolloNord all peers,long match template?<br> set hm templateChk -f RolloNord BlStopUpLg all:long # verify RolloNord all peers,long match template?<br>
set hm templateChk -f RolloNord BlStopUpLg all # verify RolloNord all peers,long and short match template?<br> set hm templateChk -f RolloNord BlStopUpLg all # verify RolloNord all peers,long and short match template?<br>
set hm templateChk -f Rollo.* BlStopUpLg all # verify all Rollo* all peers,long and short match template?<br> set hm templateChk -f Rollo.* BlStopUpLg all # verify each Rollo* all peers,long and short match template?<br>
set hm templateChk BlStopUpLg # verify all entities against this template<br> set hm templateChk BlStopUpLg # verify each entities against this template<br>
</code> </code>
<br> <br>
</li> </li>

View File

@ -339,7 +339,8 @@ my %culHmRegDefine = (
sabotageMsg =>{a=> 16.0,s=>1.0,l=>0,min=>0 ,max=>1 ,c=>'lit' ,f=>'' ,u=>'' ,d=>1,t=>"enable sabotage message" ,lit=>{off=>0,on=>1}}, sabotageMsg =>{a=> 16.0,s=>1.0,l=>0,min=>0 ,max=>1 ,c=>'lit' ,f=>'' ,u=>'' ,d=>1,t=>"enable sabotage message" ,lit=>{off=>0,on=>1}},
cyclicInfoMsgDis=>{a=> 17.0,s=>1.0,l=>0,min=>0 ,max=>255 ,c=>'' ,f=>'' ,u=>'' ,d=>1,t=>"cyclic message"}, cyclicInfoMsgDis=>{a=> 17.0,s=>1.0,l=>0,min=>0 ,max=>255 ,c=>'' ,f=>'' ,u=>'' ,d=>1,t=>"cyclic message"},
lowBatLimit =>{a=> 18.0,s=>1.0,l=>0,min=>10 ,max=>12 ,c=>'factor' ,f=>10 ,u=>'V' ,d=>1,t=>"low batterie limit, step .1V"}, lowBatLimit =>{a=> 18.0,s=>1.0,l=>0,min=>10 ,max=>12 ,c=>'factor' ,f=>10 ,u=>'V' ,d=>1,t=>"low batterie limit, step .1V"},
lowBatLimitBA =>{a=> 18.0,s=>1.0,l=>0,min=>5 ,max=>15 ,c=>'factor' ,f=>10 ,u=>'V' ,d=>1,t=>"low batterie limit, step .1V"}, lowBatLimitBA =>{a=> 18.0,s=>1.0,l=>0,min=>5 ,max=>15 ,c=>'factor' ,f=>10 ,u=>'V' ,d=>0,t=>"low batterie limit, step .1V"},
lowBatLimitFS =>{a=> 18.0,s=>1.0,l=>0,min=>2 ,max=>3 ,c=>'factor' ,f=>10 ,u=>'V' ,d=>0,t=>"low batterie limit, step .1V"},
batDefectLimit =>{a=> 19.0,s=>1.0,l=>0,min=>0.1,max=>2 ,c=>'factor' ,f=>100 ,u=>'Ohm' ,d=>1,t=>"batterie defect detection"}, batDefectLimit =>{a=> 19.0,s=>1.0,l=>0,min=>0.1,max=>2 ,c=>'factor' ,f=>100 ,u=>'Ohm' ,d=>1,t=>"batterie defect detection"},
transmDevTryMax =>{a=> 20.0,s=>1.0,l=>0,min=>1 ,max=>10 ,c=>'' ,f=>'' ,u=>'' ,d=>0,t=>"max message re-transmit"}, transmDevTryMax =>{a=> 20.0,s=>1.0,l=>0,min=>1 ,max=>10 ,c=>'' ,f=>'' ,u=>'' ,d=>0,t=>"max message re-transmit"},
localResDis =>{a=> 24.0,s=>1.0,l=>0,min=>1 ,max=>1 ,c=>'lit' ,f=>'' ,u=>'' ,d=>0,t=>"local reset disable" ,lit=>{off=>0,on=>1}}, localResDis =>{a=> 24.0,s=>1.0,l=>0,min=>1 ,max=>1 ,c=>'lit' ,f=>'' ,u=>'' ,d=>0,t=>"local reset disable" ,lit=>{off=>0,on=>1}},
@ -361,7 +362,7 @@ my %culHmRegDefine = (
driveDown =>{a=> 11.0,s=>2.0,l=>1,min=>0 ,max=>6000.0 ,c=>'factor' ,f=>10 ,u=>'s' ,d=>1,t=>"drive time up"}, driveDown =>{a=> 11.0,s=>2.0,l=>1,min=>0 ,max=>6000.0 ,c=>'factor' ,f=>10 ,u=>'s' ,d=>1,t=>"drive time up"},
driveUp =>{a=> 13.0,s=>2.0,l=>1,min=>0 ,max=>6000.0 ,c=>'factor' ,f=>10 ,u=>'s' ,d=>1,t=>"drive time up"}, driveUp =>{a=> 13.0,s=>2.0,l=>1,min=>0 ,max=>6000.0 ,c=>'factor' ,f=>10 ,u=>'s' ,d=>1,t=>"drive time up"},
driveTurn =>{a=> 15.0,s=>1.0,l=>1,min=>0 ,max=>6000.0 ,c=>'factor' ,f=>10 ,u=>'s' ,d=>1,t=>"Engine uncharge time, typically 0.5s. Do not set to 0 inconnected to engine"}, driveTurn =>{a=> 15.0,s=>1.0,l=>1,min=>0 ,max=>6000.0 ,c=>'factor' ,f=>10 ,u=>'s' ,d=>1,t=>"Engine uncharge time, typically 0.5s. Do NOT set to 0 if operated with engine"},
refRunCounter =>{a=> 16.0,s=>1.0,l=>1,min=>0 ,max=>255 ,c=>'' ,f=>'' ,u=>'' ,d=>0,t=>"reference run counter"}, refRunCounter =>{a=> 16.0,s=>1.0,l=>1,min=>0 ,max=>255 ,c=>'' ,f=>'' ,u=>'' ,d=>0,t=>"reference run counter"},
#remote mainly #remote mainly
longPress =>{a=> 4.4,s=>0.4,l=>1,min=>0.3,max=>1.8 ,c=>'m10s3' ,f=>'' ,u=>'s' ,d=>0,t=>"time to detect key long press"}, longPress =>{a=> 4.4,s=>0.4,l=>1,min=>0.3,max=>1.8 ,c=>'m10s3' ,f=>'' ,u=>'s' ,d=>0,t=>"time to detect key long press"},
@ -647,6 +648,7 @@ my %culHmRegModel = (
"HM-SEC-SFA-SM" =>{cyclicInfoMsg =>1,sabotageMsg =>1,transmDevTryMax =>1, "HM-SEC-SFA-SM" =>{cyclicInfoMsg =>1,sabotageMsg =>1,transmDevTryMax =>1,
lowBatLimit =>1,batDefectLimit =>1, lowBatLimit =>1,batDefectLimit =>1,
transmitTryMax =>1}, transmitTryMax =>1},
"HM-Dis-TD-T" =>{lowBatLimitFS =>1,ledMode =>1},
"HM-LC-SW1-BA-PCB"=>{lowBatLimitBA =>1,ledMode =>1}, "HM-LC-SW1-BA-PCB"=>{lowBatLimitBA =>1,ledMode =>1},
"HM-Sys-sRP-Pl" =>{compMode =>1}, "HM-Sys-sRP-Pl" =>{compMode =>1},
"KFM-Display" =>{CtDlyOn =>1,CtDlyOff =>1, "KFM-Display" =>{CtDlyOn =>1,CtDlyOff =>1,