2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 03:06:37 +00:00

fhem.pl: delFromDevAttrList from CoolTux (Forum #90698)

git-svn-id: https://svn.fhem.de/fhem/trunk@17235 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2018-08-30 19:38:48 +00:00
parent 1c6a463f3a
commit e7eda90b79

View File

@ -3958,6 +3958,24 @@ addToDevAttrList($$)
$attr{$dev}{userattr} = join(" ", sort keys %hash);
}
# The counterpart: delete it.
sub
delFromDevAttrList($$)
{
my ($dev,$arg) = @_;
my $ua = $attr{$dev}{userattr};
$ua = "" if(!$ua);
my %hash = map { ($_ => 1) }
grep { " $arg " !~ m/ $_ / }
split(" ", "$ua $arg");
$attr{$dev}{userattr} = join(" ", sort keys %hash);
delete $attr{$dev}{userattr}
if(!keys %hash && defined($attr{$dev}{userattr}));
map { delete $attr{$dev}{$_} } split(" ", $arg);
}
sub
addToAttrList($)
{