From 876c36700f070d824d6b817da36c7546e9c302af Mon Sep 17 00:00:00 2001 From: LeonGaultier Date: Wed, 12 Sep 2018 06:40:06 +0000 Subject: [PATCH] 74_XiaomiBTLESens: fix bug in disabledForInterval (Forum #835350) git-svn-id: https://svn.fhem.de/fhem/trunk@17328 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/74_XiaomiBTLESens.pm | 11 ++++------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 7129afb42..147561d6b 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. + - bugfix: 74_XiaomiBTLESens: fix bug in disabledForInterval (Forum #835350) - change: 88_HMCCU: New release - feature: 93_DbLog: 3.11.0, function reduceLog[Nbl] syntax extended to limit days to reduce (pls. see commandref for details) diff --git a/fhem/FHEM/74_XiaomiBTLESens.pm b/fhem/FHEM/74_XiaomiBTLESens.pm index 47ccb947b..e70b3a443 100644 --- a/fhem/FHEM/74_XiaomiBTLESens.pm +++ b/fhem/FHEM/74_XiaomiBTLESens.pm @@ -50,7 +50,7 @@ eval "use Blocking;1" or $missingModul .= "Blocking "; #use Data::Dumper; only for Debugging -my $version = "2.2.0"; +my $version = "2.2.2"; @@ -170,7 +170,6 @@ sub XiaomiBTLESens_Define($$) { CommandAttr(undef,$name . ' room XiaomiBTLESens') if( AttrVal($name,'room','none') eq 'none' ); Log3 $name, 3, "XiaomiBTLESens ($name) - defined with BTMAC $hash->{BTMAC}"; - Log3 $name, 1, "XiaomiBTLESens ($name) - readings battery and batteryLevel a deprecated and will be remove in future"; $modules{XiaomiBTLESens}{defptr}{$hash->{BTMAC}} = $hash; return undef; @@ -216,7 +215,7 @@ sub XiaomiBTLESens_Attr(@) { return "check disabledForIntervals Syntax HH:MM-HH:MM or 'HH:MM-HH:MM HH:MM-HH:MM ...'" unless($attrVal =~ /^((\d{2}:\d{2})-(\d{2}:\d{2})\s?)+$/); Log3 $name, 3, "XiaomiBTLESens ($name) - disabledForIntervals"; - readingsSingleUpdate ( $hash, "state", "disabled", 1 ); + XiaomiBTLESens_stateRequest($hash); } elsif( $cmd eq "del" ) { @@ -277,7 +276,6 @@ sub XiaomiBTLESens_Notify($$) { or grep /^DELETEATTR.$name.interval$/,@{$events} or grep /^DELETEATTR.$name.model$/,@{$events} or grep /^ATTR.$name.model.+/,@{$events} - or grep /resetBatteryTimestamp$/,@{$events} or grep /^ATTR.$name.interval.[0-9]+/,@{$events}) and $devname eq 'global') or grep /^resetBatteryTimestamp$/,@{$events}) and $init_done or ((grep /^INITIALIZED$/,@{$events} @@ -338,7 +336,7 @@ sub XiaomiBTLESens_stateRequestTimer($) { RemoveInternalTimer($hash); XiaomiBTLESens_stateRequest($hash); - InternalTimer( gettimeofday()+$hash->{INTERVAL}+int(rand(90)), "XiaomiBTLESens_stateRequestTimer", $hash ); + InternalTimer( gettimeofday()+$hash->{INTERVAL}+int(rand(300)), "XiaomiBTLESens_stateRequestTimer", $hash ); Log3 $name, 4, "XiaomiBTLESens ($name) - stateRequestTimer: Call Request Timer"; } @@ -478,8 +476,7 @@ sub XiaomiBTLESens_ExecGatttool_Run($) { my $grepGatttool; my $gatttoolCmdlineStaticEscaped = CometBlueBTLE_CmdlinePreventGrepFalsePositive("gatttool -i $hci -b $mac"); - #$grepGatttool = qx(ps ax| grep -E \'gatttool -i $hci -b $mac\' | grep -v grep) if($sshHost eq 'none'); - #$grepGatttool = qx(ssh $sshHost 'ps ax| grep -E "gatttool -i $hci -b $mac" | grep -v grep') if($sshHost ne 'none'); + $grepGatttool = qx(ps ax| grep -E \'$gatttoolCmdlineStaticEscaped\') if($sshHost eq 'none'); $grepGatttool = qx(ssh $sshHost 'ps ax| grep -E "$gatttoolCmdlineStaticEscaped"') if($sshHost ne 'none');