How is a DSL Rule condition of the named type to be defined in HABApp?
Is it as simple as
self.listen_event(<GROUP>, self.on_update, ValueUpdateEventFilter())
or does this trigger on changes to the GroupItem itself and not its members?
How is a DSL Rule condition of the named type to be defined in HABApp?
Is it as simple as
self.listen_event(<GROUP>, self.on_update, ValueUpdateEventFilter())
or does this trigger on changes to the GroupItem itself and not its members?
Using an event listener on the group item directly did not work as expected. I assume it triggers in case the overall group status changes only?
So this is what I have done and it seems to work:
group_item = GroupItem.get_item(<GROUPNAME>)
for item in group_item.members:
item.listen_event(self.on_event, ValueUpdateEventFilter())
Using EventListenerGroup
is probably another option?
Correct - be aware that when you change the group you have to reload the rule.
With HABApp groups make not very much sense because it’s easy to get items by building the item name dynamically. When you have your items named consistently it’s easy to get all required items by just providing the prefix/middle part/suffix and building the rest in the rule dynamically.
No.
With this approach, you also have to reload the rule if an item was added.