2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-16 04:36:02 +00:00

98_RandomTimer: cref fixes; 'use' cleanup

git-svn-id: https://svn.fhem.de/fhem/trunk@24684 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
Beta-User 2021-06-26 05:02:53 +00:00
parent e9073c7740
commit 6d24965405

View File

@ -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
<a name="RandomTimer"></a>
<a id="RandomTimer"></a>
<h3>RandomTimer</h3>
<div>
<ul>
<a name="RandomTimerdefine"></a>
<a id="RandomTimer-define"></a>
<b>Define</b>
<ul>
<code>
@ -757,30 +757,30 @@ __END__
</ul><br>
</ul>
<ul>
<a name="RandomTimerset"></a>
<a id="RandomTimer-set"></a>
<b>Set</b><br>
<ul>
<ul><a id="RandomTimer-set-execNow"></a>
<code>set &lt;name&gt; execNow</code>
<br>
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). <br>
NOTE: If the RandomTimer is disabled by attribute, this will not have any effect (different to <code>set &lt;name&gt; active</code>.)
</ul><br>
<ul>
<ul><a id="RandomTimer-set-active"></a>
<code>set &lt;name&gt; active</code>
<br>
Same effect than execNow, but will also delete a disable attribute if set.
</ul><br>
<ul>
<ul><a id="RandomTimer-set-inactive"></a>
<code>set &lt;name&gt; inactive</code>
<br>
Temporarily disable the RandomTimer w/o setting disable attribute. When set the next switch will be immediately executed.
</ul><br>
</ul>
<ul>
<a name="RandomTimerAttributes"></a>
<id name="RandomTimer-attr"></a>
<b>Attributes</b>
<ul>
<li>
<li><a id="RandomTimer-attr-disableCond"></a>
<code>disableCond</code><br>
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.<br>
<br>
@ -795,12 +795,12 @@ __END__
</ul>
</li>
<br>
<li>
<li><a id="RandomTimer-attr-forceStoptimeSameDay"></a>
<code>forceStoptimeSameDay</code><br>
When <b>timespec_start</b> is later then <b>timespec_stop</b>, it forces the <b>timespec_stop</b> to end on the current day instead of the next day. See <a href="https://forum.fhem.de/index.php/topic,72988.0.html" title="Random Timer in Verbindung mit Twilight, EIN-Schaltzeit nach AUS-Schaltzeit">forum post</a> for use case.<br>
</li>
<br>
<li>
<li><a id="RandomTimer-attr-keepDeviceAlive"></a>
<code>keepDeviceAlive</code><br>
The default behavior of a RandomTimer is, that it shuts down the device after stoptime is reached. The <b>keepDeviceAlive</b> attribute changes the behavior. If set, the device status is not changed when the stoptime is reached.<br>
<br>
@ -810,7 +810,7 @@ __END__
</ul>
</li>
<br>
<li>
<li><a id="RandomTimer-attr-disableCondCmd"></a>
<code>disableCondCmd</code><br>
In case the disable condition becomes true while a RandomTimer is already <b>running</b>, by default the same action is executed as when stoptime is reached (see keepDeviceAlive attribute). Setting the <b>disableCondCmd</b> 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.<br>
<br>
@ -819,11 +819,12 @@ __END__
<li><code>attr ZufallsTimerZ disableCondCmd offCmd</code></li>
</ul>
</li><br><br>
<li>
<li><a id="RandomTimer-attr-disabledForIntervals"></a>
<code>disabledForIntervals</code><br>
See <a href="#disabledForIntervals">commandref for at - disabledForIntervals</a>
</li><br>
<li>
<li><a id="RandomTimer-attr-onCmd"></a></li>
<li><a id="RandomTimer-attr-offCmd"></a>
<code>onCmd, offCmd</code><br>
Setting the on-/offCmd changes the command sent to the device. Standard is: "set &lt;device&gt; on". The device can be specified by a @.<br>
<br>
@ -853,7 +854,7 @@ __END__
</code>
NOTE: From $featurelevel 6.1 on or if attribute offState is set, the funktion ReadingsVal(&lt;device&gt;,"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).
</li>
<li>
<li><a id="RandomTimer-attr-offState"></a>
<code>offState</code><br>
Setting this attribute, evaluation of on of will use ReadingsVal(&lt;device&gt;,"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.
<br>NOTE: This will be default behaviour starting with featurelevel 6.1.
@ -865,13 +866,13 @@ __END__
</a>
</li>
<br>
<li>
<li><a id="RandomTimer-attr-runonce"></a>
<code>runonce</code><br>
Deletes the RandomTimer device after <b>timespec_stop</b> is reached.
<br>
</li>
<br>
<li>
<li><a id="RandomTimer-attr-switchmode"></a>
<code>switchmode</code><br>
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.<br>
<br>