From 30c82b1a4d36296d9b0e37fd88423af2c48dcd29 Mon Sep 17 00:00:00 2001 From: martinp876 Date: Fri, 11 Oct 2013 17:53:00 +0000 Subject: [PATCH] motiondetect improve ack, cosmetics for protocol cleanup git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@4032 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/10_CUL_HM.pm | 44 +++++++++++++++++++++++++++--------------- fhem/FHEM/98_HMinfo.pm | 3 ++- 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/fhem/FHEM/10_CUL_HM.pm b/fhem/FHEM/10_CUL_HM.pm index 7338ff181..312f8d73f 100755 --- a/fhem/FHEM/10_CUL_HM.pm +++ b/fhem/FHEM/10_CUL_HM.pm @@ -1252,7 +1252,7 @@ sub CUL_HM_Parse($$) {############################## push @event, 'devState_raw'.$d1.':'.$d2; } - if($id eq $dst && $mFlg.$mTp ne "8002" && $state){ + if($id eq $dst && hex($mFlg)&0x20 && $state){ push @ack,$shash,$mNo."8002".$id.$src."0101${state}00"; } } @@ -1542,8 +1542,8 @@ sub CUL_HM_parseCommon(@){##################################################### # TC wakes up with 8270, not with A258 # VD wakes up with 8202 # 9610 - if( $shash->{cmdStack} && - ((hex($mFlg) & 0xA2) == 0x82) && + if( $shash->{cmdStack} && + ((hex($mFlg) & 0xA2) == 0x82) && (CUL_HM_getRxType($shash) & 0x08)){ #wakeup #send wakeup and process command stack CUL_HM_SndCmd($shash, '++A112'.CUL_HM_IOid($shash).$src); @@ -1680,7 +1680,6 @@ sub CUL_HM_parseCommon(@){##################################################### CUL_HM_ID2PeerList ($chnNname,$_,1) foreach (@peers); if (grep /00000000/,@peers) {# last entry, peerList is complete - CUL_HM_respPendRm($shash); # check for request to get List3 data my $reqPeer = $chnhash->{helper}{getCfgList}; if ($reqPeer){ @@ -1697,6 +1696,7 @@ sub CUL_HM_parseCommon(@){##################################################### } } } + CUL_HM_respPendRm($shash); delete $chnhash->{helper}{getCfgList}; delete $chnhash->{helper}{getCfgListNo}; } @@ -3353,8 +3353,6 @@ sub CUL_HM_ProcessCmdStack($) { CUL_HM_SndCmd($hash, shift @{$hash->{cmdStack}}); } elsif(!@{$hash->{cmdStack}}) { - delete($hash->{cmdStack}); - delete($hash->{protCmdPend}); #-- update info --- CUL_HM_protState($hash,"CMDs_done".($hash->{helper}{prt}{bErr}? ("_Errors:".$hash->{helper}{prt}{bErr}):"")); @@ -3466,7 +3464,7 @@ sub CUL_HM_responseSetup($$) {#store all we need to handle the response CUL_HM_protState($hash,"CMDs_processing..."); InternalTimer(gettimeofday()+.5, "CUL_HM_ProcessCmdStack", $hash, 0); } - else{ + elsif(!$hash->{helper}{prt}{rspWait}{cmd}){ CUL_HM_protState($hash,"CMDs_done".($hash->{helper}{prt}{bErr}? ("_Errors:".$hash->{helper}{prt}{bErr}):"")); } @@ -3662,8 +3660,6 @@ sub CUL_HM_eventP($$) {#handle protocol events $nAttr->{protCmdDel} = 0 if(!$nAttr->{protCmdDel}); $nAttr->{protCmdDel} += scalar @{$hash->{cmdStack}} if ($hash->{cmdStack}); - delete($hash->{cmdStack}); - delete($nAttr->{protCmdPend}); CUL_HM_protState($hash,"CMDs_done".($hash->{helper}{prt}{bErr}? ("_Errors:".$hash->{helper}{prt}{bErr}):"")); } @@ -3677,18 +3673,19 @@ sub CUL_HM_protState($$){ readingsSingleUpdate($hash,"state",$state,0) if (!$hash->{helper}{role}{chn}); Log GetLogLevel($name,6),"CUL_HM $name protEvent:$state". ($hash->{cmdStack}?" pending:".scalar @{$hash->{cmdStack}}:""); - - if ($state =~ m/^CMDs_done/) {DoTrigger($name, undef); + if ($state =~ m/processing/) {$hash->{helper}{prt}{sProc} = 1; + } + elsif($state =~ m/^CMDs_done/) {DoTrigger($name, undef); + delete($hash->{cmdStack}); + delete($hash->{protCmdPend}); $hash->{helper}{prt}{sProc} = 0; $hash->{helper}{prt}{awake} = 0 if (defined$hash->{helper}{prt}{awake}); # asleep - } - elsif($state =~ m/processing/) {$hash->{helper}{prt}{sProc} = 1; - } + } elsif($state eq "Info_Cleared"){$hash->{helper}{prt}{sProc} = 0; $hash->{helper}{prt}{awake} = 0 if (defined$hash->{helper}{prt}{awake}); # asleep - } + } elsif($state eq "CMDs_pending"){$hash->{helper}{prt}{sProc} = 2; - } + } } ###################-----------helper and shortcuts--------##################### @@ -5644,6 +5641,21 @@ sub CUL_HM_putHash($) {# provide data for HMinfo incomplete or incorrect.
trigLast <channel> #last receiced trigger
+
  • HM-CC-RT-DN
    + state:T: $actTemp desired: $setTemp valve: $vp %
    + motorErr: [ok|ValveTight|adjustRangeTooLarge|adjustRangeTooSmall|communicationERR|unknown|lowBat|ValveErrorPosition] + measured-temp $actTemp
    + desired-temp $setTemp
    + ValvePosition $vp %
    + mode [auto|manu|party|boost]
    + battery [low|ok]
    + batteryLevel $bat V
    + measured-temp $actTemp
    + desired-temp $setTemp
    + actuator $vp %
    + time-request
    + trig_<src> <value> #channel was triggered by <src> channel. +
  • HM-CC-VD
    $vp %
    battery:[critical|low|ok]
    diff --git a/fhem/FHEM/98_HMinfo.pm b/fhem/FHEM/98_HMinfo.pm index af8eed796..671844792 100644 --- a/fhem/FHEM/98_HMinfo.pm +++ b/fhem/FHEM/98_HMinfo.pm @@ -308,7 +308,8 @@ sub HMinfo_SetFn($@) {######################################################### if(!$modules{CUL_HM}{helper}{autoRdCfgLst}){ $modules{CUL_HM}{helper}{autoRdCfgLst} = \@arr; } - push @{$modules{CUL_HM}{helper}{autoRdCfgLst}}, $dName; + @{$modules{CUL_HM}{helper}{autoRdCfgLst}} = + HMinfo_noDup(@{$modules{CUL_HM}{helper}{autoRdCfgLst}}, $dName); $defs{$dName}{autoRead} = "scheduled"; RemoveInternalTimer("autoRdCfg"); InternalTimer(gettimeofday()+5,"CUL_HM_autoReadConfig","autoRdCfg",0);