rossko57
(Rossko57)
August 19, 2019, 8:32pm
4
There is a complete alternative approach; make one rule triggered by events on a Group member, use related Item names (as you already do) so the rule can deduce which Items are associated with the “current” Group member.
Edit: Updates for OH 4, inclusion of JS Scripting and Blockly examples, removed the doors example as it’s superfluous.
Please see https://community.openhab.org/t/design-pattern-what-is-a-design-pattern-and-how-do-i-use-them/40319 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 tha…
Edit: Updates for OH 4
Please see https://community.openhab.org/t/design-pattern-what-is-a-design-pattern-and-how-do-i-use-them/40319 for how to read and use DPs.
Problem Statement
Often one will have a number of separate Items which are all related to each other in some way. For example, one might have a Contact on a door and a DateTime to represent when the last time the door was opened. This is easy enough to keep track of if there are only one or two such Items, but if one has a lot of sim…