From e5a8fdc351dfcd3fc595ff1a615f56d0484cbad0 Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Fri, 27 Jan 2023 18:26:46 +0000 Subject: [PATCH] structure.pm: add filterEvents (Forum #131841) git-svn-id: https://svn.fhem.de/fhem/trunk@27133 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/98_structure.pm | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/fhem/FHEM/98_structure.pm b/fhem/FHEM/98_structure.pm index 87e6b44b7..2da4e8277 100644 --- a/fhem/FHEM/98_structure.pm +++ b/fhem/FHEM/98_structure.pm @@ -46,10 +46,11 @@ structure_Initialize($) async_delay clientstate_behavior:relative,relativeKnown,absolute,last clientstate_priority + considerDisabledMembers disable disabledForIntervals - considerDisabledMembers evaluateSetResult:1,0 + filterEvents:1,0 propagateAttr setStateIndirectly:1,0 setStructType:0,1 @@ -211,6 +212,21 @@ structure_Notify($$) return "" if (! exists $hash->{".memberHash"}->{$devName}); + if(AttrVal($me, "filterEvents", 0) && + AttrVal($devName, $devmap, 0)) { #131841 + my %re; + map { + my @val = split(":",$_); + $re{$val[0]} = 1 if(@val==1 || @val==3); + } attrSplit($attr{$devName}{$devmap}); + my @re = keys %re; + my $fnd; + map { + my $e = $_; map { $fnd = 1 if($e =~ m/^$_:/) } @re; + } @{deviceEvents($dev, 0)}; + return "" if(!$fnd); + } + my $behavior = AttrVal($me, "clientstate_behavior", "absolute"); my %clientstate; @@ -768,6 +784,14 @@ structure_Attr($@) compute the new status. + +
  • filterEvents
    + if set, and the device triggering the event has a struct_type map, the + only events (i.e. reading names) contained in the structure map will + trigger the structure. Note: only the readingName and + readingName:oldVal:newVal entries of the struct_type map are considered. +
  • +
  • propagateAttr <regexp>
    if the regexp matches the name of the attribute, then this attribute will @@ -1016,6 +1040,15 @@ structure_Attr($@) neuen Status auswerten soll.
  • + +
  • filterEvents
    + falls gesetzt, und das Event auslösende Gerät über ein + struct_type map verfügt, dann werden nur solche Events die + Strukturberechnung auslösen, die in diesem map enthalten sind.
    + Achtung: in struct_type map werden nur die readingName und + readingName:oldVal:newVal Einträge berücksichtigt. +
  • +
  • propagateAttr <regexp>
    Falls der Regexp auf den Namen des Attributes zutrifft, dann wird dieses