mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 09:16:53 +00:00
fhem.pl: Fix addToAttrList (Forum #27451)
git-svn-id: https://svn.fhem.de/fhem/trunk@6672 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
9b06a6dbfe
commit
35f6656f75
17
fhem/fhem.pl
17
fhem/fhem.pl
@ -2063,7 +2063,7 @@ getAllAttr($)
|
||||
my $d = shift;
|
||||
return "" if(!$defs{$d});
|
||||
|
||||
my $list = $AttrList;
|
||||
my $list = $AttrList; # Global values
|
||||
$list .= " " . $modules{$defs{$d}{TYPE}}{AttrList}
|
||||
if($modules{$defs{$d}{TYPE}}{AttrList});
|
||||
$list .= " " . $attr{global}{userattr}
|
||||
@ -3172,21 +3172,18 @@ addToDevAttrList($$)
|
||||
{
|
||||
my ($dev,$arg) = @_;
|
||||
|
||||
my $ua = "";
|
||||
$ua = $attr{$dev}{userattr} if($attr{$dev}{userattr});
|
||||
my @al = split(" ", $ua);
|
||||
my %hash;
|
||||
foreach my $a (@al) {
|
||||
$hash{$a} = 1 if(" $AttrList " !~ m/ $a /); # Cleanse old ones
|
||||
}
|
||||
$hash{$arg} = 1 if(" $AttrList " !~ m/ $arg /);
|
||||
my $ua = $attr{$dev}{userattr};
|
||||
$ua = "" if(!$ua);
|
||||
my %hash = map { ($_ => 1) }
|
||||
grep { " $AttrList " !~ m/ $_ / }
|
||||
split(" ", "$ua $arg");
|
||||
$attr{$dev}{userattr} = join(" ", sort keys %hash);
|
||||
}
|
||||
|
||||
sub
|
||||
addToAttrList($)
|
||||
{
|
||||
addToDevAttrList("global", @_);
|
||||
addToDevAttrList("global", shift);
|
||||
}
|
||||
|
||||
sub
|
||||
|
Loading…
x
Reference in New Issue
Block a user