From 6d249654056af7c779c8756a33ae6d11a024aa91 Mon Sep 17 00:00:00 2001
From: Beta-User <>
Date: Sat, 26 Jun 2021 05:02:53 +0000
Subject: [PATCH] 98_RandomTimer: cref fixes; 'use' cleanup
git-svn-id: https://svn.fhem.de/fhem/trunk@24684 2b470e98-0d58-463d-a4d8-8e2adae1ed80
---
fhem/FHEM/98_RandomTimer.pm | 37 +++++++++++++++++++------------------
1 file changed, 19 insertions(+), 18 deletions(-)
diff --git a/fhem/FHEM/98_RandomTimer.pm b/fhem/FHEM/98_RandomTimer.pm
index 023ee3c7a..5396622b7 100644
--- a/fhem/FHEM/98_RandomTimer.pm
+++ b/fhem/FHEM/98_RandomTimer.pm
@@ -31,7 +31,8 @@ use utf8;
use Time::HiRes qw(gettimeofday);
use Time::Local qw(timelocal_nocheck);
use List::Util qw(max);
-use GPUtils qw(GP_Import GP_Export);
+use POSIX qw(strftime);
+use GPUtils qw(GP_Import);
## Import der FHEM Funktionen
#-- Run before package compilation
@@ -62,7 +63,6 @@ BEGIN {
perlSyntaxCheck
SemicolonEscape
FmtDateTime
- strftime
GetTimeSpec
CommandDelete
stacktrace )
@@ -678,11 +678,11 @@ __END__
=begin html
-
+
RandomTimer
-
+
Define
@@ -757,30 +757,30 @@ __END__
-
+
Set
-
+
set <name> execNow
This will force the RandomTimer device to immediately execute the next switch instead of waiting untill timeToSwitch has passed. Use this in case you want immediate reaction on changes of reading values factored in disableCond. As RandomTimer itself will not be notified about any event at all, you'll need an additional event handler like notify that listens to relevant events and issues the "execNow" command towards your RandomTimer device(s).
NOTE: If the RandomTimer is disabled by attribute, this will not have any effect (different to set <name> active
.)
-
+
set <name> active
Same effect than execNow, but will also delete a disable attribute if set.
-
+
set <name> inactive
Temporarily disable the RandomTimer w/o setting disable attribute. When set the next switch will be immediately executed.
-
+
Attributes
- -
+
-
disableCond
The default behavior of a RandomTimer is, that it works. To set the Randomtimer out of work, you can specify in the disableCond attibute a condition in perlcode that must evaluate to true. The Condition must be put into round brackets. The best way is to define a function in 99_utils.
@@ -795,12 +795,12 @@ __END__
- -
+
-
forceStoptimeSameDay
When timespec_start is later then timespec_stop, it forces the timespec_stop to end on the current day instead of the next day. See forum post for use case.
- -
+
-
keepDeviceAlive
The default behavior of a RandomTimer is, that it shuts down the device after stoptime is reached. The keepDeviceAlive attribute changes the behavior. If set, the device status is not changed when the stoptime is reached.
@@ -810,7 +810,7 @@ __END__
- -
+
-
disableCondCmd
In case the disable condition becomes true while a RandomTimer is already running, by default the same action is executed as when stoptime is reached (see keepDeviceAlive attribute). Setting the disableCondCmd attribute changes this as follows: "none" will lead to no action, "offCmd" means "use off command", "onCmd" will lead to execution of the "on command". Delete the attribute to get back to default behaviour.
@@ -819,11 +819,12 @@ __END__
attr ZufallsTimerZ disableCondCmd offCmd
- -
+
-
disabledForIntervals
See commandref for at - disabledForIntervals
- -
+
+ -
onCmd, offCmd
Setting the on-/offCmd changes the command sent to the device. Standard is: "set <device> on". The device can be specified by a @.
@@ -853,7 +854,7 @@ __END__
NOTE: From $featurelevel 6.1 on or if attribute offState is set, the funktion ReadingsVal(<device>,"state",undef) will be used instead of Value(). If "state" of the device exactly matches the regex provided in the attribute "offState" or lowercase of "state" contains a part matching to "off", device will be considered to be "off" (or "on" in all other cases respectively).
- -
+
-
offState
Setting this attribute, evaluation of on of will use ReadingsVal(<device>,"state",undef) instead of Value(). The attribute value will be used as regex, so e.g. also "dim00" beside "off" may be considered as indication the device is "off". You may use an optional second parameter (space separated) to check a different reading, e.g. for a HUEDevice-group "0 any_on" might be usefull.
NOTE: This will be default behaviour starting with featurelevel 6.1.
@@ -865,13 +866,13 @@ __END__
- -
+
-
runonce
Deletes the RandomTimer device after timespec_stop is reached.
- -
+
-
switchmode
Setting the switchmode you can influence the behavior of switching on/off. The parameter has the Format 999/999 and the default ist 800/200. The values are in "per mill". The first parameter sets the value of the probability that the device will be switched on when the device is off. The second parameter sets the value of the probability that the device will be switched off when the device is on.