mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-01 20:20:10 +00:00
watchdog.pm: add completeOnDisabled attribute (Forum #127872)
git-svn-id: https://svn.fhem.de/fhem/trunk@26108 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
280a570a47
commit
9e5b261e50
@ -22,6 +22,7 @@ watchdog_Initialize($)
|
|||||||
activateOnStart:1,0
|
activateOnStart:1,0
|
||||||
addStateEvent:1,0
|
addStateEvent:1,0
|
||||||
autoRestart:1,0
|
autoRestart:1,0
|
||||||
|
completeOnDisabled:1,0
|
||||||
disable:1,0
|
disable:1,0
|
||||||
disabledForIntervals
|
disabledForIntervals
|
||||||
execOnReactivate
|
execOnReactivate
|
||||||
@ -59,6 +60,20 @@ watchdog_reset($)
|
|||||||
setReadingsVal($watchdog, "Reset", "reset", TimeNow());
|
setReadingsVal($watchdog, "Reset", "reset", TimeNow());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub
|
||||||
|
watchdog_isDisabled($)
|
||||||
|
{
|
||||||
|
my ($name) = @_;
|
||||||
|
|
||||||
|
my $state = $defs{$name}{STATE};
|
||||||
|
|
||||||
|
if(IsDisabled($name) || $defs{$name}{STATE} eq "inactive") {
|
||||||
|
return 0 if(AttrVal($name, "completeOnDisabled", 0) && $state =~ m/Next:/);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
# defined watchme watchdog reg1 timeout reg2 command
|
# defined watchme watchdog reg1 timeout reg2 command
|
||||||
sub
|
sub
|
||||||
@ -123,7 +138,7 @@ watchdog_Notify($$)
|
|||||||
my ($watchdog, $dev) = @_;
|
my ($watchdog, $dev) = @_;
|
||||||
|
|
||||||
my $ln = $watchdog->{NAME};
|
my $ln = $watchdog->{NAME};
|
||||||
return "" if(IsDisabled($ln) || $watchdog->{STATE} eq "inactive");
|
return "" if(watchdog_isDisabled($ln));
|
||||||
my $dontReAct = AttrVal($ln, "regexp1WontReactivate", 0);
|
my $dontReAct = AttrVal($ln, "regexp1WontReactivate", 0);
|
||||||
my $re2act = AttrVal($ln, "regexp2WillReactivate", 0);
|
my $re2act = AttrVal($ln, "regexp2WillReactivate", 0);
|
||||||
|
|
||||||
@ -187,7 +202,7 @@ watchdog_Trigger($)
|
|||||||
my ($watchdog) = @_;
|
my ($watchdog) = @_;
|
||||||
my $name = $watchdog->{NAME};
|
my $name = $watchdog->{NAME};
|
||||||
|
|
||||||
if(IsDisabled($name) || $watchdog->{STATE} eq "inactive") {
|
if(watchdog_isDisabled($name)) {
|
||||||
watchdog_reset($watchdog);
|
watchdog_reset($watchdog);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -299,12 +314,12 @@ watchdog_Set($@)
|
|||||||
=item summary_DE führt Befehl aus, falls innerhalb des Timeouts kein Event empfangen wurde
|
=item summary_DE führt Befehl aus, falls innerhalb des Timeouts kein Event empfangen wurde
|
||||||
=begin html
|
=begin html
|
||||||
|
|
||||||
<a name="watchdog"></a>
|
<a id="watchdog"></a>
|
||||||
<h3>watchdog</h3>
|
<h3>watchdog</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<a name="watchdogdefine"></a>
|
<a id="watchdog-define"></a>
|
||||||
<b>Define</b>
|
<b>Define</b>
|
||||||
<ul>
|
<ul>
|
||||||
<code>define <name> watchdog <regexp1> <timespec> <regexp2> <command></code><br>
|
<code>define <name> watchdog <regexp1> <timespec> <regexp2> <command></code><br>
|
||||||
@ -367,7 +382,7 @@ watchdog_Set($@)
|
|||||||
<br>
|
<br>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<a name="watchdogset"></a>
|
<a id="watchdog-set"></a>
|
||||||
<b>Set </b>
|
<b>Set </b>
|
||||||
<ul>
|
<ul>
|
||||||
<li>inactive<br>
|
<li>inactive<br>
|
||||||
@ -382,13 +397,13 @@ watchdog_Set($@)
|
|||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<a name="watchdogget"></a>
|
<a id="watchdog-get"></a>
|
||||||
<b>Get</b> <ul>N/A</ul><br>
|
<b>Get</b> <ul>N/A</ul><br>
|
||||||
|
|
||||||
<a name="watchdogattr"></a>
|
<a id="watchdog-attr"></a>
|
||||||
<b>Attributes</b>
|
<b>Attributes</b>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a name="watchdogactivateOnStart">activateOnStart</a><br>
|
<li><a id="watchdog-attr-activateOnStart">activateOnStart</a><br>
|
||||||
if set, the watchdog will be activated after a FHEM start if appropriate,
|
if set, the watchdog will be activated after a FHEM start if appropriate,
|
||||||
determined by the Timestamp of the Activated and the Triggered readings.
|
determined by the Timestamp of the Activated and the Triggered readings.
|
||||||
Note: since between shutdown and startup events may be missed, this
|
Note: since between shutdown and startup events may be missed, this
|
||||||
@ -399,12 +414,12 @@ watchdog_Set($@)
|
|||||||
<li><a href="#disable">disable</a></li>
|
<li><a href="#disable">disable</a></li>
|
||||||
<li><a href="#disabledForIntervals">disabledForIntervals</a></li>
|
<li><a href="#disabledForIntervals">disabledForIntervals</a></li>
|
||||||
|
|
||||||
<li><a name="watchdogregexp1WontReactivate">regexp1WontReactivate</a><br>
|
<li><a id="watchdog-attr-regexp1WontReactivate">regexp1WontReactivate</a><br>
|
||||||
When a watchdog is active, a second event matching regexp1 will
|
When a watchdog is active, a second event matching regexp1 will
|
||||||
normally reset the timeout. Set this attribute to prevents this.
|
normally reset the timeout. Set this attribute to prevents this.
|
||||||
</li><br>
|
</li><br>
|
||||||
|
|
||||||
<li><a name="watchdogregexp2WillReactivate">regexp2WillReactivate</a><br>
|
<li><a id="watchdog-attr-regexp2WillReactivate">regexp2WillReactivate</a><br>
|
||||||
Normally after an event matching regexp2 ist received, the watchdog is
|
Normally after an event matching regexp2 ist received, the watchdog is
|
||||||
waiting for an event matching regexp1 to start the countdown. If this
|
waiting for an event matching regexp1 to start the countdown. If this
|
||||||
attribute set to 1 (the default 0), then after receivig an event
|
attribute set to 1 (the default 0), then after receivig an event
|
||||||
@ -412,15 +427,19 @@ watchdog_Set($@)
|
|||||||
regexp2 are identical, or regexp2 is ., then this behavior is default.
|
regexp2 are identical, or regexp2 is ., then this behavior is default.
|
||||||
</li><br>
|
</li><br>
|
||||||
|
|
||||||
<li><a href="#execOnReactivate">execOnReactivate</a>
|
<li><a id="watchdog-attr-execOnReactivate">execOnReactivate</a><br>
|
||||||
If set, its value will be executed as a FHEM command when the watchdog is
|
If set, its value will be executed as a FHEM command when the watchdog is
|
||||||
reactivated (after triggering) by receiving an event matching regexp1.
|
reactivated (after triggering) by receiving an event matching regexp1.
|
||||||
</li><br>
|
</li><br>
|
||||||
|
|
||||||
<li><a href="#autoRestart">autoRestart</a>
|
<li><a id="watchdog-attr-autoRestart">autoRestart</a><br>
|
||||||
When the watchdog has triggered it will be automatically re-set to state
|
When the watchdog has triggered it will be automatically re-set to state
|
||||||
defined again (waiting for regexp1) if this attribute is set to 1.
|
defined again (waiting for regexp1) if this attribute is set to 1.</li><br>
|
||||||
</li>
|
|
||||||
|
<li><a id="watchdog-attr-completeOnDisabled">completeOnDisabled</a><br>
|
||||||
|
If set (to 1), the watchdog will complete normally, even if at completion
|
||||||
|
time disabled is active (see disabledForIntervals). </li><br>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
</ul>
|
</ul>
|
||||||
@ -429,12 +448,12 @@ watchdog_Set($@)
|
|||||||
|
|
||||||
=begin html_DE
|
=begin html_DE
|
||||||
|
|
||||||
<a name="watchdog"></a>
|
<a id="watchdog"></a>
|
||||||
<h3>watchdog</h3>
|
<h3>watchdog</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<a name="watchdogdefine"></a>
|
<a id="watchdog-define"></a>
|
||||||
<b>Define</b>
|
<b>Define</b>
|
||||||
<ul>
|
<ul>
|
||||||
<code>define <name> watchdog <regexp1> <timespec>
|
<code>define <name> watchdog <regexp1> <timespec>
|
||||||
@ -511,7 +530,7 @@ watchdog_Set($@)
|
|||||||
<br>
|
<br>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<a name="watchdogset"></a>
|
<a id="watchdog-set"></a>
|
||||||
<b>Set </b>
|
<b>Set </b>
|
||||||
<ul>
|
<ul>
|
||||||
<li>inactive<br>
|
<li>inactive<br>
|
||||||
@ -530,13 +549,13 @@ watchdog_Set($@)
|
|||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
|
||||||
<a name="watchdogget"></a>
|
<a id="watchdog-get"></a>
|
||||||
<b>Get</b> <ul>N/A</ul><br>
|
<b>Get</b> <ul>N/A</ul><br>
|
||||||
|
|
||||||
<a name="watchdogattr"></a>
|
<a id="watchdog-attr"></a>
|
||||||
<b>Attribute</b>
|
<b>Attribute</b>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a name="watchdogactivateOnStart">activateOnStart</a><br>
|
<li><a id="watchdog-attr-activateOnStart">activateOnStart</a><br>
|
||||||
Falls gesetzt, wird der Watchdog nach FHEM-Neustart aktiviert, je nach
|
Falls gesetzt, wird der Watchdog nach FHEM-Neustart aktiviert, je nach
|
||||||
Zeitstempel der Activated und Triggered Readings. Da zwischen Shutdown
|
Zeitstempel der Activated und Triggered Readings. Da zwischen Shutdown
|
||||||
und Neustart Events verlorengehen können, ist die Voreinstellung 0
|
und Neustart Events verlorengehen können, ist die Voreinstellung 0
|
||||||
@ -549,12 +568,12 @@ watchdog_Set($@)
|
|||||||
<li><a href="#disabledForIntervals">disabledForIntervals</a></li>
|
<li><a href="#disabledForIntervals">disabledForIntervals</a></li>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<li><a name="watchdogregexp1WontReactivate">regexp1WontReactivate</a><br>
|
<li><a id="watchdog-attr-regexp1WontReactivate">regexp1WontReactivate</a><br>
|
||||||
Wenn ein Watchdog aktiv ist, wird ein zweites Ereignis das auf regexp1
|
Wenn ein Watchdog aktiv ist, wird ein zweites Ereignis das auf regexp1
|
||||||
passt normalerweise den Timer zurücksetzen. Dieses Attribut wird
|
passt normalerweise den Timer zurücksetzen. Dieses Attribut wird
|
||||||
das verhindern.</li><br>
|
das verhindern.</li><br>
|
||||||
|
|
||||||
<li><a name="watchdogregexp2WillReactivate">regexp2WillReactivate</a><br>
|
<li><a id="watchdog-attr-regexp2WillReactivate">regexp2WillReactivate</a><br>
|
||||||
In der Voreinstellung wartet der Watchdog nach Empfang eines Events, der
|
In der Voreinstellung wartet der Watchdog nach Empfang eines Events, der
|
||||||
auf regexp2 matcht, wieder auf einem Event, was auf regexp1 matcht, um
|
auf regexp2 matcht, wieder auf einem Event, was auf regexp1 matcht, um
|
||||||
den Rückwärtszähler zu starten. Wenn dieses Attribut
|
den Rückwärtszähler zu starten. Wenn dieses Attribut
|
||||||
@ -563,15 +582,20 @@ watchdog_Set($@)
|
|||||||
gestartet. Falls regexp1 und regexp2 gleich sind, oder regexp2 ist .,
|
gestartet. Falls regexp1 und regexp2 gleich sind, oder regexp2 ist .,
|
||||||
dann ist dieses Verhalten die Voreinstellung.</li></br>
|
dann ist dieses Verhalten die Voreinstellung.</li></br>
|
||||||
|
|
||||||
<li><a href="#execOnReactivate">execOnReactivate</a>
|
<li><a id="watchdog-attr-execOnReactivate">execOnReactivate</a><br>
|
||||||
Falls gesetzt, wird der Wert des Attributes als FHEM Befehl
|
Falls gesetzt, wird der Wert des Attributes als FHEM Befehl
|
||||||
ausgeführt, wenn ein regexp1 Ereignis den Watchdog
|
ausgeführt, wenn ein regexp1 Ereignis den Watchdog
|
||||||
aktiviert nachdem er ausgelöst wurde.</li></br>
|
aktiviert nachdem er ausgelöst wurde.</li></br>
|
||||||
|
|
||||||
<li><a href="#autoRestart">autoRestart</a>
|
<li><a id="watchdog-attr-autoRestart">autoRestart</a><br>
|
||||||
Wenn dieses Attribut gesetzt ist, wird der Watchdog nach dem er
|
Wenn dieses Attribut gesetzt ist, wird der Watchdog nach dem er
|
||||||
getriggert wurde, automatisch wieder in den Zustand defined
|
getriggert wurde, automatisch wieder in den Zustand defined
|
||||||
gesetzt (Wartet also wieder auf Aktivierung durch regexp1)</li>
|
gesetzt (Wartet also wieder auf Aktivierung durch regexp1)</li><br>
|
||||||
|
|
||||||
|
<li><a id="watchdog-attr-completeOnDisabled">completeOnDisabled</a><br>
|
||||||
|
falls gesetzt (auf 1), wird ein aktiviertes (STATE Next:...) watchdog
|
||||||
|
auch dann ausgeführt, wenn zur Ausführungszeit disabled aktiv
|
||||||
|
ist (siehe disabledForIntervals).</li><br>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
@ -230,7 +230,7 @@ sub cfgDB_FileWrite;
|
|||||||
# IODev - attached to io device
|
# IODev - attached to io device
|
||||||
# CHANGED - Currently changed attributes of this device. Used by NotifyFn
|
# CHANGED - Currently changed attributes of this device. Used by NotifyFn
|
||||||
# VOLATILE- Set if the definition should be saved to the "statefile"
|
# VOLATILE- Set if the definition should be saved to the "statefile"
|
||||||
# NOTIFYDEV - if set, the notifyFn will only be called for this device
|
# NOTIFYDEV - if set, the NotifyFn will only be called for this device
|
||||||
|
|
||||||
use vars qw($addTimerStacktrace);# set to 1 by fhemdebug
|
use vars qw($addTimerStacktrace);# set to 1 by fhemdebug
|
||||||
use vars qw($auth_refresh);
|
use vars qw($auth_refresh);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user