98_structure.pm: fixing structure of structure problem (Forum #32493)
git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@7645 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -54,6 +54,23 @@ structure_Initialize($)
|
|||||||
$cmds{delstruct} = \%dhash;
|
$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
|
sub
|
||||||
@@ -72,12 +89,12 @@ structure_Define($$)
|
|||||||
$hash->{ATTR} = $stype;
|
$hash->{ATTR} = $stype;
|
||||||
|
|
||||||
my %list;
|
my %list;
|
||||||
|
my $attrList = "$stype ${stype}_map structexclude";
|
||||||
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, $attrList);
|
||||||
addToDevAttrList($d, $stype . "_map");
|
structAdd($d, $attrList) if($defs{$d}{TYPE} eq "structure");
|
||||||
addToDevAttrList($d, "structexclude");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$hash->{CONTENT} = \%list;
|
$hash->{CONTENT} = \%list;
|
||||||
|
|||||||
Reference in New Issue
Block a user