"Continue on error" not working

Hi everyone,

I currently have a script that perform a series of task to “close” the house when leaving, as shutting down all the lights, locking the door and activating the alarm. Sometimes some of these calls fail and I leave home half open (mostly nuki lock). I was really happy reading in the last update about the introduction of the “continue on error” function HERE and applied it to the relevant actions, for example:

  - continue_on_error: true
    service: lock.lock
    data: {}
    entity_id: lock.casa

Unfortunately nothing was solved as a failed call to the smart lock still stops my whole script without any notification… Can someone help?

1 Like

Did you try to add, e.g., a notification after that part to confirm the script is actually stopping there?

I know the script stops there from the trace, I just cannot post an example because at every reboot I lose the script debug logs.
The Nuki integration throws an error and it doesn’t continue…

Might be worth opening an issue vs. the Nuki integration.
Maybe it fails in a way that is not understood by HA…

I did it too, let’s see if someone agree or I missed something

Encountered the same issue.

Stopped because an error was encountered at June 14, 2022, 9:13:51 AM (runtime: 1.35 seconds)

Error: Invalid stok value, Response: {“error_code”: -40401, “result”: {“data”: {“code”: -40407, “encrypt_type”: [“1”, “2”], “key”: “REDACTED”, “nonce”: “REDACTED”}}}

But I have this in YAML:

service: tapo_control.set_led_mode
data:
led_mode: ‘on’
target:
device_id: REDACTED
continue_on_error: true

Hi,

I also have the same kind of problem.
The action fails with an error but the automation does not continue.


image

I also tried to add continue_on_error: true on the choose but it did not change anything.

I had a look at the code, it states here:

        # Only Home Assistant errors can be ignored.
        if not isinstance(exception, exceptions.HomeAssistantError):
            raise exception

I guess that the integrations may not raise an exception based on HomeAssistantError thus the exception is raised the action does not continue.

The exception type is ConnectionError in my case:

File "/config/custom_components/nuki_ng/nuki.py", line 38, in async_json

raise ConnectionError(f"Http response: {response.status_code}")

ConnectionError: Http response: 503

It looks like it works if I comment out the latest if.

If one wants to try, log in HA docker (through Portainer or 22222 Dev Shell):

# docker exec -it homeassistant /bin/bash
bash-5.1# vi /usr/src/homeassistant/homeassistant/helpers/script.py

Line 493:

# Only Home Assistant errors can be ignored.
        #if not isinstance(exception, exceptions.HomeAssistantError):
        #    raise exception

Restart HA

1 Like

Hi,

For me also is not working with
Error: http status: 404, code:-1 - https://api.spotify.com/v1/me/player/play?device_id=blablas: Device not found, reason: None

I’m not familiar with Docker so I search through Google - 22222 Dev Shell and find this add on:

May I ask if I will install that one I can connect and edit above lines?
If yes, how to ssh? Like my HA IP and 22222 port via Putty?

Thanks

You still need to know how to generate SSH key pair, use a terminal and vi.
I don’t recommend fiddling with the code if you are not completely sure about what you are doing. Any wrong change can brick your HA and any change will be lost after updating HA anyway.

It’s not my first time messing with the code.
I’m familiar with the SSH and SSH keys but I’m not sure about this part of the configuration. I don’t have any interface for entering the key.

Hey, any luck with this yet? I have exactly the same problem with the error 503 with the Nuki lock and wanted to use continue_on_error but I’m a bit hesitant if I read your post…

I also have this error. It is so frustrating.

I have an automation that does things when i leave home, one of them is to turn off the TV:

The problem is that the TV goes from available to unavailable like every minute (yeah, philipls suck and i don’t want to talk about it), so the automation is stopped when this command is performed and the TV happens to be unavailable:

As you can see from the first image, the continue on error is set to true, so i really don’t see why the automation still stops.
And really, it doesn’t matter why the TV becomes unavailable, if there is such an option in the automation it MUST work