Automation Successful Ensurement

There is a bug in automation process. I saw it few times on my system, when automation had to switch on Power Sockets but it does not.
My automation turns on power sockets at certain time, but sometimes it does not.
Maybe there should be a feature in automation to ensure that certain feature in the system did what expected. For example trying to test the expected result of entity and repeat command if needed for X sec until success or timeout.
You could put this feature in the Execution section at Entities and admin will choose at which entity he needs to ensure that the command has been processed successfuly.

That’s not a bug in the automation it’s the crappy communication link to your plug and you can automate around that with a while loop. Keep trying to turn it off until it reports back that it has.

It’s probably not a bug, more likely a connection issue (Zigbee, wifi, Zwave etc). You could work around this by for example adding a wait timer to your automation which triggers the action again if the device is not turned on/off in X seconds, or while as Tom suggested. But it’s probably better to troubleshoot why your device(s) are not responding to commands (check your logs).

There was a WTH request for such a “retry” feature, which generated some good discussion.

I think there’s also am existing HACS integration called “Retry” or some such.

I agree; regardless of the underlying cause of any one device command getting missed, it would be good to have a retry capability in many cases.

Which you can implement yourself, e.g. try up to 10 times to turn a switch off, continuing if the switch actually turns off:

actions:
  - repeat:
      while:
        - condition: state
          entity_id: switch.foobar
          state: 'on'
        - condition: template
           value_template: "{{ repeat.index < 10 }}"
      sequence:
        - action: switch.turn_off
          target:
            entity_id: switch.foobar
        - delay: 3

Or just fix your hardware. None of my entities have communication bad enough to require this.

1 Like