From 35478c5e10220bdca1f2df3f3008b08def752f44 Mon Sep 17 00:00:00 2001 From: dominikkarall Date: Mon, 18 Dec 2017 21:56:11 +0000 Subject: [PATCH] EQ3BT: support maxRetries and timeout attribute git-svn-id: https://svn.fhem.de/fhem/trunk@15643 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/10_EQ3BT.pm | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 377104566..c39b09eb6 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - feature: 10_EQ3BT: support maxRetries and timeout attribute - bugfix: 98_DLNARenderer: fix renew subscription warnings - feature: 98_BOSEST: support Audio Notification API for TTS no more minidlna installation needed diff --git a/fhem/FHEM/10_EQ3BT.pm b/fhem/FHEM/10_EQ3BT.pm index 070bcf965..3d69679b0 100644 --- a/fhem/FHEM/10_EQ3BT.pm +++ b/fhem/FHEM/10_EQ3BT.pm @@ -6,10 +6,15 @@ # # FHEM module to communicate with EQ-3 Bluetooth thermostats # -# Version: 2.0.2 +# Version: 2.0.3 # ############################################################# # +# v2.0.3 - 20171218 +# - FEATURE: support maxRetries and timeout attribute +# maxRetries...number of tries before error is counted +# timeout...timeout for the command +# # v2.0.2 - 20171118 # - FEATURE: support remote bluetooth interfaces via SSH (thx@Cooltux!) # @@ -150,7 +155,7 @@ sub EQ3BT_Initialize($) { $hash->{GetFn} = 'EQ3BT_Get'; $hash->{SetFn} = 'EQ3BT_Set'; $hash->{AttrFn} = 'EQ3BT_Attribute'; - $hash->{AttrList} = 'sshHost '. + $hash->{AttrList} = 'sshHost maxRetries timeout '. $readingFnAttributes; return undef; @@ -165,7 +170,7 @@ sub EQ3BT_Define($$) { my $sshHost; $hash->{STATE} = "initialized"; - $hash->{VERSION} = "2.0.2"; + $hash->{VERSION} = "2.0.3"; Log3 $hash, 3, "EQ3BT: EQ-3 Bluetooth Thermostat ".$hash->{VERSION}; if (int(@a) > 4) { @@ -528,7 +533,7 @@ sub EQ3BT_execGatttool($) { } if(defined($listen) && $listen eq "listen") { - $cmd = "timeout 15 ".$cmd." --listen"; + $cmd = "timeout ".AttrVal($name, "timeout", 15)." ".$cmd." --listen"; } #redirect stderr to stdout @@ -606,7 +611,7 @@ sub EQ3BT_processGatttoolResult($) { $hash->{helper}{"retryCounter$workType"} = 0 if(!defined($hash->{helper}{"retryCounter$workType"})); $hash->{helper}{"retryCounter$workType"}++; Log3 $hash, 4, "EQ3BT ($name): $workType failed ($handle, $value, $notification)"; - if ($hash->{helper}{"retryCounter$workType"} > 20) { + if ($hash->{helper}{"retryCounter$workType"} > AttrVal($name, "maxRetries", 20)) { my $errorCount = ReadingsVal($hash->{NAME}, "errorCount-$workType", 0); readingsSingleUpdate($hash, "errorCount-$workType", $errorCount+1, 1); Log3 $hash, 3, "EQ3BT ($name): $workType, $handle, $value failed 20 times.";