From e7617e4d49b7d14455c202e8f3be4b1bf6e03584 Mon Sep 17 00:00:00 2001 From: martinp876 Date: Fri, 15 Mar 2013 19:16:02 +0000 Subject: [PATCH] autoReadReg update git-svn-id: https://fhem.svn.sourceforge.net/svnroot/fhem/trunk/fhem@2920 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- FHEM/10_CUL_HM.pm | 20 ++++++++++++-------- FHEM/HMConfig.pm | 6 +++--- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/FHEM/10_CUL_HM.pm b/FHEM/10_CUL_HM.pm index 33f2e8799..ae6744de6 100755 --- a/FHEM/10_CUL_HM.pm +++ b/FHEM/10_CUL_HM.pm @@ -89,7 +89,8 @@ sub CUL_HM_Initialize($) { "serialNr firmware ". "rawToReadable unit ".#"KFM-Sensor" only "peerIDs repPeers ". - "actCycle actStatus autoReadReg:1_restart,0_off,2_pon-restart ". + "actCycle actStatus ". + "autoReadReg:1_restart,0_off,2_pon-restart,3_onChange ". "expert:0_off,1_on,2_full ". "hmClass:obsolete devInfo:obsolete ". #unused @@ -879,10 +880,10 @@ sub CUL_HM_Parse($$) {############################## $state .= ($st eq "swi")?"toggle":"Short";#swi only support toggle $trigType = "Short"; } - $shash->{helper}{addVal} = $buttonField; #store to handle changes - push @entities,CUL_HM_UpdtReadBulk($chnHash,"state:".$state.$target - ,"trigger:".$trigType."_".$bno - ,1); + $shash->{helper}{addVal} = $buttonField; #store to handle changesFread + push @entities,CUL_HM_UpdtReadBulk($chnHash,1, + ,"state:".$state.$target + ,"trigger:".$trigType."_".$bno); push @event,"battery:". (($buttonField&0x80)?"low":"ok"); push @event,"state:$btnName $state$target"; } @@ -1480,7 +1481,7 @@ sub CUL_HM_parseCommon(@){##################################################### my ($chn) = ($1) if($p =~ m/^..(..)/); if ($chn eq "00"){ CUL_HM_queueAutoRead(CUL_HM_hash2Name($shash)) - if (2 == substr(AttrVal($shash->{NAME},"autoReadReg",0),0,1)); + if (1 < substr(AttrVal($shash->{NAME},"autoReadReg",0),0,1)); return "powerOn" ;# check dst eq "000000" as well? } } @@ -2913,6 +2914,8 @@ sub CUL_HM_pushConfig($$$$$$$$) {#generate messages to cnfig data to register substr($content,$l,$ml)); } CUL_HM_PushCmdStack($hash,"++A001".$src.$dst.$chn."06"); + CUL_HM_queueAutoRead(CUL_HM_hash2Name($hash)) + if (2 < substr(CUL_HM_Get($hash,$hash->{NAME},"param","autoReadReg"),0,1)); } sub CUL_HM_Resend($) {#resend a message if there is no answer my $hash = shift; @@ -4531,8 +4534,9 @@ sub CUL_HM_putHash($) {# provide data for HMinfo attr KFM100 unit Liter
  • autoReadReg
    - set to '1' will execute a getConfig for the device automatically after each reboot of FHEM.
    - set to '2' like '1' plus execute after power_on.
    + '1' will execute a getConfig for the device automatically after each reboot of FHEM.
    + '2' like '1' plus execute after power_on.
    + '3' includes '2' plus updates on writes to the device
    Execution will be delayed in order to prevent congestion at startup. Therefore the update of the readings and the display will be delayed depending on the sice of the database.
    Recommendations and constrains upon usage:
    diff --git a/FHEM/HMConfig.pm b/FHEM/HMConfig.pm index 32031345a..23580d7b6 100644 --- a/FHEM/HMConfig.pm +++ b/FHEM/HMConfig.pm @@ -212,9 +212,9 @@ my %culHmRegDefShLg = (# register that are available for short AND long button p DriveMode =>{a=> 31.0,s=>1.0,l=>3,min=>0 ,max=>3 ,c=>'lit' ,f=>'' ,u=>'' ,d=>0,t=>"" ,lit=>{direct=>0,viaUpperEnd=>1,viaLowerEnd=>2,viaNextEnd=>3}}, #dimmer mainly OnDly =>{a=> 6.0,s=>1.0,l=>3,min=>0 ,max=>111600 ,c=>'fltCvT' ,f=>'' ,u=>'s' ,d=>0,t=>"on delay "}, - OnTime =>{a=> 7.0,s=>1.0,l=>3,min=>0 ,max=>111600 ,c=>'fltCvT' ,f=>'' ,u=>'s' ,d=>0,t=>"on time"}, + OnTime =>{a=> 7.0,s=>1.0,l=>3,min=>0 ,max=>111600 ,c=>'fltCvT' ,f=>'' ,u=>'s' ,d=>0,t=>"on time, 111600 = infinite"}, OffDly =>{a=> 8.0,s=>1.0,l=>3,min=>0 ,max=>111600 ,c=>'fltCvT' ,f=>'' ,u=>'s' ,d=>0,t=>"off delay"}, - OffTime =>{a=> 9.0,s=>1.0,l=>3,min=>0 ,max=>111600 ,c=>'fltCvT' ,f=>'' ,u=>'s' ,d=>0,t=>"off time"}, + OffTime =>{a=> 9.0,s=>1.0,l=>3,min=>0 ,max=>111600 ,c=>'fltCvT' ,f=>'' ,u=>'s' ,d=>0,t=>"off time, 111600 = infinite"}, ActionTypeDim =>{a=> 10.0,s=>0.4,l=>3,min=>0 ,max=>8 ,c=>'lit' ,f=>'' ,u=>'' ,d=>1,t=>"" ,lit=>{off=>0,jmpToTarget=>1,toggleToCnt=>2,toggleToCntInv=>3,upDim=>4,downDim=>5,toggelDim=>6,toggelDimToCnt=>7,toggelDimToCntInv=>8}}, OffDlyBlink =>{a=> 14.5,s=>0.1,l=>3,min=>0 ,max=>1 ,c=>'lit' ,f=>'' ,u=>'' ,d=>0,t=>"" ,lit=>{off=>0,on=>1}}, @@ -441,7 +441,7 @@ my %culHmRegDefine = ( msgScPosB =>{a=> 32.4,s=>0.2,l=>1,min=>0 ,max=>2 ,c=>'lit' ,f=>'' ,u=>'' ,d=>0,t=>"Message for position B",lit=>{noMsg=>0,closed=>1,open=>2}}, eventDlyTime =>{a=> 33 ,s=>1 ,l=>1,min=>0 ,max=>7620 ,c=>'fltCvT' ,f=>'' ,u=>'s' ,d=>1,t=>"event delay time"}, ledOnTime =>{a=> 34 ,s=>1 ,l=>1,min=>0 ,max=>1.275 ,c=>'factor' ,f=>200 ,u=>'s' ,d=>0,t=>"LED ontime"}, - eventFilterTime =>{a=> 35 ,s=>1 ,l=>1,min=>0 ,max=>7620 ,c=>'fltCvT' ,f=>'' ,u=>'s' ,d=>0,t=>"evetn filter time"}, + eventFilterTime =>{a=> 35 ,s=>1 ,l=>1,min=>0 ,max=>7620 ,c=>'fltCvT' ,f=>'' ,u=>'s' ,d=>0,t=>"event filter time"}, # weather units stormUpThresh =>{a=> 6 ,s=>1 ,l=>1,min=>0 ,max=>255 ,c=>'' ,f=>'' ,u=>'' ,d=>1,t=>"Storm upper threshold"},