91_watchdog.pm: change STATE when disabled (Forum #40584)
git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@9185 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -14,6 +14,7 @@ watchdog_Initialize($)
|
|||||||
|
|
||||||
$hash->{DefFn} = "watchdog_Define";
|
$hash->{DefFn} = "watchdog_Define";
|
||||||
$hash->{UndefFn} = "watchdog_Undef";
|
$hash->{UndefFn} = "watchdog_Undef";
|
||||||
|
$hash->{AttrFn} = "watchdog_Attr";
|
||||||
$hash->{NotifyFn} = "watchdog_Notify";
|
$hash->{NotifyFn} = "watchdog_Notify";
|
||||||
$hash->{AttrList} = "disable:0,1 disabledForIntervals execOnReactivate ".
|
$hash->{AttrList} = "disable:0,1 disabledForIntervals execOnReactivate ".
|
||||||
"regexp1WontReactivate:0,1 addStateEvent:0,1";
|
"regexp1WontReactivate:0,1 addStateEvent:0,1";
|
||||||
@@ -175,6 +176,23 @@ watchdog_Undef($$)
|
|||||||
return 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;
|
1;
|
||||||
|
|
||||||
=pod
|
=pod
|
||||||
|
|||||||
Reference in New Issue
Block a user