Currently the best option is to create a template sensor that counts the number of “problem” binary sensors that are “on”, then use that entity’s state change as your trigger with a template condition that checks that the value increased.
That would not be recommended because there is no method within the Event trigger configuration to limit it to a certain domain and/or device class. So the automation would trigger off every state-changed event of every entity in the system.
Do you think it slows down the system?
But could I limit it to the state old_state ‘off’ and new_state ‘on’ and then a condition
- condition: template
alias: Only problem device class and entity id which contains 'wartung'
value_template: |-
{{ 'wartung' in trigger.entity_id and state_attr(trigger.entity_id, 'device_class') == 'problem' }}
No you can’t. The trigger itself would require you to be able to provide the whole object for new_state and/or old_state, which you can’t because you can’t know the time-based properties like last_changed.
Yes. Though the effect will depend a lot on the particulars of the system. On any system it’s likely to be an unreliable trigger because a lot of events will get thrown out when used in single mode. And using other modes just makes it use more resources.
You can use conditions, but they don’t affect the trigger listener, they just process data after the trigger fires to check whether the actions should be executed.
The recommendation is to not use an Event trigger based on state_changed events… Doing so is like making a janky version of the State Machine.
Adding conditions doesn’t address the cause, which is an overly-general trigger definition. Conditions do not affect how often the events happen or how often the trigger fires. They only affect whether or not the action are executed.
Again… Yes it will slow the system to some degree, and it will be unreliable.
Okay, that was my question. Thank you. Perhaps I have already made the mistake. I created a test automation to take a look at the event and trigger. Now I no longer have access to my UI.
EDIT: Lesson learned, System crashed with one trigger.
Connect via smb and remove the automation in the yaml directly.
Hard Restart workes again Puh