home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.63k stars 30.78k forks source link

continue_on_error: not working on automations #115401

Open sciorty opened 7 months ago

sciorty commented 7 months ago

The problem

Hi,

I think this is a duplicate of https://github.com/home-assistant/core/issues/73344 but it was closed and didn't really addressed the continue_on_error functioning but rather the source of the error.

I have the same problem but with an automation that among other things turns OFF a TV that often becomes unavailable after some minutes and then available again. Now, i would be happy for sure to solve the issue of the TV becoming unavailable (philips 55PUS7906 with ADB), but here i would like to know why the continue_on_error seems to be ininfluent on the automation: image image

I also tried a workaround as someone suggested, by embedding the failing action into a script, but did not work:

image

I'm now trying to set the continue_on_error also into the script, but as I see from documentation it should also work on automations YAML.

image

Am I missing something or is this continue_on_error not working?

What version of Home Assistant Core has the issue?

2024.4.2

What was the last working version of Home Assistant Core?

/

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

/

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 7 months ago

Hey there @home-assistant/core, mind taking a look at this issue as it has been labeled with an integration (automation) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `automation` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign automation` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


automation documentation automation source (message by IssueLinks)

cmatte commented 7 months ago

Just wanted to report I'm seeing a similar unexpected behaviour when running automations and specifically services. As I was trying to loop through attempting to lock a smart lock, to address sporadic (not that much, actually) Matter over Thread downtimes, the automation does instead error out and fail, not allowing to achieve the wanted behaviour.

Example if helpful.

service: lock.lock
continue_on_error: true
data: {}
target:
  entity_id:
    - lock.front_door_nuki_lock_4
Executed: 15 April 2024 at 21:21:35
Error: src/inet/UDPEndPointImplSockets.cpp:417: OS Error 0x02000013: No such device
Result:
params:
  domain: lock
  service: lock
  service_data: {}
  target:
    entity_id:
      - lock.front_door_nuki_lock_4
running_script: false

image

pmannk commented 7 months ago

Same issue here. I have an automation that calls a bunch of ESPHome services on different devices. If one of the devices is offline for any reason the automation stops, regardless of the "continue_on_error" flag being set.

HA Core 2024.4.2 This is a new automation so I'm not sure if this has worked in prior versions of HA. image

DigitalCharon commented 5 months ago

I'm aslo having this issue. Every step of the automation has continue_on_error: true

home_assistant_erroring_step

home_assistant_error

ChrisHomeAssistant commented 3 months ago

Are there any news on this issue? I experience similar problems when using continue_on_error

gjaegy commented 3 months ago

Same here, what is the status of that one ?

rchovan commented 1 month ago

Hi, same error on scripts. HA version 2024.9.2 Frontend 20240909.1 Screenshot_20240923_073627_Home Assistant

hesspoint commented 1 month ago

Same issue for me. Device looses connection and therefore throws an error in the script. Added continue on error to true for that action and it does not continue regardless. Really frustrating

PaulSD commented 1 month ago

For anyone encountering similar issues (where an Automation or Script fails/stops after a device/service error, despite continue_on_error: true being set): This behavior indicates a bug in the Integration that supports the relevant device/service, and you should file a bug report against each Integration that has this problem.

More specifically: Per the integration developer docs, Integrations should raise HomeAssistantError exceptions for device communication failures on action calls. continue_on_error only catches/ignores HomeAssistantError exceptions; Other exceptions will still cause an Automation/Script to fail/stop. Hence, an Automation/Script failing/stopping after an action error (when continue_on_error is set) indicates that the Integration is not properly translating exceptions (catching generic exceptions from underlying libraries and raising exceptions derived from HomeAssistantError in their place). This is considered a bug in the Integration. (The fix for #73344 in the nuki Integration, or this code in the Google Generative AI Integration, are examples of how an Integration can be fixed to properly handle this.)

I have submitted a bug report for one of these issues in the Matter Integration here: #128246