rossko57
(Rossko57)
January 13, 2021, 12:35pm
3
Note that this is not the same as triggering from change to the Group state itself. A member may change and have no effect on parent Group state at all.
You want the equivalent of the Member of trigger in your old DSL rule, not any Group event.
triggeringItem only exists in the DSL, but scripted automation has event.itemName, event.itemState, etc… But How Do I…? — openHAB Helper Libraries documentation .
Don’t trigger the rule when the group is updated (groups don’t receive updates)… use a “Member of” trigger instead. I also combined both rules into one…
from core.rules import rule
from core.triggers import when
@rule("Turn ON/OFF the home cinema", description="Turn ON/OFF the home cinema", tags=["home_cinema"])
@when("Member of Hom…
Edit: Updates for OH 4, inclusion of JS Scripting and Blockly examples, removed the doors example as it’s superfluous.
Please see Design Pattern: What is a Design Pattern and How Do I Use Them for how to read and use DPs.
Problem Statement
One powerful way to consolidate code in rules is to use array/list manipulation operations on the members of a Group. For example, filter down to just those members that are ON, get a list of the labels of those Items that are NULL, etc.
Concept
[image]
T…