From 2b699b1128fcc3de82b9495ad6aea46dd1844164 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Sat, 14 Jan 2017 14:54:22 +0100 Subject: [PATCH] bugfix intervalForTimer --- 74_XiaomiFlowerSens.pm | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/74_XiaomiFlowerSens.pm b/74_XiaomiFlowerSens.pm index a399107..ea4e231 100644 --- a/74_XiaomiFlowerSens.pm +++ b/74_XiaomiFlowerSens.pm @@ -2,7 +2,7 @@ # # Developed with Kate # -# (c) 2016 Copyright: Marko Oldenburg (leongaultier at gmail dot com) +# (c) 2016-2017 Copyright: Marko Oldenburg (leongaultier at gmail dot com) # All rights reserved # # This script is free software; you can redistribute it and/or modify @@ -35,7 +35,7 @@ use POSIX; use JSON; use Blocking; -my $version = "0.2.10"; +my $version = "0.2.11"; @@ -129,7 +129,6 @@ sub XiaomiFlowerSens_Attr(@) { elsif( $cmd eq "del" ) { readingsSingleUpdate ( $hash, "state", "active", 1 ); - InternalTimer( gettimeofday()+int(rand(30)), "XiaomiFlowerSens_stateRequestTimer", $hash, 1 ); Log3 $name, 3, "Sub XiaomiFlowerSens ($name) - enabled"; } } @@ -142,7 +141,6 @@ sub XiaomiFlowerSens_Attr(@) { elsif( $cmd eq "del" ) { readingsSingleUpdate ( $hash, "state", "active", 1 ); - InternalTimer( gettimeofday()+int(rand(30)), "XiaomiFlowerSens_stateRequestTimer", $hash, 1 ); Log3 $name, 3, "Sub XiaomiFlowerSens ($name) - enabled"; } } @@ -200,12 +198,12 @@ sub XiaomiFlowerSens_stateRequestTimer($) { XiaomiFlowerSens($hash); - InternalTimer( gettimeofday()+$hash->{INTERVAL}+int(rand(300)), "XiaomiFlowerSens_stateRequestTimer", $hash, 1 ); - } else { readingsSingleUpdate ( $hash, "state", "disabled", 1 ); } + InternalTimer( gettimeofday()+$hash->{INTERVAL}+int(rand(300)), "XiaomiFlowerSens_stateRequestTimer", $hash, 1 ); + Log3 $name, 5, "Sub XiaomiFlowerSens ($name) - Request Timer wird aufgerufen"; }