diff --git a/FHEM/98_structure.pm b/FHEM/98_structure.pm
index 88112b80c..a125e3177 100755
--- a/FHEM/98_structure.pm
+++ b/FHEM/98_structure.pm
@@ -370,15 +370,24 @@ structure_Attr($@)
$list[1] eq "room" ||
$list[1] =~ m/clientstate/ ||
$list[1] eq "loglevel");
- my $hash = $defs{$list[0]};
+
+ my $me = $list[0];
+ my $hash = $defs{$me};
+
+ if($hash->{INATTR}) {
+ Log 1, "ERROR: endless loop detected in structure_Attr for $me";
+ next;
+ }
$hash->{INATTR} = 1;
+
my $ret = "";
foreach my $d (sort keys %{ $hash->{CONTENT} }) {
next if(!$defs{$d});
- if($defs{$d}{INATTR}) {
- Log 1, "ERROR: endless loop detected for $d in " . $hash->{NAME};
- next;
+ if($attr{$d} && $attr{$d}{structexclude}) {
+ my $se = $attr{$d}{structexclude};
+ next if("$me:$list[1]" =~ m/$se/);
}
+
$list[0] = $d;
my $sret;
if($type eq "del") {
@@ -392,7 +401,7 @@ structure_Attr($@)
}
}
delete($hash->{INATTR});
- Log GetLogLevel($hash->{NAME},5), "ATTR: $ret" if($ret);
+ Log GetLogLevel($me,4), "Stucture attr $type: $ret" if($ret);
return undef;
}
@@ -431,53 +440,7 @@ structure_Attr($@)
set house off
-
- The backward propagated status change from the devices to this structure
- works in two different ways.
-
Attribute clientstate_behavior
- absolute
-
- The structure status will changed to the common device status of all defined devices
- to this structure if all devices are identical. Otherwise the structure status is "undefined".
-
- relative
-
- You have to set the attribute "clientstate_priority" with all states of
- the defined devices to this structure in descending order. Each group are
- delemited by space. Each entry of one group are delimited by "pipe".
- The status represented by the structure is the first entry of each group
-
- last
-
- The structure state corresponds to the state of the device last changed.
-
-
Example:
-
- - attr kitchen clientstate_behavior relative
- - attr kitchen clientstate_priority An|On|on Aus|Off|off
- - attr house clientstate_priority Any_On|An All_Off|Aus
-
- In this example the status of kitchen is either on or off.
- The status of house is either Any_on or All_off.
-
- To group more devices from different types of devices you can define
- a clientstate redefining on each device with the attribute <struct_type>_map.
- For example the reading "A" of device door is "open" or "closed"
- and the state of device lamp1 should redefine from "on" to "An" and "off" to "Aus".
- A special case are devices with more than 1 input port (eg. OWSWITCH). The last
- example shows the attribute only with a value of "A". The propagated value of the device
- are depending only of port A with an unmodified state.
-
Example:
-
- - define door OWSWITCH <ROMID>
- - define lamp1 dummy
- - attr lamp1 cmdlist on off
- - define kitchen structure struct_kitchen lamp1 door
- - attr kitchen clientstate_priority An|on OK|Aus|off
- - attr lamp1 struct_kitchen_map on:An off:Aus
- - attr door struct_kitchen_map A:open:on A:closed:off
- - attr door2 struct_kitchen_map A
-
+
@@ -488,22 +451,92 @@ structure_Attr($@)
matches (as a regexp) the name of the current structure.
+
Get
get is not supported through a structure device.
+
Attributes
- - readingFnAttributes
+
+ - clientstate_behavior
+ The backward propagated status change from the devices to this structure
+ works in two different ways.
+
+ - absolute
+ The structure status will changed to the common device status of all
+ defined devices to this structure if all devices are identical.
+ Otherwise the structure status is "undefined".
+
+ - relative
+ See below for clientstate_priority.
+
+ - last
+ The structure state corresponds to the state of the device last changed.
+
+
+
+
+
+ - clientstate_priority
+ If clientstate_behavior is set to relative, then you have to set the
+ attribute "clientstate_priority" with all states of the defined devices
+ to this structure in descending order. Each group is delemited by
+ space. Each entry of one group is delimited by "pipe". The status
+ represented by the structure is the first entry of each group.
+ Example:
+
+ - attr kitchen clientstate_behavior relative
+ - attr kitchen clientstate_priority An|On|on Aus|Off|off
+ - attr house clientstate_priority Any_On|An All_Off|Aus
+
+ In this example the status of kitchen is either on or off. The status
+ of house is either Any_on or All_off.
+
+ To group more devices from different types of devices you can define
+ a clientstate redefining on each device with the attribute <struct_type>_map.
+ For example the reading "A" of device door is "open" or "closed"
+ and the state of device lamp1 should redefine from "on" to "An" and "off" to "Aus".
+ A special case is a device with more than 1 input port (eg. OWSWITCH). The last
+ example shows the attribute only with a value of "A". The propagated
+ value of the device depends only on port A with an unmodified state.
+
Example:
+
+ - define door OWSWITCH <ROMID>
+ - define lamp1 dummy
+ - attr lamp1 cmdlist on off
+ - define kitchen structure struct_kitchen lamp1 door
+ - attr kitchen clientstate_priority An|on OK|Aus|off
+ - attr lamp1 struct_kitchen_map on:An off:Aus
+ - attr door struct_kitchen_map A:open:on A:closed:off
+ - attr door2 struct_kitchen_map A
+
+
+
+
- structexclude
- exclude the device from set operations, see the set command above.
+ exclude the device from set/notify or attribute operations. For the set
+ and notify the value of structexclude must match the structure name,
+ for the attr/deleteattr commands ist must match the combination of
+ structure_name:attribute_name. Examples:
+
+
+ define kitchen structure room lamp1 lamp2
+ attr lamp1 structexclude kitchen
+ attr lamp1 structexclude kitchen:stateFormat
+
+
+
+
+ - readingFnAttributes
+
-
=end html
=begin html_DE
@@ -521,14 +554,14 @@ structure_Attr($@)
Devices erstellt um sie zu Gruppen zusammenzufassen. (Beispiel: im Haus alles ausschalten)
Die Liste der Devices die einer Struktur zugeordnet sind kann duch das Kommando
- addstruct / delstruct im laufenden Betrieb verändert werden. Es können
- sowohl einzelne Devices als auch Gruppen von Devices (TYPE=FS20) zugefügt werden.
- Jedes zugefügt Device erhält zwei neue Attribute <struct_type>=<name>
- sowie <struct_type>_map wenn es zu einer Struktur zugefügt wurde. Diese
+ addstruct / delstruct im laufenden Betrieb verändert werden. Es können
+ sowohl einzelne Devices als auch Gruppen von Devices (TYPE=FS20) zugefügt werden.
+ Jedes zugefügt Device erhält zwei neue Attribute <struct_type>=<name>
+ sowie <struct_type>_map wenn es zu einer Struktur zugefügt wurde. Diese
Attribute werden wieder automatisch entfernt, sobald das Device von der Struktur
entfernt wird.
- Eine Struktur kann ebenfalls zu einer anderen Struktur zugefügt werden. Somit
- können z b. kaskadierende Strukturen erstellt werden. (Z.b. KG,EG,OG, Haus)
+ Eine Struktur kann ebenfalls zu einer anderen Struktur zugefügt werden. Somit
+ können z b. kaskadierende Strukturen erstellt werden. (Z.b. KG,EG,OG, Haus)
Beispiel:
@@ -539,33 +572,59 @@ structure_Attr($@)
- set house off
+
- Der Status einer Struktur hängt von den Stati der zugefügten Devices ab.
- Dabei wird das propagieren der Stati der Devices in zwei Gruppen klassifiziert
- und mittels folgendem Attribut definiert:
+
+
+ Set
+
+ Jedes set Kommando wird an alle Devices dieser Struktur weitergegeben.
+ Aussnahme: das Attribut structexclude ist in einem Device definiert und
+ dessen Attributwert matched als Regexp zum Namen der aktuellen Struktur.
+
+
+
+ Get
+
+ Get wird im Structur-Device nicht unterstützt.
+
+
+
+ Attribute
+
+
+ - clientstate_behavior
+ Der Status einer Struktur hängt von den Stati der zugefügten Devices ab.
+ Dabei wird das propagieren der Stati der Devices in zwei Gruppen klassifiziert
+ und mittels diesem Attribut definiert:
+
+ - absolute
+
+ Die Struktur wird erst dann den Status der zugefügten Devices annehmen,
+ wenn alle Devices einen identischen Status vorweisen. Bei unterschiedlichen
+ Devictypen kann dies per Attribut <struct_type>_map pro Device
+ beinflusst werden. Andernfalls hat die Struktur den Status "undefined".
+
+ - relative
+
+ S.u. clientstate_priority.
+
+ - last
+
+ Die Struktur übernimmt den Status des zuletzt geänderten Gerätes.
+
+
-
Attribut clientstate_behavior
- - absolute
-
- Die Struktur wird erst dann den Status der zugefügten Devices annehmen,
- wenn alle Devices einen identischen Status vorweisen. Bei unterschiedlichen
- Devictypen kann dies per Attribut <struct_type>_map pro Device
- beinflusst werden. Andernfalls hat die Struktur den Status "undefined".
-
- - relative
-
+
+ - clientstate_priority
Wird die Struktur auf ein relatives Verhalten eingestellt, so wird die
- Priorität der Devicestati über das Attribut clientstate_priority
- beinflusst. Die Prioritäten sind in absteigender Reihenfolge anzugeben.
- Dabei können Gruppen mit identischer Priorität angegeben werden, um zb.
- unterschiedliche Devicetypen zusammenfassen zu können. Jede Gruppe wird durch
+ Priorität der Devicestati über das Attribut clientstate_priority
+ beinflusst. Die Prioritäten sind in absteigender Reihenfolge anzugeben.
+ Dabei können Gruppen mit identischer Priorität angegeben werden, um zb.
+ unterschiedliche Devicetypen zusammenfassen zu können. Jede Gruppe wird durch
Leerzeichen, jeder Eintrag pro Gruppe durch Pipe getrennt. Der Status der
Struktur ist der erste Eintrag in der entsprechenden Gruppe.
-
- - last
-
- Die Struktur übernimmt den Status des zuletzt geänderten Gerätes.
-
+
Beispiel:
- attr kueche clientstate_behavior relative
@@ -577,19 +636,19 @@ structure_Attr($@)
entweder den Status Any_on oder All_off an. Sobald ein
Device der Struktur haus den Status An hat nimmt die
Struktur den Status Any_On an. Um dagegen den Status
- All_off anzunehmen, müssen alle Devices dieser Struktur auf
+ All_off anzunehmen, müssen alle Devices dieser Struktur auf
off stehen.
- Um mehrere Devices unterschiedlicher Typen gruppieren zu können ist ein
+ Um mehrere Devices unterschiedlicher Typen gruppieren zu können ist ein
Status-Mapping auf jedem einzelnen Device mittels Attribut <struct_type>_map
- möglich.
+ möglich.
Im folgenden Beispiel nimmt das Reading "A" den Status "offen" oder "geschlossen"
an, und des Reading "state" von "lampe1" den Status "on" oder "off".
Die Struktur "kueche" reagiert nun auf "An" bzw "on" (Prio 1) bzw.
auf "OK", "Aus", "off". Der Status den diese Struktur schlussendlich annehmen kann
ist entweder "An" oder "OK".
Der Status des Devices lampe1 wird umdefiniert von "on" nach "An" bzw "off" nach "Aus".
- Das Device "tuer", welches vom Type "OWSWITCH" ist, bringt ausschließlich
+ Das Device "tuer", welches vom Type "OWSWITCH" ist, bringt ausschließlich
das Reading A in die Struktur ein welches von "open" nach "on" sowie "clesed"
nach "Aus" umdefiniert wird.
Die Struktur kueche wird folglich nur dann "An" ausgeben,
@@ -612,33 +671,25 @@ structure_Attr($@)
- attr tuer2 struct_kitchen_map A
-
-
- Set
-
- Jedes set Kommando wird an alle Devices dieser Struktur weitergegeben.
- Aussnahme: das Attribut structexclude ist in einem Device definiert und
- dessen Attributwert matched als Regexp zum Namen der aktuellen Struktur.
-
-
-
- Get
-
- Get wird im Structur-Device nicht unterstützt.
-
-
-
- Attributes
-
- structexclude
- Bei gesetztem Attribut wird das set-Kommando ignoriert, siehe set-Befehl.
- Dies trifft ebenfalls auf die Weitergabe des Devicestatus an die
- Struktur zu.
-
+ Bei gesetztem Attribut wird set, attr/deleteattr ignoriert. Dies
+ trifft ebenfalls auf die Weitergabe des Devicestatus an die Struktur zu.
+ Fuer set und fuer die Status-Weitergabe muss der Wert den Strukturnamen
+ matchen, bei einem Attribut-Befehl die Kombination
+ Strukturname:Attributname.
+ Beispiel:
+
+
+ define kitchen structure room lamp1 lamp2
+ attr lamp1 structexclude kitchen
+ attr lamp1 structexclude kitchen:stateFormat
+
+
+
+ - readingFnAttributes
-
=end html_DE
=cut