fwestenberg / reolink_dev

Home Assistant Reolink addon
MIT License
550 stars 102 forks source link

Camera Stream not Loading in HA #134

Open ScottRoach opened 3 years ago

ScottRoach commented 3 years ago

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:

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

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: https://github.com/fwestenberg/reolink_dev/commit/a8cecc255131607fa741b02781b8ce814619cc38#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.

JensKillermann commented 3 years ago

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'