2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 18:59:33 +00:00

98_structure.pm: fixing structure of structure problem (Forum #32493)

git-svn-id: https://svn.fhem.de/fhem/trunk@7645 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2015-01-20 20:38:03 +00:00
parent c7a071b235
commit 880eb16e6b

View File

@ -54,6 +54,23 @@ structure_Initialize($)
$cmds{delstruct} = \%dhash;
}
sub structAdd($$);
sub
structAdd($$)
{
my ($d, $attrList) = @_;
$defs{$d}{INstructAdd} = 1;
foreach my $c (keys %{$defs{$d}{CONTENT}}) {
if($defs{$c}{INstructAdd}) {
Log 1, "recursive structure definition"
} else {
addToDevAttrList($c, $attrList);
structAdd($c, $attrList) if($defs{$d}{TYPE} eq "structure");
}
}
delete $defs{$d}{INstructAdd};
}
#############################
sub
@ -72,12 +89,12 @@ structure_Define($$)
$hash->{ATTR} = $stype;
my %list;
my $attrList = "$stype ${stype}_map structexclude";
foreach my $a (@a) {
foreach my $d (devspec2array($a)) {
$list{$d} = 1;
addToDevAttrList($d, $stype);
addToDevAttrList($d, $stype . "_map");
addToDevAttrList($d, "structexclude");
addToDevAttrList($d, $attrList);
structAdd($d, $attrList) if($defs{$d}{TYPE} eq "structure");
}
}
$hash->{CONTENT} = \%list;