2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 16:56:54 +00:00

Another try at the watchdog problem.

git-svn-id: https://svn.fhem.de/fhem/trunk@1113 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2011-11-20 18:31:45 +00:00
parent e807860a9f
commit aa7112d032
2 changed files with 27 additions and 12 deletions

View File

@ -47,8 +47,13 @@ watchdog_Define($$)
$ntfy->{CMD} = $command;
$ntfy->{STATE} = ($re1 eq ".") ? "active" : "defined";
watchdog_Activate($ntfy) if($ntfy->{STATE} eq "active");
if($re1 eq ".") {
watchdog_Activate($ntfy)
} else {
$ntfy->{STATE} = "defined";
}
return undef;
}
@ -71,12 +76,15 @@ watchdog_Notify($$)
for (my $i = 0; $i < $max; $i++) {
my $s = $dev->{CHANGED}[$i];
$s = "" if(!defined($s));
my $dotTrigger = ($ln eq $n && $s eq "."); # trigger w .
my $dontReAct = AttrVal($ln, "regexp1WontReactivate", 0);
if($ntfy->{STATE} =~ m/Next:/) {
if($n =~ m/^$re2$/ || "$n:$s" =~ m/^$re2$/) {
RemoveInternalTimer($ntfy);
if($re1 eq $re2 || $re1 eq ".") {
if(($re1 eq $re2 || $re1 eq ".") && !$dontReAct) {
watchdog_Activate($ntfy);
return "";
@ -85,14 +93,20 @@ watchdog_Notify($$)
}
} elsif($n =~ m/^$re1$/ || "$n:$s" =~ m/^$re1$/) {
watchdog_Activate($ntfy) if(!$dontReAct);
}
}
} elsif($ntfy->{STATE} eq "defined") {
if($dotTrigger || # trigger w .
($n =~ m/^$re1$/ || "$n:$s" =~ m/^$re1$/)) {
watchdog_Activate($ntfy)
}
} elsif($dotTrigger) {
$ntfy->{STATE} = "defined"; # trigger w .
if(($ln eq $n && $s eq ".") || # trigger w .
(($n =~ m/^$re1$/ || "$n:$s" =~ m/^$re1$/) &&
!AttrVal($ln, "regexp1WontReactivate", 0))) {
watchdog_Activate($ntfy)
}
}
@ -130,5 +144,4 @@ watchdog_Undef($$)
return undef;
}
1;

View File

@ -7260,9 +7260,11 @@ href="http://www.elv.de/output/controller.aspx?cid=74&detail=10&detail2=29870">U
<li>if &lt;regexp2&gt; is SAME, then it will be the same as the first
regexp, and it will be reactivated, when it is received. This is
probably the normal operation.</li>
<li>trigger &lt;watchdogname&gt; . will activate/reactivate the
watchdog</li>
<li>generic watchdogs (one watchdog responsible for more devices) is
<li>trigger &lt;watchdogname&gt; . will activate the trigger if its state
is defined, and set it into state defined if its state is
triggered</li>
</ul>
<li>a generic watchdog (one watchdog responsible for more devices) is
currently not possible.</li>
</ul>