Action behaviour of Automation that turns itself off

Can anyone tell me if an automation should continue to work through the Action-sequence, if it turns itself off please?

I was under the impression that an automation, once triggered, would continue to work through the Action-sequence, unless I add the stop_action option but the code below is not working. I can see that the automation is triggered and it does turn itself off. I know the Condition is true (switch.hot_water is ‘on’) but the switch is not being turned off.

Is this a bug maybe, or have I just got the logic wrong? I can fix this by adding a script that replaces the first action, waits 10 secs and then turns the automation off but that’s sort of defeating the object.

  action:
  - data: {}
    entity_id: automation.hot_water_1hr_off
    service: automation.turn_off
  - condition: state
    entity_id: switch.hot_water
    state: 'on'
  - data: {}
    entity_id: switch.hot_water
    service: switch.turn_off

I found the answer. I did have the wrong logic, you need to add stop_actions: false to the ‘data:’ block.

Could you please post the entire solution?. Thanks

Here’s how it looks in the Automation Editor

and this is the YAML equivalent

service: automation.turn_off
data:
  stop_actions: false
entity_id: automation.hot_water_1hr_off
1 Like