From ab7a49e8e4311cdb424493a0a02d82d8f982b302 Mon Sep 17 00:00:00 2001 From: orti-otto <> Date: Sun, 18 Jun 2017 19:48:48 +0000 Subject: [PATCH] 98_RandomTimer: new attriute forceStoptimeSameDay to force stopping time of RT the same day. git-svn-id: https://svn.fhem.de/fhem/trunk@14538 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/98_RandomTimer.pm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fhem/FHEM/98_RandomTimer.pm b/fhem/FHEM/98_RandomTimer.pm index 696699c63..50651b082 100644 --- a/fhem/FHEM/98_RandomTimer.pm +++ b/fhem/FHEM/98_RandomTimer.pm @@ -50,7 +50,7 @@ sub RandomTimer_Initialize($) $hash->{DefFn} = "RandomTimer_Define"; $hash->{UndefFn} = "RandomTimer_Undef"; $hash->{AttrFn} = "RandomTimer_Attr"; - $hash->{AttrList} = "onCmd offCmd switchmode disable:0,1 disableCond runonce:0,1 keepDeviceAlive ". + $hash->{AttrList} = "onCmd offCmd switchmode disable:0,1 disableCond runonce:0,1 keepDeviceAlive forceStoptimeSameDay ". $readingFnAttributes; } ######################################################################## @@ -385,8 +385,11 @@ sub RandomTimer_stopZeitErmitteln ($$) { } else { $stopTime = RandomTimer_zeitBerechnen($now, $hour, $min, $sec); } - if ($hash->{helper}{startTime} > $stopTime) { - $stopTime = RandomTimer_addDays($stopTime, 1); + + if (!AttrVal($hash->{NAME}, "forceStoptimeSameDay", 0)) { + if ($hash->{helper}{startTime} > $stopTime) { + $stopTime = RandomTimer_addDays($stopTime, 1); + } } $hash->{helper}{stopTime} = $stopTime; $hash->{helper}{STOPTIME} = strftime("%d.%m.%Y %H:%M:%S",localtime($stopTime));