From e5f4c9c07f13baca3a5d08a50ea3bcba59e214e7 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Tue, 18 Sep 2018 08:18:39 +0200 Subject: [PATCH] more little bugfixes --- 74_XiaomiBTLESens.pm | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/74_XiaomiBTLESens.pm b/74_XiaomiBTLESens.pm index 47ccb94..e70b3a4 100644 --- a/74_XiaomiBTLESens.pm +++ b/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');