The automation I’m using is based on this great blueprint: Link Multiple Switches - Blueprints Exchange - Home Assistant Community (home-assistant.io) or Link On/Off State of Multiple Devices - Blueprints Exchange - Home Assistant Community (home-assistant.io)
In it the blueprint the automation is defined as:
mode: queued
max_exceeded: silent
That’s why I was thinking to work on the time difference.
The infinite flip/flop loop happens on a group of 8 switches connected. Sometimes (not always), randomly, they start to go on/off continuously even if the conditions are:
condition:
- condition: template
value_template: '{{ trigger.to_state.state != trigger.from_state.state }}'
- condition: template
value_template: '{{ trigger.to_state.state != "unknown" }}'
- condition: template
value_template: '{{ trigger.to_state.state != "unavailable" }}'
- condition: template
value_template: '{{trigger.to_state.context.parent_id is none or (trigger.to_state.context.id != this.context.id and trigger.to_state.context.parent_id != this.context.id) }}'
the only way to stop the flip/flop is to disable the automation. Wait a little and re-enable… but this is not feasible when it happens to the kids and I’m not home 