2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-16 10:46:03 +00:00

set state on disable

git-svn-id: https://svn.fhem.de/fhem/trunk@1780 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2012-08-01 12:38:12 +00:00
parent 05e8294346
commit 18589c7776

View File

@ -91,6 +91,7 @@ autocreate_Initialize($)
my ($hash) = @_;
$hash->{DefFn} = "autocreate_Define";
$hash->{NotifyFn} = "autocreate_Notify";
$hash->{AttrFn} = "autocreate_Attr";
$hash->{AttrList}= "loglevel:0,1,2,3,4,5,6 " .
"autosave filelog device_room weblink weblink_room " .
"disable ignoreTypes";
@ -454,4 +455,23 @@ NEXTDEVICE:
return ($scan ? $ret : undef);
}
###################################
sub
autocreate_Attr(@)
{
my @a = @_;
my $do = 0;
if($a[0] eq "set" && $a[2] eq "disable") {
$do = (!defined($a[3]) || $a[3]) ? 1 : 2;
}
$do = 2 if($a[0] eq "del" && (!$a[2] || $a[2] eq "disable"));
return if(!$do);
$defs{$a[1]}{STATE} = ($do == 1 ? "disabled" : "active");
return undef;
}
1;