Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Camera Stream not Loading in HA #134

Open
ScottRoach opened this issue Jan 18, 2021 · 1 comment
Open

Camera Stream not Loading in HA #134

ScottRoach opened this issue Jan 18, 2021 · 1 comment

Comments

@ScottRoach
Copy link

Describe the bug
Camera stream does not load. Instead it returns either a 504 Timeout error from the homeassistant proxy url or an empty text response.

To Reproduce

  1. Install the reolink_dev integration in hacs and reboot
  2. Add a camera using main and rtsp (or rtmp)
  3. Add a Picture card to dashboard
  4. Clicking on the detail produces a broken image

Expected behavior
When viewing the stream version of the camera (as compared to the screen grab) it should show what the camera sees instead of a broken image.

Screenshots
Screen Shot 2021-01-17 at 1 55 56 PM

Environment:
Please provide useful information about your environment, like:

  • Home Assistant version: 2021.1.4 (docker)
  • Reolink camera model: RLC-520A
  • Camera firmware number: v3.0.0.116_20102900
  • relink_dev component version: v0.13

Additional context
I've tried the following things to troubleshoot:

  • Set the reolink_dev integration logging to DEBUG - have not seen any errors - logs are below
  • I verified with netstat that the HA host is making a successful connection to the camera when the stream is being requested homeassistant correct.camera.ipaddress.here:554 ESTABLISHED 15066/python3 Once the request times out the connection is no longer ESTABLISHED
  • I verified on my local machine that the stream_url appears to be correctly formatted as rtsp://username:password@correct.camera.ipaddress.here:554/h264Preview_01_main
  • If I manually add a generic camera with the stream_source from above it works as expected
  • I verified that I can load the stream from inside the home assistant docker instance via ffmpeg without any network issues
  • I have ffmpeg loaded in my config
  • Tried switching between protocols and main and sub streams

reolink_dev logs:

/config/custom_components/reolink_dev/__init__.py:137: RuntimeWarning: coroutine 'ReolinkPush.unsubscribe' was never awaited
2021-01-17 13:51:46 DEBUG (MainThread) [custom_components.reolink_dev.base] Registering webhook for event ID reolink_dev-event-ec71db54c8a3
2021-01-17 13:51:46 INFO (MainThread) [custom_components.reolink_dev.base] Host correct.camera.ipaddress.here subscribed successfully to webhook http://homeassistant/api/webhook/09dbc77a5661dacfb5d7f0f61efeff91535f85525d36e00d8541e5722828e552
2021-01-17 13:51:46 DEBUG (MainThread) [custom_components.reolink_dev] Finished fetching reolink data in 0.076 seconds
2021-01-17 13:51:46 INFO (MainThread) [homeassistant.components.camera] Setting up camera.reolink_dev
2021-01-17 13:51:46 INFO (MainThread) [homeassistant.components.switch] Setting up switch.reolink_dev
2021-01-17 13:51:46 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.reolink_dev
2021-01-17 13:52:46 DEBUG (MainThread) [custom_components.reolink_dev] Finished fetching reolink data in 0.124 seconds
2021-01-17 13:53:46 DEBUG (MainThread) [custom_components.reolink_dev] Finished fetching reolink data in 0.104 seconds
2021-01-17 13:54:46 DEBUG (MainThread) [custom_components.reolink_dev] Finished fetching reolink data in 0.092 seconds
2021-01-17 13:55:46 DEBUG (MainThread) [custom_components.reolink_dev] Finished fetching reolink data in 0.093 seconds
2021-01-17 13:56:46 DEBUG (MainThread) [custom_components.reolink_dev] Finished fetching reolink data in 0.092 seconds
2021-01-17 13:57:46 DEBUG (MainThread) [custom_components.reolink_dev] Finished fetching reolink data in 0.057 seconds

Core Issue
I've narrowed the issue down to this recent change: a8cecc2#diff-5a5bfae2f3cd9b046addab6f73b4563d28118ab7ff0d899c52de60f5d2556c3aL128-L140 (camera.py L128-140) If I revert that bit of code then the stream works correctly. It seems that when async_aiohttp_proxy_web is used instead of async_aiohttp_proxy_stream the request times out.

hagaholm added a commit to hagaholm/Home-AssistantConfig that referenced this issue Jan 19, 2021
@JensKillermann
Copy link

JensKillermann commented Jul 26, 2021

I get the same screenshot when I click on the picture card.

Environment:
Home Assistant version: 2021.7.4
Reolink camera model: RLC-511W
Camera firmware number: v3.0.0.142_20121804
relink_dev component version: v0.18

here my log:
2021-07-26 09:41:01 ERROR (MainThread) [aiohttp.server] Error handling request Traceback (most recent call last): File "/home/ubuntu/homeassistant/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request resp = await self._request_handler(request) File "/home/ubuntu/homeassistant/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle resp = await handler(request) File "/home/ubuntu/homeassistant/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl return await handler(request) File "/home/ubuntu/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware return await handler(request) File "/home/ubuntu/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/forwarded.py", line 77, in forwarded_middleware return await handler(request) File "/home/ubuntu/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/request_context.py", line 24, in request_context_middleware return await handler(request) File "/home/ubuntu/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/ban.py", line 78, in ban_middleware return await handler(request) File "/home/ubuntu/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/auth.py", line 144, in auth_middleware return await handler(request) File "/home/ubuntu/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/view.py", line 135, in handle result = await result File "/home/ubuntu/homeassistant/lib/python3.8/site-packages/homeassistant/components/camera/__init__.py", line 511, in get return await self.handle(request, camera) File "/home/ubuntu/homeassistant/lib/python3.8/site-packages/homeassistant/components/camera/__init__.py", line 546, in handle stream = await camera.handle_async_mjpeg_stream(request) File "/home/ubuntu/.homeassistant/custom_components/reolink_dev/camera.py", line 198, in handle_async_mjpeg_stream stream = CameraMjpeg(self._manager.binary) AttributeError: 'ReolinkCamera' object has no attribute '_manager'

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants