2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-27 10:37:13 +00:00

EQ3BT: support maxRetries and timeout attribute

git-svn-id: https://svn.fhem.de/fhem/trunk@15643 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
dominikkarall 2017-12-18 21:56:11 +00:00
parent 40a60f9f46
commit 35478c5e10
2 changed files with 11 additions and 5 deletions

View File

@ -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

View File

@ -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.";