mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 18:59:33 +00:00
structure: move global userattr to device userattr (Forum #27451)
git-svn-id: https://svn.fhem.de/fhem/trunk@6664 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
49ef17cbfe
commit
8148975916
@ -45,8 +45,6 @@ structure_Initialize($)
|
|||||||
"clientstate_behavior:relative,relativeKnown,absolute,last ".
|
"clientstate_behavior:relative,relativeKnown,absolute,last ".
|
||||||
$readingFnAttributes;
|
$readingFnAttributes;
|
||||||
|
|
||||||
addToAttrList("structexclude");
|
|
||||||
|
|
||||||
my %ahash = ( Fn=>"CommandAddStruct",
|
my %ahash = ( Fn=>"CommandAddStruct",
|
||||||
Hlp=>"<structure> <devspec>,add <devspec> to <structure>" );
|
Hlp=>"<structure> <devspec>,add <devspec> to <structure>" );
|
||||||
$cmds{addstruct} = \%ahash;
|
$cmds{addstruct} = \%ahash;
|
||||||
@ -71,14 +69,15 @@ structure_Define($$)
|
|||||||
my $modname = shift(@a);
|
my $modname = shift(@a);
|
||||||
my $stype = shift(@a);
|
my $stype = shift(@a);
|
||||||
|
|
||||||
addToAttrList($stype);
|
|
||||||
addToAttrList($stype . "_map");
|
|
||||||
$hash->{ATTR} = $stype;
|
$hash->{ATTR} = $stype;
|
||||||
|
|
||||||
my %list;
|
my %list;
|
||||||
foreach my $a (@a) {
|
foreach my $a (@a) {
|
||||||
foreach my $d (devspec2array($a)) {
|
foreach my $d (devspec2array($a)) {
|
||||||
$list{$d} = 1;
|
$list{$d} = 1;
|
||||||
|
addToDevAttrList($d, $stype);
|
||||||
|
addToDevAttrList($d, $stype . "_map");
|
||||||
|
addToDevAttrList($d, "structexclude");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$hash->{CONTENT} = \%list;
|
$hash->{CONTENT} = \%list;
|
||||||
|
15
fhem/fhem.pl
15
fhem/fhem.pl
@ -91,6 +91,7 @@ sub WakeUpFn($);
|
|||||||
sub WriteStatefile();
|
sub WriteStatefile();
|
||||||
sub XmlEscape($);
|
sub XmlEscape($);
|
||||||
sub addEvent($$);
|
sub addEvent($$);
|
||||||
|
sub addToDevAttrList($$);
|
||||||
sub addToAttrList($);
|
sub addToAttrList($);
|
||||||
sub addToWritebuffer($$@);
|
sub addToWritebuffer($$@);
|
||||||
sub attrSplit($);
|
sub attrSplit($);
|
||||||
@ -3167,19 +3168,25 @@ AddDuplicate($$)
|
|||||||
|
|
||||||
# Add an attribute to the userattr list, if not yet present
|
# Add an attribute to the userattr list, if not yet present
|
||||||
sub
|
sub
|
||||||
addToAttrList($)
|
addToDevAttrList($$)
|
||||||
{
|
{
|
||||||
my $arg = shift;
|
my ($dev,$arg) = @_;
|
||||||
|
|
||||||
my $ua = "";
|
my $ua = "";
|
||||||
$ua = $attr{global}{userattr} if($attr{global}{userattr});
|
$ua = $attr{$dev}{userattr} if($attr{$dev}{userattr});
|
||||||
my @al = split(" ", $ua);
|
my @al = split(" ", $ua);
|
||||||
my %hash;
|
my %hash;
|
||||||
foreach my $a (@al) {
|
foreach my $a (@al) {
|
||||||
$hash{$a} = 1 if(" $AttrList " !~ m/ $a /); # Cleanse old ones
|
$hash{$a} = 1 if(" $AttrList " !~ m/ $a /); # Cleanse old ones
|
||||||
}
|
}
|
||||||
$hash{$arg} = 1 if(" $AttrList " !~ m/ $arg /);
|
$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
|
sub
|
||||||
|
Loading…
Reference in New Issue
Block a user