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->{DefFn} = "watchdog_Define";
|
||||||
$hash->{UndefFn} = "watchdog_Undef";
|
$hash->{UndefFn} = "watchdog_Undef";
|
||||||
$hash->{NotifyFn} = "watchdog_Notify";
|
$hash->{NotifyFn} = "watchdog_Notify";
|
||||||
$hash->{AttrList} = "disable:0,1 disabledForIntervals ".
|
$hash->{AttrList} = "disable:0,1 disabledForIntervals execOnActivate ".
|
||||||
"regexp1WontReactivate:0,1 addStateEvent:0,1";
|
"regexp1WontReactivate:0,1 addStateEvent:0,1";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ watchdog_Trigger($)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Log3 $name, 3, "Watchdog $name triggered";
|
Log3 $name, 3, "Watchdog $name triggered";
|
||||||
my $exec = SemicolonEscape($watchdog->{CMD});;
|
my $exec = SemicolonEscape($watchdog->{CMD});
|
||||||
$watchdog->{STATE} = "triggered";
|
$watchdog->{STATE} = "triggered";
|
||||||
|
|
||||||
$watchdog->{READINGS}{Triggered}{TIME} = TimeNow();
|
$watchdog->{READINGS}{Triggered}{TIME} = TimeNow();
|
||||||
@@ -154,7 +154,11 @@ watchdog_Activate($)
|
|||||||
my $nt = gettimeofday() + $watchdog->{TO};
|
my $nt = gettimeofday() + $watchdog->{TO};
|
||||||
$watchdog->{STATE} = "Next: " . FmtTime($nt);
|
$watchdog->{STATE} = "Next: " . FmtTime($nt);
|
||||||
RemoveInternalTimer($watchdog);
|
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
|
sub
|
||||||
@@ -180,7 +184,7 @@ watchdog_Undef($$)
|
|||||||
<ul>
|
<ul>
|
||||||
<code>define <name> watchdog <regexp1> <timespec> <regexp2> <command></code><br>
|
<code>define <name> watchdog <regexp1> <timespec> <regexp2> <command></code><br>
|
||||||
<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
|
event matching <regexp1> no event matching <regexp2> is
|
||||||
received.<br>
|
received.<br>
|
||||||
The syntax for <regexp1> and <regexp2> is the same as the
|
The syntax for <regexp1> and <regexp2> is the same as the
|
||||||
@@ -243,10 +247,14 @@ watchdog_Undef($$)
|
|||||||
<ul>
|
<ul>
|
||||||
<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="regexp1WontReactivate">regexp1WontReactivate</a><br>
|
<li><a name="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>
|
||||||
</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>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -267,7 +275,7 @@ watchdog_Undef($$)
|
|||||||
<regexp2> <command></code><br>
|
<regexp2> <command></code><br>
|
||||||
<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
|
Ereignisses <regexp1> nicht innerhalb von <timespec> ein
|
||||||
<regexp2> Ereignis empfangen wird.<br>
|
<regexp2> Ereignis empfangen wird.<br>
|
||||||
|
|
||||||
@@ -349,8 +357,12 @@ watchdog_Undef($$)
|
|||||||
<li><a name="regexp1WontReactivate">regexp1WontReactivate</a><br>
|
<li><a name="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.
|
das verhindern.</li>
|
||||||
</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>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
Reference in New Issue
Block a user