From a4e969cecee283c0c33bb5c01c9519bdc9b57ba5 Mon Sep 17 00:00:00 2001 From: rudolfkoenig Date: Wed, 21 Jan 2015 18:59:58 +0000 Subject: [PATCH] 98_structure.pm: behave correctly when the structure definition order is strange (Forum #32493) git-svn-id: https://svn.fhem.de/fhem/trunk@7652 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/98_structure.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/fhem/FHEM/98_structure.pm b/fhem/FHEM/98_structure.pm index 57f7eb712..820304512 100755 --- a/fhem/FHEM/98_structure.pm +++ b/fhem/FHEM/98_structure.pm @@ -66,7 +66,7 @@ structAdd($$) } else { addToDevAttrList($c, $attrList); - structAdd($c, $attrList) if($defs{$d}{TYPE} eq "structure"); + structAdd($c, $attrList) if($defs{$d} && $defs{$d}{TYPE} eq "structure"); } } delete $defs{$d}{INstructAdd}; @@ -89,12 +89,14 @@ structure_Define($$) $hash->{ATTR} = $stype; my %list; - my $attrList = "$stype ${stype}_map structexclude"; + my $aList = "$stype ${stype}_map structexclude"; foreach my $a (@a) { foreach my $d (devspec2array($a)) { $list{$d} = 1; - addToDevAttrList($d, $attrList); - structAdd($d, $attrList) if($defs{$d}{TYPE} eq "structure"); + if($init_done) { + addToDevAttrList($d, $aList); + structAdd($d, $aList) if($defs{$d} && $defs{$d}{TYPE} eq "structure"); + } } } $hash->{CONTENT} = \%list;