core icon indicating copy to clipboard operation
core copied to clipboard

Service Timeout does not respect the continue_on_error con camera.snapshot service

Open ivanfmartinez opened this issue 1 year ago • 7 comments

The problem

I'm having trouble with some automations, and after searching I found a lot of persons with similar problems, and apparently mine and some others are related to this change : https://github.com/home-assistant/core/pull/98501 that implements a service timeout but also related to continue_on_error not being respected.

This service execution timeout have fixed 10 seconds service timeout, in my case many times my service.camera_snapshot takes more time and stop all the automation even if I use continue_on_error: true, I have checked and continue_on_timeout are not available for service calls and cannot be set.

Apparently when I did not use this camera the service takes more time to start, and after I view camera on dashboard or try sometimes it start responding faster. But this are easy to accept if the complete automation execution are not cancelled.

I have tried to reproduce using external scripts with sleep, but then I found that this external scripts ignore this 10 seconds timeout : https://github.com/allenporter/home-assistant-core/blob/c437b621b87b90ab2c789c962642251ed8859798/homeassistant/helpers/script.py#L703

What version of Home Assistant Core has the issue?

core-2024.2.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

camera.snapshot

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

This is the full block where I can pinpoint the error (trace attached in additional information)
The timeout occurred executing the camera snapshot, but when I look at traces the "TimeoutError" appear on the repeat element.

This service timeout probably must be configurable and should be ignored on continue_with_error


  - repeat:
      count: 2
      sequence:
        - service: camera.snapshot
          continue_on_error: true
          data:
            entity_id: camera.interfone
            filename: >-
              /config/www/tmp/snapshot_interfone_{{ '%03d' % (repeat.index |
              int) }}.jpg
          enabled: true
        - service: script.avisos_debug
          metadata: {}
          data:
            message: loop {{ repeat }} {{ '%03d' % (repeat.index | int) }}
        - service: shell_command.send_snapshot_entrada2
          continue_on_error: true
          data:
            num: '{{ ''%03d'' % (repeat.index | int) }}'
        - delay:
            hours: 0
            minutes: 0
            seconds: 2
            milliseconds: 0


### Anything in the logs that might be useful for us?

_No response_

### Additional information

[trace automation.snapshot_interfone_entrada 2024-02-18T11_49_41.670127+00_00.json](https://github.com/home-assistant/core/files/14322507/trace.automation.snapshot_interfone_entrada.2024-02-18T11_49_41.670127%2B00_00.json)

ivanfmartinez avatar Feb 18 '24 14:02 ivanfmartinez

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

2024.5.5 still with same behaviour, continue_on_error are not respected on timeout.

ivanfmartinez avatar May 25 '24 10:05 ivanfmartinez

still present in 2024.6.x

3oris avatar Jul 03 '24 16:07 3oris

still present in 2024.7.x

heinemannj avatar Jul 07 '24 06:07 heinemannj

https://github.com/home-assistant/core/issues/121280

garry0garry avatar Jul 11 '24 19:07 garry0garry

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

still in 2024.9.3

ivanfmartinez avatar Oct 09 '24 20:10 ivanfmartinez

I'm also hitting this problem. The camera feed I'm trying to integrate with (via Bambu Lab integration) is known to be unstable and slow, and I was hoping to work around it with repeated attempts at snapshots until one succeeds, but it's extremely difficult to accomplish this when the snapshot action does not respect continue_on_error: true on timeout.

JohnathonMohr avatar Dec 29 '24 21:12 JohnathonMohr