Allow scripts/automations to continue after a failed action

It would be useful to be able to specify that an action should not prevent further execution of a script/automation upon failure.

I have a sequence of actions that first attempts to pause any playback from a specific media player (using Spotify). However, if that media player is not playing, the service call will fail and the remaining actions in the sequence will not be executed.

In the above example, I’m fortunate that I can simply re-order the actions to place the failing one at the end. However, there will be other cases where multiple steps have the potential to fail and a ‘best effort’ to complete all steps may be preferred.

My proposal would be to introduce a syntax similar to that of the wait timeouts, where a user can currently specify continue_on_timeout with a boolean value. For actions within a sequence, a property such as continue_on_fail could be set by the user, defaulting to false if omitted to maintain backward compatibility.

Not the best workaround but you could use choose templates as actions.
So template is media player is playing, action pause.
But a short version of that could be handy.

Another option is Node red where you can put all call services in parallel.

Indeed, there are workarounds for specific cases if you anticipate where actions might fail. This is more so you can define something upfront as ‘best effort’ and not need to know all the ways in which it might fail ahead of time.

Isn’t that exactly what the wait templates together with a timeout do? :slight_smile: Wait for something to get to a specific state, and if not, move on after a set timeout… So in your case, wait for pause, if it won’t get there, move on after X minutes…

Not quite. Let’s say you call light.turn_off and for whatever reason it throws an exception. Now your script just ends prematurely. There’s nothing to wait for, since you’re the one issuing the service call in the first place.

exactly my problem right now… did you find any workarounds?
if (exec failed) then?