diff --git a/fhem/FHEM/91_watchdog.pm b/fhem/FHEM/91_watchdog.pm
index e315f43a3..537b7da97 100755
--- a/fhem/FHEM/91_watchdog.pm
+++ b/fhem/FHEM/91_watchdog.pm
@@ -15,7 +15,7 @@ watchdog_Initialize($)
$hash->{DefFn} = "watchdog_Define";
$hash->{UndefFn} = "watchdog_Undef";
$hash->{NotifyFn} = "watchdog_Notify";
- $hash->{AttrList} = "disable:0,1 disabledForIntervals ".
+ $hash->{AttrList} = "disable:0,1 disabledForIntervals execOnActivate ".
"regexp1WontReactivate:0,1 addStateEvent:0,1";
}
@@ -137,7 +137,7 @@ watchdog_Trigger($)
}
Log3 $name, 3, "Watchdog $name triggered";
- my $exec = SemicolonEscape($watchdog->{CMD});;
+ my $exec = SemicolonEscape($watchdog->{CMD});
$watchdog->{STATE} = "triggered";
$watchdog->{READINGS}{Triggered}{TIME} = TimeNow();
@@ -154,7 +154,11 @@ watchdog_Activate($)
my $nt = gettimeofday() + $watchdog->{TO};
$watchdog->{STATE} = "Next: " . FmtTime($nt);
RemoveInternalTimer($watchdog);
- InternalTimer($nt, "watchdog_Trigger", $watchdog, 0)
+ InternalTimer($nt, "watchdog_Trigger", $watchdog, 0);
+
+ my $eoa = AttrVal($watchdog->{NAME}, "execOnActivate", undef);
+ return if(!$eoa);
+ AnalyzeCommandChain(undef, SemicolonEscape($eoa));
}
sub
@@ -180,7 +184,7 @@ watchdog_Undef($$)
define <name> watchdog <regexp1> <timespec> <regexp2> <command>
- Start an arbitrary fhem.pl command if after <timespec> receiving an
+ Start an arbitrary FHEM command if after <timespec> receiving an
event matching <regexp1> no event matching <regexp2> is
received.
The syntax for <regexp1> and <regexp2> is the same as the
@@ -243,10 +247,14 @@ watchdog_Undef($$)
- disable
- disabledForIntervals
+
- regexp1WontReactivate
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.
+
+ - execOnActivate
+ If set, its value will be executed as a FHEM command when the watchdog is
+ activated by receiving an event matching regexp1.
@@ -267,7 +275,7 @@ watchdog_Undef($$)
<regexp2> <command>
- Startet einen beliebigen fhem.pl Befehl wenn nach dem Empfang des
+ Startet einen beliebigen FHEM Befehl wenn nach dem Empfang des
Ereignisses <regexp1> nicht innerhalb von <timespec> ein
<regexp2> Ereignis empfangen wird.
@@ -347,10 +355,14 @@ watchdog_Undef($$)
disable
disabledForIntervals
regexp1WontReactivate
- Wenn ein Watchdog aktiv ist, wird ein zweites Ereignis das auf regexp1
- passt normalerweise den Timer zurücksetzen. Dieses Attribut wird
- das verhindern.
-
+ Wenn ein Watchdog aktiv ist, wird ein zweites Ereignis das auf regexp1
+ passt normalerweise den Timer zurücksetzen. Dieses Attribut wird
+ das verhindern.
+
+ execOnActivate
+ Falls gesetzt, wird der Wert des Attributes als FHEM Befehl
+ ausgeführt, wenn ein regexp1 Ereignis den Watchdog
+ aktiviert.