Open profixo opened 1 week ago
Hey there @angellusmortis, @bdraco, mind taking a look at this issue as it has been labeled with an integration (unifiprotect
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
unifiprotect documentation unifiprotect source (message by IssueLinks)
Not related to UniFi Protect at all. If you are pulling images from the camera entity, it is the camera integration. The UniFi Protect integration just gives the data to the camera integration.
It also looks like the proxy integration just takes snapshots of the camera, so the stream should not be involved either. Just camera and proxy.
@home-assistant unassign unifiprotect
If you are trying to do push notifications to your phone for UniFi Camera events, there are blueprints for that already. It also uses thumbnail produced by Protect itself instead of just taking a snapshot, so it should be more accurate.
Hey there @home-assistant/core, mind taking a look at this issue as it has been labeled with an integration (camera
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
camera documentation camera source (message by IssueLinks)
i have tested my automation with other cameras but to problem just occures whit the g4 Doorbell. The Camera Picture is as well not loading in the devices Tab under the sensor. the only time the camera picture is loading if i click on the camera sensor it self
alias: Türklingel Benachrichtigung Toni PC description: "" trigger:
It is still not related to the UniFi Protect integration. If you really think it is, you can manually call camera.snapshot
service:
service: camera.snapshot
target:
entity_id: camera.back_yard_camera_high
data:
filename: /config/www/test.png
If that fails then you should have a traceback with code pointing to pyunifiprotect
. Otherwise, everything is completely handled by the camera
integration, not UniFi Protect.
Looking more at your traceback, it looks like it is because of the hass_agent
custom component. It is still trying to use the access_token
attribute when it does not exist.
File "/usr/src/homeassistant/homeassistant/components/notify/legacy.py", line 275, in _async_notify_message_service
await self.async_send_message(**kwargs)
File "/config/custom_components/hass_agent/notify.py", line 81, in async_send_message
access_token = camera.attributes["access_token"]
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
KeyError: 'access_token'
EDIT: Reported hass_agent
issue: https://github.com/LAB02-Research/HASS.Agent-Integration/issues/45
ok so i have triggert the automation and thats what i found in the logs
2024-04-25 18:13:24.223 ERROR (MainThread) [homeassistant.components.automation.snapshot_der_hinterhof_kamera_erstellen] Snapshot der Hinterhof-Kamera erstellen: 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 1019, in async_handle_snapshot_service else await camera.async_camera_image() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/unifiprotect/camera.py", line 273, in async_camera_image last_image = await self.device.get_snapshot(width, height) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyunifiprotect/data/devices.py", line 1927, in get_snapshot return await self.api.get_camera_snapshot(self.id, width, height, dt=dt) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyunifiprotect/api.py", line 1364, in get_camera_snapshot return await self.api_request_raw( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyunifiprotect/api.py", line 358, in api_request_raw response = await self.request( ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyunifiprotect/api.py", line 311, in request response = await req_context.aenter() # noqa: PLC2801 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 507, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 742, in _async_call_service_step response_data = await self._async_run_long_action( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 705, in _async_run_long_action return await long_task ^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2543, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2580, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 971, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1043, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/camera/init.py", line 1015, 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
A timeout error means Home Assistant is having trouble communicating to UniFi Protect. Either it is a firewall issue, or you are overloading your NVR console, so it is having trouble responding.
ok, so would it help to restart my dream machine pro?
Both the firewall and hardware issue are out of scope of this Github. My recommendation would be to stop using a UDM Pro as it is very poorly designed to run UniFi Protect and UniFi Network at the same time. Running both cuts your camera capacity by over half and UniFi Protect does not take it into account. It leads to the UDM Pro often being overloaded.
Ok Thanks for your Fast Response
It does look like there is still an issue here though. The camera
integration is not reporting any issues when it is getting timeouts trying to fetch camera issues. Or maybe it is not timing out and just hanging forever.
access_token
attribute is empty, but it never should be (I think?)camera.snapshot
service reveals the timeoutI have seen others on the community forums also report the blank image issue, but no one has posted logs or anything to indicate what it is happening. It looks like the camera integration just silently never reports a timeout for fetching the camera image.
ok. Is there something i can do?
So i have restartet the UDM Pro and HA and now everything is working fine. The snapshot is working and my automation for the notification as well
The problem
I build an Automation that should trigger a notification with the cameraproxy integration. When the Doorbell is Pressed then the Picture of the Camera should be send via the API and the camera Proxy. But this is not working anymore in the logs there is a problem but i dont know how to solve it. The Camera Picture is as well not loading on the Dashboard. But if i tap on the picture in the Dashboard the camera Stream is loading normaly in the more Info tab.
2024-04-25 16:59:15.742 ERROR (stream_worker) [homeassistant.components.stream.stream.camera.kamera_hinten_high] Error from stream worker: Error demuxing stream: [Errno 5] I/O error: 'rtsps://192.168.0.1:7441/s6CyRyfo7pJkKYTX?enableSrtp'; last error log: [tls] The specified session has been invalidated for some reason. 2024-04-25 16:59:36.269 ERROR (stream_worker) [homeassistant.components.stream.stream.camera.kamera_terasse_hinten_high] Error from stream worker: Error opening stream (INVALIDDATA, Invalid data found when processing input) rtsps://192.168.0.1:7441/IDzZMePfkEktEpYx?enableSrtp=
What version of Home Assistant Core has the issue?
core-2024.4.4
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
Unifi Protect
Link to integration documentation on our website
https://www.home-assistant.io/integrations/unifiprotect/
Diagnostics information
config_entry-unifiprotect-c16c82509b096e66e5ce443f3ed25add.json
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
home-assistant_unifiprotect_2024-04-25T15-12-14.438Z.log