From 1a9c20195f3528d9aebc7ce5d6a6847ee6eb9939 Mon Sep 17 00:00:00 2001 From: martinp876 <> Date: Tue, 23 Jul 2013 10:19:10 +0000 Subject: [PATCH] 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 --- fhem/FHEM/00_HMLAN.pm | 8 ++--- fhem/FHEM/10_CUL_HM.pm | 48 ++++++++++++-------------- fhem/FHEM/98_HMinfo.pm | 78 +++++++++++++++++++++++++----------------- fhem/FHEM/HMConfig.pm | 8 +++-- 4 files changed, 77 insertions(+), 65 deletions(-) diff --git a/fhem/FHEM/00_HMLAN.pm b/fhem/FHEM/00_HMLAN.pm index bfec31202..f7ccbd27d 100755 --- a/fhem/FHEM/00_HMLAN.pm +++ b/fhem/FHEM/00_HMLAN.pm @@ -64,7 +64,6 @@ sub HMLAN_Initialize($) { "respTime wdStrokeTime:5,10,15,20,25 " . "hmProtocolEvents:0_off,1_dump,2_dumpFull,3_dumpTrigger ". "wdTimer ". - "hmOvTo ".#General remove $readingFnAttributes; } sub HMLAN_Define($$) {######################################################### @@ -576,10 +575,9 @@ sub HMLAN_condUpdate($$) {##################################################### my $name = $hash->{NAME}; $hash->{helper}{cnd}{$HMcnd} = 0 if (!$hash->{helper}{cnd}{$HMcnd}); $hash->{helper}{cnd}{$HMcnd}++; - if ($HMcnd == 4){ - InternalTimer(gettimeofday()+AttrVal($name,"hmOvTo",$HMOvLdRcvr),#General remove Attr, testing only - "HMLAN_relOvrLd","Overload:".$name,1); - } + InternalTimer(gettimeofday()+$HMOvLdRcvr,"HMLAN_relOvrLd","Overload:".$name,1) + if ($HMcnd == 4); + my $HMcndTxt = $HMcond{$HMcnd}?$HMcond{$HMcnd}:"Unknown:$HMcnd"; Log GetLogLevel($name,2), "HMLAN_Parse: $name new condition $HMcndTxt"; readingsSingleUpdate($hash,"cond",$HMcndTxt,1); diff --git a/fhem/FHEM/10_CUL_HM.pm b/fhem/FHEM/10_CUL_HM.pm index cc3fdffd1..79fb97f97 100755 --- a/fhem/FHEM/10_CUL_HM.pm +++ b/fhem/FHEM/10_CUL_HM.pm @@ -424,6 +424,14 @@ sub CUL_HM_Attr(@) {################################# } #+++++++++++++++++ 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($$) {############################## my ($iohash, $msgIn) = @_; my $id = CUL_HM_Id($iohash); @@ -763,16 +771,14 @@ sub CUL_HM_Parse($$) {############################## if (($mTp eq "02" && $p =~ m/^01/) || # handle Ack_Status ($mTp eq "10" && $p =~ m/^06/) || #or Info_Status message here ($mTp eq "41")) { - my $level = 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 $lvl = substr($p,4,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); } } @@ -1181,12 +1187,11 @@ sub CUL_HM_Parse($$) {############################## if($modules{CUL_HM}{defptr}{"$src$chn"}); } if (defined($state)){# if state was detected post events - my %txt; - %txt = ("C8"=>"open", "64"=>"tilted", "00"=>"closed"); - %txt = ("C8"=>"wet", "64"=>"damp", "00"=>"dry") - if($model eq "HM-SEC-WDS"); - my $txt = $txt{$state}; - $txt = "unknown:$state" if(!$txt); + my $txt; + if ($lvlStr{md}{$model}){$txt = $lvlStr{md}{$model}{$state}} + elsif ($lvlStr{st}{$st}) {$txt = $lvlStr{st}{$st}{$state} } + else {$txt = "unknown:$state"} + push @event, "state:$txt"; push @event, "contact:$txt$target"; } @@ -1353,15 +1358,6 @@ sub CUL_HM_Parse($$) {############################## 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(@){##################################################### # parsing commands that are device independant my ($mNo,$mFlg,$mTp,$src,$dst,$p,$st,$md) = @_; @@ -1589,8 +1585,8 @@ sub CUL_HM_parseCommon(@){##################################################### if (length($p)>5){ my $l = substr($p,4,2); - if ($lvlStr{model}{$md} && $lvlStr{model}{$md}{$l}) {$level = $lvlStr{model}{$md}{$l}} - elsif ($lvlStr{subType}{$st} && $lvlStr{subType}{$st}{$l}){$level = $lvlStr{subType}{$st}{$l}} + if ($lvlStr{md}{$md} && $lvlStr{md}{$md}{$l}){$level = $lvlStr{md}{$md}{$l}} + elsif ($lvlStr{st}{$st} && $lvlStr{st}{$st}{$l}){$level = $lvlStr{st}{$st}{$l}} else {$level = hex($l)}; } diff --git a/fhem/FHEM/98_HMinfo.pm b/fhem/FHEM/98_HMinfo.pm index d18ed44e8..097c1bd18 100644 --- a/fhem/FHEM/98_HMinfo.pm +++ b/fhem/FHEM/98_HMinfo.pm @@ -841,10 +841,12 @@ sub HMinfo_templateSet(@){##################################################### } sub HMinfo_templateChk(@){##################################################### my ($aName,$tmpl,$pSet,@p) = @_; - $pSet = "" if (!$pSet); + $pSet = "" if (!$pSet || $pSet eq "none"); my ($pName,$pTyp) = split(":",$pSet); - return "template undefined $tmpl" if(!$tpl{$tmpl}); - return "aktor $aName unknown" if(!$defs{$aName}); + return "template undefined $tmpl\n" if(!$tpl{$tmpl}); + return "aktor $aName unknown\n" if(!$defs{$aName}); + return "give :[short|long|all] wrong:$pTyp\n" if($pTyp && $pTyp !~ m/(short|long|all)/); + my @pNames; if ($pName eq "all"){ my $dId = substr(CUL_HM_name2Id($aName),0,6); @@ -853,34 +855,46 @@ sub HMinfo_templateChk(@){##################################################### 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{ push @pNames,$pSet; } + my $repl = ""; foreach my $pS (@pNames){ ($pName,$pTyp) = split(":",$pS); - - return "give :[short|long] with peer, not $pS" if($pName && $pTyp !~ m/(short|long)/); - my $pRnm = $pName?($pName."-".($pS eq "long"?"lg":"sh")):""; my $replPeer=""; - foreach my $rn (keys%{$tpl{$tmpl}{reg}}){ - my $regV = ReadingsVal($aName,"R-$pRnm$rn",undef); - $regV = ReadingsVal($aName,"R-".$rn,undef) if (!defined $regV); - - if (defined $regV){ - $regV =~s/ .*//;#strip unit - my $tplV = $tpl{$tmpl}{reg}{$rn}; - if ($tplV =~m /^p(.)$/) {#replace with User parameter - return "insufficient values - at least ".$tpl{p}." are $1 necessary" if (@p < ($1+1)); - $tplV = $p[$1]; + + 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}}){ + 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); + + if (defined $regV){ + $regV =~s/ .*//;#strip unit + my $tplV = $tpl{$tmpl}{reg}{$rn}; + if ($tplV =~m /^p(.)$/) {#replace with User parameter + return "insufficient data - at least ".$tpl{p}." are $1 necessary" + if (@p < ($1+1)); + $tplV = $p[$1]; + } + $replPeer .= " $rn :$regV should $tplV \n" if ($regV ne $tplV); } - $replPeer .= " $rn :$regV should $tplV \n" if ($regV ne $tplV); - } - else{ - $replPeer .= " reg not found: $rn\n"; - } - } - $repl .= "$aName $pS:".($replPeer?"\n$replPeer":"match\n"); + else{ + $replPeer .= " reg not found: $rn\n"; + } + } + } + $repl .= "$aName $pS-> ".($replPeer?"failed\n$replPeer":"match\n"); } return ($repl?$repl:"template $tmpl match actor:$aName peer:$pSet"); } @@ -1117,16 +1131,18 @@ sub HMinfo_cpRegs(@){#########################################################
  • templateChk [filter] <template> <peer:[long|short]> [<param1> ...]
    verifies if the register-readings comply to the template
    Parameter are identical to templateSet
    - 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
    + If no peer is necessary use none to skip this entry
    Examples
    - set hm templateChk -f RolloNord BlStopUpLg peerName:long # verify RolloNord peerName, long match template?
    - set hm templateChk -f RolloNord BlStopUpLg peerName # verify RolloNord peerName, long and short match template?
    - set hm templateChk -f RolloNord BlStopUpLg peerName:all # verify RolloNord peerName, long and short match template?
    - set hm templateChk -f RolloNord BlStopUpLg all:long # verify RolloNord all peers,long match template?
    - set hm templateChk -f RolloNord BlStopUpLg all # verify RolloNord all peers,long and short match template?
    - set hm templateChk -f Rollo.* BlStopUpLg all # verify all Rollo* all peers,long and short match template?
    - set hm templateChk BlStopUpLg # verify all entities against this template
    + set hm templateChk -f RolloNord BlStopUpLg none 1 2 # verify RolloNord, no peer, parameter 1 and 2 given
    + set hm templateChk -f RolloNord BlStopUpLg peerName:long # verify RolloNord peerName, long match template?
    + set hm templateChk -f RolloNord BlStopUpLg peerName # verify RolloNord peerName, long and short match template?
    + set hm templateChk -f RolloNord BlStopUpLg peerName:all # verify RolloNord peerName, long and short match template?
    + set hm templateChk -f RolloNord BlStopUpLg all:long # verify RolloNord all peers,long match template?
    + set hm templateChk -f RolloNord BlStopUpLg all # verify RolloNord all peers,long and short match template?
    + set hm templateChk -f Rollo.* BlStopUpLg all # verify each Rollo* all peers,long and short match template?
    + set hm templateChk BlStopUpLg # verify each entities against this template

  • diff --git a/fhem/FHEM/HMConfig.pm b/fhem/FHEM/HMConfig.pm index 5d8cf8546..57736e713 100644 --- a/fhem/FHEM/HMConfig.pm +++ b/fhem/FHEM/HMConfig.pm @@ -325,7 +325,7 @@ my %culHmRegDefine = ( stbyTime =>{a=> 14.0,s=>1.0,l=>0,min=>1 ,max=>99 ,c=>'' ,f=>'' ,u=>'s' ,d=>1,t=>"Standby Time"}, backOnTime =>{a=> 14.0,s=>1.0,l=>0,min=>0 ,max=>255 ,c=>'' ,f=>'' ,u=>'s' ,d=>1,t=>"Backlight On Time"}, btnLock =>{a=> 15.0,s=>1.0,l=>0,min=>0 ,max=>1 ,c=>'lit' ,f=>'' ,u=>'' ,d=>0,t=>"Button Lock" ,lit=>{unlock=>0,lock=>1}}, - + confBtnTime =>{a=> 21.0,s=>1.0,l=>0,min=>1 ,max=>255 ,c=>'' ,f=>'' ,u=>'min' ,d=>0,t=>"255=permanent"}, # keymatic/winmatic secific register keypressSignal =>{a=> 3.0,s=>0.1,l=>0,min=>0 ,max=>1 ,c=>'lit' ,f=>'' ,u=>'' ,d=>0,t=>"Keypress beep" ,lit=>{off=>0,on=>1}}, @@ -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}}, 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"}, - 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"}, 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}}, @@ -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"}, 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"}, #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"}, @@ -647,6 +648,7 @@ my %culHmRegModel = ( "HM-SEC-SFA-SM" =>{cyclicInfoMsg =>1,sabotageMsg =>1,transmDevTryMax =>1, lowBatLimit =>1,batDefectLimit =>1, transmitTryMax =>1}, + "HM-Dis-TD-T" =>{lowBatLimitFS =>1,ledMode =>1}, "HM-LC-SW1-BA-PCB"=>{lowBatLimitBA =>1,ledMode =>1}, "HM-Sys-sRP-Pl" =>{compMode =>1}, "KFM-Display" =>{CtDlyOn =>1,CtDlyOff =>1,