diff --git a/fhem/FHEM/98_structure.pm b/fhem/FHEM/98_structure.pm index 07abdc05e..63361397e 100755 --- a/fhem/FHEM/98_structure.pm +++ b/fhem/FHEM/98_structure.pm @@ -45,8 +45,6 @@ structure_Initialize($) "clientstate_behavior:relative,relativeKnown,absolute,last ". $readingFnAttributes; - addToAttrList("structexclude"); - my %ahash = ( Fn=>"CommandAddStruct", Hlp=>" ,add to " ); $cmds{addstruct} = \%ahash; @@ -71,14 +69,15 @@ structure_Define($$) my $modname = shift(@a); my $stype = shift(@a); - addToAttrList($stype); - addToAttrList($stype . "_map"); $hash->{ATTR} = $stype; my %list; foreach my $a (@a) { foreach my $d (devspec2array($a)) { $list{$d} = 1; + addToDevAttrList($d, $stype); + addToDevAttrList($d, $stype . "_map"); + addToDevAttrList($d, "structexclude"); } } $hash->{CONTENT} = \%list; diff --git a/fhem/fhem.pl b/fhem/fhem.pl index 598bbd54d..7fbc45877 100755 --- a/fhem/fhem.pl +++ b/fhem/fhem.pl @@ -91,6 +91,7 @@ sub WakeUpFn($); sub WriteStatefile(); sub XmlEscape($); sub addEvent($$); +sub addToDevAttrList($$); sub addToAttrList($); sub addToWritebuffer($$@); sub attrSplit($); @@ -3167,19 +3168,25 @@ AddDuplicate($$) # Add an attribute to the userattr list, if not yet present sub -addToAttrList($) +addToDevAttrList($$) { - my $arg = shift; + my ($dev,$arg) = @_; my $ua = ""; - $ua = $attr{global}{userattr} if($attr{global}{userattr}); + $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 /); - $attr{global}{userattr} = join(" ", sort keys %hash); + $attr{$dev}{userattr} = join(" ", sort keys %hash); +} + +sub +addToAttrList($) +{ + addToDevAttrList("global", @_); } sub