91_watchdog.pm: add execOnActivate attribute
git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@7074 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -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($$)
|
||||
<ul>
|
||||
<code>define <name> watchdog <regexp1> <timespec> <regexp2> <command></code><br>
|
||||
<br>
|
||||
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.<br>
|
||||
The syntax for <regexp1> and <regexp2> is the same as the
|
||||
@@ -243,10 +247,14 @@ watchdog_Undef($$)
|
||||
<ul>
|
||||
<li><a href="#disable">disable</a></li>
|
||||
<li><a href="#disabledForIntervals">disabledForIntervals</a></li>
|
||||
|
||||
<li><a name="regexp1WontReactivate">regexp1WontReactivate</a><br>
|
||||
When a watchdog is active, a second event matching regexp1 will
|
||||
normally reset the timeout. Set this attribute to prevents this.
|
||||
</li>
|
||||
normally reset the timeout. Set this attribute to prevents this.</li>
|
||||
|
||||
<li><a href="#execOnActivate">execOnActivate</a>
|
||||
If set, its value will be executed as a FHEM command when the watchdog is
|
||||
activated by receiving an event matching regexp1.</li>
|
||||
</ul>
|
||||
<br>
|
||||
</ul>
|
||||
@@ -267,7 +275,7 @@ watchdog_Undef($$)
|
||||
<regexp2> <command></code><br>
|
||||
<br>
|
||||
|
||||
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.<br>
|
||||
|
||||
@@ -347,10 +355,14 @@ watchdog_Undef($$)
|
||||
<li><a href="#disable">disable</a></li>
|
||||
<li><a href="#disabledForIntervals">disabledForIntervals</a></li>
|
||||
<li><a name="regexp1WontReactivate">regexp1WontReactivate</a><br>
|
||||
Wenn ein Watchdog aktiv ist, wird ein zweites Ereignis das auf regexp1
|
||||
passt normalerweise den Timer zurücksetzen. Dieses Attribut wird
|
||||
das verhindern.
|
||||
</li>
|
||||
Wenn ein Watchdog aktiv ist, wird ein zweites Ereignis das auf regexp1
|
||||
passt normalerweise den Timer zurücksetzen. Dieses Attribut wird
|
||||
das verhindern.</li>
|
||||
|
||||
<li><a href="#execOnActivate">execOnActivate</a>
|
||||
Falls gesetzt, wird der Wert des Attributes als FHEM Befehl
|
||||
ausgeführt, wenn ein regexp1 Ereignis den Watchdog
|
||||
aktiviert.</li>
|
||||
</ul>
|
||||
<br>
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user