2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-20 13:26:02 +00:00

98_structure.pm: fix for FILTER command and substructure (Forum #70488)

git-svn-id: https://svn.fhem.de/fhem/trunk@14015 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2017-04-17 15:05:01 +00:00
parent 6ca16f40db
commit 8af0e02a43

View File

@ -88,6 +88,7 @@ structure_Define($$)
my $stype = shift(@a);
$hash->{ATTR} = $stype;
$hash->{CHANGEDCNT} = 0;
my %list;
my $aList = "$stype ${stype}_map structexclude";
@ -285,6 +286,7 @@ structure_Notify($$)
structure_getChangedDevice($dev->{NAME}), 0);
readingsBulkUpdate($hash, "state", $newState);
readingsEndUpdate($hash, 1);
$hash->{CHANGEDCNT}++;
delete($hash->{INNTFY});
undef;
@ -395,11 +397,17 @@ structure_Set($@)
my $sret;
if($filter) {
my $ret;
if(defined($defs{$list[0]}) && $defs{$list[0]}{TYPE} eq "structure") {
AnalyzeCommand(undef, "set $list[0] [$filter] ".
my $dl0 = $defs{$list[0]};
if(defined($dl0) && $dl0->{TYPE} eq "structure") {
my ($ostate,$ocnt) = ($dl0->{STATE}, $dl0->{CHANGEDCNT});
$ret = AnalyzeCommand(undef, "set $list[0] [$filter] ".
join(" ", @list[1..@list-1]) );
if($dl0->{CHANGEDCNT} == $ocnt) { # Forum #70488
$dl0->{STATE} = $dl0->{READINGS}{state}{VAL} = $ostate;
structure_Notify($hash, $dl0);
}
} else {
AnalyzeCommand(undef, "set $list[0]:$filter ".
$ret = AnalyzeCommand(undef, "set $list[0]:$filter ".
join(" ", @list[1..@list-1]) );
}
$sret .= $ret if( $ret );