Stop automation without turning it off?

I have a couple of instances where an automation might be in a running state (repeat, delay, wait etc) and I need to stop the automation from running. The only way to accomplish this right now as far as I’m aware is to turn the automation off then turn it back on.

Is there a way, or could there be a way to stop an automation run without turning it off and then back on?

1 Like

According to the documentation, automation.reload effectively does the same thing.

Automation Reload

1 Like

But that reloads (and stops) all automations, so it might have some unwanted consequences.

1 Like

Yes it does. The question was:

Reload is the only other way to do it. It’s actually stopping and restarting but with a single service call (and not just one but all automations).

If the goal is to find a service call to stop a single running automation without calling the automation.turn_off service, it doesn’t exist (based on the documentation).

The other option is to move your automation actions to a script so you can use the script.turn_off service

4 Likes

This was the answer to my question. Thank you.

I actually did consider this, but it seems like a bit of a “workaround” to me. I really think there needs to be an automation.stop service for these situations. But I guess this will work for now. Thanks for the suggestion.

Post in Feature Request or in WTH.

I agree that using a script is a workaround. Your question was how to stop a running automation (without turning it off) and the answer isn’t “Don’t use an automation, use a script.” Fact is, there is no way to do what you want with an automation.

Now comes the thorny part: we get a consistency problem if automation.stop is implemented.

To stop a running script (without disabling it), call script.turn_off
To stop a running automation (without disabling it), call automation.turn_off automation.stop

The two are closely related yet will have different terms for stopping their execution. Ideally, script.turn_off would disable the script, just like automation.turn_off disables an automation. However, it doesn’t; there’s no concept of disabling a script, only to stop a running script.

Not sure if there’s way to create consistency without a breaking change.

Also for reference and previously related discussion, see:

EDIT: I can’t find where it was discussed right now, but the other thing to consider about an automation.stop service is, why are you calling it? More importantly, why would you call it and not also want to prevent the automation from running again?

Here’s the scenario. Some script or whatever decides it needs to stop a running automation. So it calls a (theoretical) automation.stop service. But immediately after it does that the automation is triggered again, and so it’s running again. The script or whatever continues with the assumption that the automation isn’t running, but it is.

So, what is the purpose / use case for stopping an automation, but not also disabling its triggers?

I simply turn the automation off, then after a short delay turn it back on. Simply ends it and resets it, ready for it to triggger again. This is this for my pending alarm warning automation.

1 Like

actually if you do these steps:

  1. stop the automation
  2. wait for a delay
  3. re-enable the automation

then steps 2 and 3 are never executed as the automation stops after step 1

I think this is referring to a different automation so it would work