Yes, I saw this, but I’m really looking for a way to make an if statement on error. If error, then notify, else continue.
This will just continue to the next action (in this case, the persistent_notification.create) everytime, regardless of whether the previous action failed or not…
Let’s say I have an automation, whose action sequence is A-B-D-E. I’d like to insert an if statement that says, If B fails, do C, then continue with D and E, else if B doesn’t fail, continue with D-E.
Assuming B has an error, continue_on_error: true will only ever do A-B-D-E, where the default continue_on_error: false will stop after B. My question is whether you can insert a conditional based on the error status of an action. Can I make C conditional to the output of B?
While that might work sometimes, it’s not really a reliable way to solve my issue…
For example, what if the light takes more than 1s to toggle? In your script, this is also uni-directional from on to off. What if I want to toggle in the opposite direction? Or check the specific value of a sensor? This isn’t the most reliable solution.
I’m really just wondering if it’s possible to know if an error has been thrown in the script sequence. That is all.
@123 Are you aware if this is possible? Perhaps through templating?
I’m looking for the same thing. I have automations that turn on or off several Zigbee lights. I’d like to be informed if a Zigbee device fails to respond when running an automation. Now I have to notice that something that should be on or off isn’t and then go to automation traces to see what went wrong. Basically I’d like to receive the error in traces as a notification.
I have the sam issur.
I’m calling the service last_called_alexa which from time to time gives an error.
This service fills a sensor with the latest called alexa device.
I’d like to know, that the service went in an error in order to know, that the sensor still provides an old information and not the latest.
+1, same here. I sometimes try to set a zigbee-device like a TRV back to a normal state, which sometimes fails, but nobody has a chance to realise that the service-call failed. This resulted in a too high temperature for the TRV (so in additional costs). Being able to “catch” the error like in other programming languages would be a great advance making the code more reliable.
Ya there is no error-handling syntax currently that I can find the documentation. Without that, any other solution is basically a heuristic. You can add it to the feature requests.
continue_on_error not working for me.
I have a notify.alexa_media which is sometimes unvailable because issues with HACS Alexa Media Player.
When I add continue_on_error: true, the error is always log in HA notification and my automation stops…
Is there a way to bypass this ?
IS this an issue of HA ?
Wouldn’t this have exactly the same issue the OP was trying to address? I.e. in each of the actions you’d either increment the variable if you have continue_on_error: true, not even get to the increment operation if you have continue_on_error: false and the previous action failed, or have to be able to tell whether or not the previous action failed or not, to decide whether to increment the variable or not.