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
71.09k stars 29.75k forks source link

unifiprotect - not able to create snapshots via doorbell camera #121967

Closed 2-MAdD closed 2 weeks ago

2-MAdD commented 1 month ago

The problem

my automation to create a snapshot when somebody presses the doorbell isnt working anymore. The last time it worked was 27-06-2024

What version of Home Assistant Core has the issue?

core-2024.7.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

unifiprotect

Link to integration documentation on our website

https://www.home-assistant.io/integrations/unifiprotect

Diagnostics information

2024-07-15 10:28:07.706 DEBUG (MainThread) [uiprotect.api] Request url: https://10.168.10.1/proxy/protect/api/cameras/6586e1da030e6003e400042c/snapshot 2024-07-15 10:28:12.171 DEBUG (MainThread) [uiprotect.api] emitting message: WSAction.UPDATE:ModelType.CAMERA:6586e1da030e6003e400042c:['voltage'] 2024-07-15 10:28:12.171 DEBUG (MainThread) [homeassistant.components.unifiprotect.data] Updating device: Doorbell (F4E2C60D8DEE) 2024-07-15 10:28:12.171 DEBUG (MainThread) [homeassistant.components.unifiprotect.select] Updating dynamic select options for Doorbell text 2024-07-15 10:28:12.172 DEBUG (MainThread) [homeassistant.components.unifiprotect.entity] Updating state [Doorbell Voltage (F4E2C60D8DEE)] [True, 18.2] -> (True, 18.0) 2024-07-15 10:28:17.708 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Unexpected error for call_service at pos 1: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/camera/init.py", line 1009, in async_handle_snapshot_service else await camera.async_camera_image() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/unifiprotect/camera.py", line 252, in async_camera_image last_image = await self.device.get_snapshot(width, height) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/uiprotect/data/devices.py", line 1970, in get_snapshot return await self._api.get_camera_snapshot(self.id, width, height, dt=dt) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/uiprotect/api.py", line 1420, in get_camera_snapshot return await self.api_request_raw( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/uiprotect/api.py", line 388, in api_request_raw response = await self.request( ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/uiprotect/api.py", line 342, in request response = await req_context.aenter() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 1197, in aenter self._resp = await self._coro ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 608, in _request await resp.start(conn) File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 976, in start message, payload = await protocol.read() # type: ignore[union-attr] ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/streams.py", line 640, in read await self._waiter asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 527, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 764, in _async_call_service_step response_data = await self._async_run_long_action( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 727, in _async_run_long_action return await long_task ^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2731, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2774, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 999, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1071, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/camera/init.py", line 1005, in async_handle_snapshot_service async with asyncio.timeout(CAMERA_IMAGE_TIMEOUT): File "/usr/local/lib/python3.12/asyncio/timeouts.py", line 115, in aexit raise TimeoutError from exc_val TimeoutError 2024-07-15 10:28:17.711 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140464168065136] Error handling message: Timeout (timeout) Home Assistant from 192.168.50.92 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.0.0)

Example YAML snippet

service: camera.snapshot
data:
  filename: /config/www/Deurbel/test-high.jpg
target:
  entity_id: camera.doorbell_high_resolution_channel

Anything in the logs that might be useful for us?

2024-07-15 10:28:07.706 DEBUG (MainThread) [uiprotect.api] Request url: https://10.168.10.1/proxy/protect/api/cameras/6586e1da030e6003e400042c/snapshot
2024-07-15 10:28:12.171 DEBUG (MainThread) [uiprotect.api] emitting message: WSAction.UPDATE:ModelType.CAMERA:6586e1da030e6003e400042c:['voltage']
2024-07-15 10:28:12.171 DEBUG (MainThread) [homeassistant.components.unifiprotect.data] Updating device: Doorbell (F4E2C60D8DEE)
2024-07-15 10:28:12.171 DEBUG (MainThread) [homeassistant.components.unifiprotect.select] Updating dynamic select options for Doorbell text
2024-07-15 10:28:12.172 DEBUG (MainThread) [homeassistant.components.unifiprotect.entity] Updating state [Doorbell Voltage (F4E2C60D8DEE)] [True, 18.2] -> (True, 18.0)
2024-07-15 10:28:17.708 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Unexpected error for call_service at pos 1: 
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 1009, in async_handle_snapshot_service
    else await camera.async_camera_image()
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/unifiprotect/camera.py", line 252, in async_camera_image
    last_image = await self.device.get_snapshot(width, height)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/uiprotect/data/devices.py", line 1970, in get_snapshot
    return await self._api.get_camera_snapshot(self.id, width, height, dt=dt)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/uiprotect/api.py", line 1420, in get_camera_snapshot
    return await self.api_request_raw(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/uiprotect/api.py", line 388, in api_request_raw
    response = await self.request(
               ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/uiprotect/api.py", line 342, in request
    response = await req_context.__aenter__()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 1197, in __aenter__
    self._resp = await self._coro
                 ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 608, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 976, in start
    message, payload = await protocol.read()  # type: ignore[union-attr]
                       ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/streams.py", line 640, in read
    await self._waiter
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 527, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 764, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 727, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2731, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2774, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 999, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1071, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 1005, in async_handle_snapshot_service
    async with asyncio.timeout(CAMERA_IMAGE_TIMEOUT):
  File "/usr/local/lib/python3.12/asyncio/timeouts.py", line 115, in __aexit__
    raise TimeoutError from exc_val
TimeoutError
2024-07-15 10:28:17.711 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140464168065136] Error handling message: Timeout (timeout) Home Assistant from 192.168.50.92 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.0.0)

Additional information

No response

home-assistant[bot] commented 1 month ago

unifiprotect documentation unifiprotect source

2-MAdD commented 2 weeks ago

looks like the issue is gone after a few upgrade

HA:

Unifiy:

keep this open for a week.. and then close it.....