From d19c8bc67f64453f066a43435d180301765e15a4 Mon Sep 17 00:00:00 2001 From: martinp876 <> Date: Sat, 21 Feb 2015 16:33:56 +0000 Subject: [PATCH] CUL_HM: ActionDetector new attribut git-svn-id: https://svn.fhem.de/fhem/trunk@8053 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/10_CUL_HM.pm | 54 +++++++++++++++++++++++++++++++++--------- fhem/FHEM/HMConfig.pm | 1 + 2 files changed, 44 insertions(+), 11 deletions(-) diff --git a/fhem/FHEM/10_CUL_HM.pm b/fhem/FHEM/10_CUL_HM.pm index 9c8748ad6..43cdc3f7d 100755 --- a/fhem/FHEM/10_CUL_HM.pm +++ b/fhem/FHEM/10_CUL_HM.pm @@ -140,6 +140,7 @@ sub CUL_HM_Initialize($) { ."actCycle " # also for action detector ."hmProtocolEvents:0_off,1_dump,2_dumpFull,3_dumpTrigger " ."rssiLog:1,0 " # enable writing RSSI to Readings (device only) + ."actAutoTry:0_off,1_on " ; $hash->{Attr}{devPhy} = # -- physical device only attributes "serialNr firmware .stc .devInfo " @@ -800,6 +801,11 @@ sub CUL_HM_Attr(@) {################################# delete $hash->{helper}{lm}; } } + elsif($attrName eq "actAutoTry" ){ + if ($cmd eq "set"){ + return "$attrName only usable for ActionDetector" if(CUL_HM_hash2Id($hash) ne "000000");#only for device + } + } CUL_HM_queueUpdtCfg($name) if ($updtReq); return; @@ -6908,7 +6914,8 @@ sub CUL_HM_ActCheck($) {# perform supervision my $peerIDs = $actHash->{helper}{peers}?$actHash->{helper}{peers}:""; my @event; my ($cntUnkn,$cntAliv,$cntDead,$cnt_Off) =(0,0,0,0); - + my $autoTry = CUL_HM_getAttrInt($actName,"actAutoTry",0); + foreach my $devId (split(",",$peerIDs)){ next if (!$devId); my $devName = CUL_HM_id2Name($devId); @@ -6934,17 +6941,31 @@ sub CUL_HM_ActCheck($) {# perform supervision my $tSince = sprintf("%04d-%02d-%02d %02d:%02d:%02d", $t[5]+1900, $t[4]+1, $t[3], $t[2], $t[1], $t[0]); - if (!$tLast){ #cannot determine time + if (!$tLast #cannot determine time + || $tSince gt $tLast){ #no message received in window if ($actHash->{helper}{$devId}{start} lt $tSince){ - $cntDead++; $state = "dead"; - } - else{ - $cntUnkn++; $state = "unknown"; - } - } - elsif ($tSince gt $tLast){ #no message received in window - if ($actHash->{helper}{$devId}{start} lt $tSince){ - $cntDead++; $state = "dead"; + if($autoTry) { #try to send a statusRequest? + if (!$actHash->{helper}{$devId}{try} || $actHash->{helper}{$devId}{try}<2){ + $actHash->{helper}{$devId}{try} = $actHash->{helper}{$devId}{try} + ? ($actHash->{helper}{$devId}{try} +1) + : 1; + if (CUL_HM_Set($defs{$devName},$devName,"help") =~ m/statusRequest/){ + # send statusrequest if possible + CUL_HM_Set($defs{$devName},$devName,"statusRequest"); + $cntUnkn++; $state = "unknown"; + } + else{ + $actHash->{helper}{$devId}{try} = 99; + $cntDead++; $state = "dead"; + } + } + else{ + $cntDead++; $state = "dead"; + } + } + else{ + $cntDead++; $state = "dead"; + } } else{ $cntUnkn++; $state = "unknown"; @@ -6952,6 +6973,7 @@ sub CUL_HM_ActCheck($) {# perform supervision } else{ #message in time $cntAliv++; $state = "alive"; + delete $actHash->{helper}{$devId}{try}; } } if ($oldState ne $state){ @@ -8619,6 +8641,11 @@ sub CUL_HM_tempListTmpl(@) { ################################################## if set HMLAN/USB is forced to request AES signature before sending ACK to the device.
This funktion strictly works with HMLAN/USB - it doesn't work for CUL type IOs.
+
  • actAutoTry + actAutoTry 0_off,1_on
    + setting this option enables Action Detector to send a statusrequest in case of a device is going to be marked dead. + The attribut may be useful in case a device is being checked that does not send messages regularely - e.g. an ordinary switch. +
  • actCycle actCycle <[hhh:mm]|off>
    Supports 'alive' or better 'not alive' detection for devices. [hhh:mm] is the maximum silent time for the device. @@ -9884,6 +9911,11 @@ sub CUL_HM_tempListTmpl(@) { ##################################################
  • dummy
  • showtime
  • readingFnAttributes
  • +
  • actAutoTry + actAutoTry 0_off,1_on
    + setzen der Option erlaubt dem ActionDetector ein statusrequest zu senden falls das Device dead markiert werden soll. + Das Attribut kann fuer Devices nützlich sein, welche sich nicht von selbst zyklisch melden. +
  • actCycle actCycle <[hhh:mm]|off>
    Bietet eine 'alive' oder besser 'not alive' Erkennung für Geräte. [hhh:mm] ist die maximale Zeit ohne Nachricht eines Geräts. Wenn innerhalb dieser Zeit keine Nachricht empfangen wird so wird das Event"<device> is dead" generiert. diff --git a/fhem/FHEM/HMConfig.pm b/fhem/FHEM/HMConfig.pm index c4213e3cd..7ed745aff 100644 --- a/fhem/FHEM/HMConfig.pm +++ b/fhem/FHEM/HMConfig.pm @@ -804,6 +804,7 @@ my $K_actDetID = '000000'; # id of actionDetector ,sensRain =>{ transmDevTryMax =>1,localResDis =>1} ,tipTronic =>{ cyclicInfoMsg =>1,cyclicInfoMsgDis=>1,localResDis =>1,RS485IdleTime =>1} ,powerMeter =>{ intKeyVisib =>1,localResDis =>1} + ,outputUnit =>{ intKeyVisib =>1} ,powerSensor =>{ transmitTryMax =>1,transmDevTryMax =>1 ,mtrType =>1,mtrConstIr =>1,mtrConstGas =>1,mtrConstLed =>1 ,mtrSensIr =>1