From 9e5b261e507bf540340aec25b643b2bc4699840a Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Wed, 1 Jun 2022 08:25:03 +0000 Subject: [PATCH] watchdog.pm: add completeOnDisabled attribute (Forum #127872) git-svn-id: https://svn.fhem.de/fhem/trunk@26108 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/91_watchdog.pm | 74 ++++++++++++++++++++++++++-------------- fhem/fhem.pl | 2 +- 2 files changed, 50 insertions(+), 26 deletions(-) diff --git a/fhem/FHEM/91_watchdog.pm b/fhem/FHEM/91_watchdog.pm index 00b8afeaf..640db362b 100644 --- a/fhem/FHEM/91_watchdog.pm +++ b/fhem/FHEM/91_watchdog.pm @@ -22,6 +22,7 @@ watchdog_Initialize($) activateOnStart:1,0 addStateEvent:1,0 autoRestart:1,0 + completeOnDisabled:1,0 disable:1,0 disabledForIntervals execOnReactivate @@ -59,6 +60,20 @@ watchdog_reset($) 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 sub @@ -123,7 +138,7 @@ watchdog_Notify($$) my ($watchdog, $dev) = @_; my $ln = $watchdog->{NAME}; - return "" if(IsDisabled($ln) || $watchdog->{STATE} eq "inactive"); + return "" if(watchdog_isDisabled($ln)); my $dontReAct = AttrVal($ln, "regexp1WontReactivate", 0); my $re2act = AttrVal($ln, "regexp2WillReactivate", 0); @@ -187,7 +202,7 @@ watchdog_Trigger($) my ($watchdog) = @_; my $name = $watchdog->{NAME}; - if(IsDisabled($name) || $watchdog->{STATE} eq "inactive") { + if(watchdog_isDisabled($name)) { watchdog_reset($watchdog); return ""; } @@ -299,12 +314,12 @@ watchdog_Set($@) =item summary_DE führt Befehl aus, falls innerhalb des Timeouts kein Event empfangen wurde =begin html - +

watchdog

@@ -429,12 +448,12 @@ watchdog_Set($@) =begin html_DE - +

watchdog