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

91_watchdog.pm: change STATE when disabled (Forum #40584)

git-svn-id: https://svn.fhem.de/fhem/trunk@9185 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2015-08-31 18:46:10 +00:00
parent 46edba43ea
commit 2474ca6965

View File

@ -14,6 +14,7 @@ watchdog_Initialize($)
$hash->{DefFn} = "watchdog_Define";
$hash->{UndefFn} = "watchdog_Undef";
$hash->{AttrFn} = "watchdog_Attr";
$hash->{NotifyFn} = "watchdog_Notify";
$hash->{AttrList} = "disable:0,1 disabledForIntervals execOnReactivate ".
"regexp1WontReactivate:0,1 addStateEvent:0,1";
@ -175,6 +176,23 @@ watchdog_Undef($$)
return undef;
}
sub
watchdog_Attr(@)
{
my ($cmd, $name, $attrName, $attrVal) = @_;
my $do = 0;
my $hash = $defs{$name};
if($cmd eq "set" && $attrName eq "disable") {
$do = (!defined($attrVal) || $attrVal) ? 1 : 2;
}
$do = 2 if($cmd eq "del" && (!$attrName || $attrName eq "disable"));
return if(!$do);
$hash->{STATE} = ($do == 1 ? "disabled" : "defined");
return undef;
}
1;
=pod