Closed chmac closed 3 months ago
What UniFi Protect version are you running and in how many FPS is your camera set to record in? Please try and manually set it to 3 FPS or higher. The check is apparently fps-based and done here.
I can only reproduce the issue with a G5 Turrent Ultra by lowering the FPS to 2 or 1. Otherwise, it works fine on dev
.
```python 2024-06-14 00:00:43.541 ERROR (MainThread) [aiohttp.server] Error handling request Traceback (most recent call last): File "/Users/julian/PycharmProjects/HomeAssistantcore/venv/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request resp = await request_handler(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/julian/PycharmProjects/HomeAssistantcore/venv/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle resp = await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/Users/julian/PycharmProjects/HomeAssistantcore/venv/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/Users/julian/PycharmProjects/HomeAssistantcore/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/Users/julian/PycharmProjects/HomeAssistantcore/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/Users/julian/PycharmProjects/HomeAssistantcore/homeassistant/components/http/request_context.py", line 26, in request_context_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/Users/julian/PycharmProjects/HomeAssistantcore/homeassistant/components/http/ban.py", line 85, in ban_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/Users/julian/PycharmProjects/HomeAssistantcore/homeassistant/components/http/auth.py", line 242, in auth_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/Users/julian/PycharmProjects/HomeAssistantcore/homeassistant/components/http/headers.py", line 32, in headers_middleware response = await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/Users/julian/PycharmProjects/HomeAssistantcore/homeassistant/helpers/http.py", line 73, in handle result = await handler(request, **request.match_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/julian/PycharmProjects/HomeAssistantcore/homeassistant/components/camera/__init__.py", line 815, in get return await self.handle(request, camera) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/julian/PycharmProjects/HomeAssistantcore/homeassistant/components/camera/__init__.py", line 833, in handle image = await _async_get_image( ^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/julian/PycharmProjects/HomeAssistantcore/homeassistant/components/camera/__init__.py", line 187, in _async_get_image else await camera.async_camera_image(width=width, height=height) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/julian/PycharmProjects/HomeAssistantcore/homeassistant/components/unifiprotect/camera.py", line 259, in async_camera_image last_image = await self.device.get_package_snapshot(width, height) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/julian/PycharmProjects/HomeAssistantcore/venv/lib/python3.12/site-packages/uiprotect/data/devices.py", line 2020, in get_package_snapshot raise BadRequest("Device does not have package camera") uiprotect.exceptions.BadRequest: Device does not have package camera ```
If FPS are already set higher than 2 FPS, please check again if this is fixed with the upcoming Home Assistant Core 2024.6.3 release. I'd recommend just using the max of 30 FPS. The check is still something that should be improved though.
Ahhh, I even saw that in the code about detecting package cameras which are <2 FPS, but I forgot until now that this camera was set to 1 FPS. I changed it now and it works correctly, thank you. 🧡
I will close this issue now, and I'll try to check if there is an issue for cameras with low FPS settings not working.
The problem
I am unable to view a live stream from my G5 Turret Ultra camera via home assistant.
What version of Home Assistant Core has the issue?
core-2024.6.1
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
Unifi Protect
Link to integration documentation on our website
https://www.home-assistant.io/integrations/unifiprotect/
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
I have checked the logs and found that the issue arises here:
https://github.com/home-assistant/core/blob/30e11ed068604e9d30469ceccf70786e1ecb66ef/homeassistant/components/unifiprotect/camera.py#L266-L275
Line 270 returns true, somehow the
self.channel.is_package
is set totrue
. I verified this by running bash inside my home assistant container and removing the whole if block, leaving just line 273. After that hack, I can see my camera correctly in the dashboard.I just installed home assistant today, so unfortunately I'm not sure how to pursue this error further. I suppose somewhere the camera must have some kind of setting that says it supports package mode, even though it doesn't. I can't figure out if that is related to my setup, or if it's a bug in home assistant.
If there's anything I can do to help diagnose this further, just let me know.
Additional information
Thanks to all the home assistant contributors and other folks who make this possible, it's frickin epic! 🧡