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
73.58k stars 30.75k forks source link

Camera.entity: "camera.front_door" Ring Camera preview isn't working , other enities work fine. #47550

Closed Sweepr closed 3 years ago

Sweepr commented 3 years ago

The problem

Update of camera.front_door is taking over 10 seconds 10:00:23 AM – helpers/entity.py (WARNING) - message first occurred at 8:44:23 AM and shows up 5 times Time out fetching recording url for camera camera.front_door 9:59:23 AM – Ring (WARNING) - message first occurred at 8:44:23 AM and shows up 3 times Error handling request 9:43:37 AM – components/ring/camera.py (ERROR) - message first occurred at 8:43:00 AM and shows up 2 times Error fetching Ring active dings data: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) 8:42:13 AM – Ring (WARNING) - message first occurred at 8:37:13 AM and shows up 4 times

What is version of Home Assistant Core has the issue?

Home Assistant 2021.1.5-13

What was the last working version of Home Assistant Core?

Docker image: homeassistant/home-assistant latest dfae6e7d5f71

What type of installation are you running?

Home Assistant Core

Integration causing the issue

Ring

Link to integration documentation on our website

No response

Example YAML snippet

Version     2021.1.5
Installation Type   Home Assistant Core
Development     false
Supervisor  false
Docker  false
Virtual Environment     true
Python Version  3.8.7
Operating System Family     Linux
Operating System Version    4.4.59+
CPU Architecture    aarch64

Anything in the logs that might be useful for us?

2021-03-07 08:44:23 WARNING (MainThread) [homeassistant.helpers.entity] Update of camera.front_door is taking over 10 seconds
2021-03-07 08:44:23 WARNING (MainThread) [homeassistant.components.ring.camera] Time out fetching recording url for camera camera.front_door
2021-03-07 09:01:23 WARNING (MainThread) [homeassistant.helpers.entity] Update of camera.front_door is taking over 10 seconds
2021-03-07 09:01:23 WARNING (MainThread) [homeassistant.components.ring.camera] Time out fetching recording url for camera camera.front_door
2021-03-07 09:43:37 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
resp = await self._request_handler(request)
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
resp = await handler(request)
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 118, in impl
return await handler(request)
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/components/http/security_filter.py", line 56, in security_filter_middleware
return await handler(request)
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/components/http/request_context.py", line 18, in request_context_middleware
return await handler(request)
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/components/http/ban.py", line 72, in ban_middleware
return await handler(request)
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/components/http/auth.py", line 127, in auth_middleware
return await handler(request)
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/components/http/view.py", line 129, in handle
result = await result
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/components/camera/__init__.py", line 502, in get
return await self.handle(request, camera)
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/components/camera/__init__.py", line 537, in handle
return await camera.handle_async_mjpeg_stream(request)
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/components/ring/camera.py", line 136, in handle_async_mjpeg_stream
await stream.close()
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/haffmpeg/core.py", line 158, in close
await self._loop.run_in_executor(None, _close)
File "/var/packages/python38/target/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/haffmpeg/core.py", line 153, in _close
self._proc.stdin.write(b"q")
BrokenPipeError: [Errno 32] Broken pipe

Futher information: SPK used for aarch64 https://packages.synocommunity.com/homeassistant/13/homeassistant.v13.f15047[rtd1296-armada37xx-aarch64].spk from https://synocommunity.com/package/homeassistant

Version 2021.1.5-13 Update homeassistant to 2021.1.5 and Python 3.8. Date 2021-02-24 20:42:39.873587 Architectures

probot-home-assistant[bot] commented 3 years ago

ring documentation ring source (message by IssueLinks)

probot-home-assistant[bot] commented 3 years ago

Hey there @balloob, mind taking a look at this issue as its been labeled with an integration (ring) you are listed as a codeowner for? Thanks! (message by CodeOwnersMention)

smizles commented 3 years ago

@Sweepr I just started having this problem recently. I noticed a lot of those timeout error warnings started appearing in my logs sometime in May. However, the feed from the cameras still appeared in my Lovelace dashboard so I didn't think much about it. Now my Ring camera feeds usually appear as "Idle" regardless of whether I have them open with live connections in the Ring app or not. My host log file is littered with these tracebacks:

2021-06-26 17:43:21 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 76, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 144, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 511, in get
    return await self.handle(request, camera)
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 546, in handle
    stream = await camera.handle_async_mjpeg_stream(request)
  File "/usr/src/homeassistant/homeassistant/components/ring/camera.py", line 136, in handle_async_mjpeg_stream
    await stream.close()
  File "/usr/local/lib/python3.8/site-packages/haffmpeg/core.py", line 158, in close
    await self._loop.run_in_executor(None, _close)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.8/site-packages/haffmpeg/core.py", line 153, in _close
    self._proc.stdin.write(b"q")
BrokenPipeError: [Errno 32] Broken pipe

I tried deleting and re-adding the integration, which changed the problem from the feeds constantly displaying as "Idle" to just usually (9/10) displaying blank feeds with the broken graphic icon and "Idle" overlay.

firstof9 commented 3 years ago

After reloading the integration this error went away.

image

AlxSZP commented 3 years ago

Hi, I have the same issue as described above, and found the same as @smizles when dug in for more details (see below). Reloading the integration temporarily fix the issues; however, is just a stop-gap solution

Logger: aiohttp.server
Source: components/ring/camera.py:136
First occurred: 9:54:17 PM (2 occurrences)
Last logged: 9:58:42 PM
Error handling request

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 76, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 144, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 511, in get
    return await self.handle(request, camera)
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 546, in handle
    stream = await camera.handle_async_mjpeg_stream(request)
  File "/usr/src/homeassistant/homeassistant/components/ring/camera.py", line 136, in handle_async_mjpeg_stream
    await stream.close()
  File "/usr/local/lib/python3.8/site-packages/haffmpeg/core.py", line 158, in close
    await self._loop.run_in_executor(None, _close)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.8/site-packages/haffmpeg/core.py", line 153, in _close
    self._proc.stdin.write(b"q")
BrokenPipeError: [Errno 32] Broken pipe
firstof9 commented 3 years ago

The "broken pipe" message is generated when the video URL/file is updated, it's not the cause of the issue it's just a symptom. The real issue is the connection aborting.

gogreenpower commented 3 years ago

Same

`Logger: aiohttp.server Source: components/ring/camera.py:136 First occurred: 9:16:27 PM (4 occurrences) Last logged: 9:17:10 PM

Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request resp = await self._request_handler(request) File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle resp = await handler(request) File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 202, in forwarded_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 144, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, in handle result = await result File "/usr/src/homeassistant/homeassistant/components/camera/init.py", line 511, in get return await self.handle(request, camera) File "/usr/src/homeassistant/homeassistant/components/camera/init.py", line 546, in handle stream = await camera.handle_async_mjpeg_stream(request) File "/usr/src/homeassistant/homeassistant/components/ring/camera.py", line 136, in handle_async_mjpeg_stream await stream.close() File "/usr/local/lib/python3.8/site-packages/haffmpeg/core.py", line 158, in close await self._loop.run_in_executor(None, _close) File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/usr/local/lib/python3.8/site-packages/haffmpeg/core.py", line 153, in _close self._proc.stdin.write(b"q") BrokenPipeError: [Errno 32] Broken pipe`

AlxSZP commented 3 years ago

For anyone hating this issue... Not a solution; however, a way to "keep things working" I created a simple automation that reloads the integration every "x" seconds (45) but testing timing still but seems to work well... here's the code:

alias: Ring Integration reload
description: Reloads broken pipe ring integration
trigger:
  - platform: state
    entity_id: camera.front_door
    for: '00:00:45'
condition: []
action:
  - service: homeassistant.reload_config_entry
    target:
      entity_id: camera.front_door
mode: single
gogreenpower commented 3 years ago

For anyone hating this issue... Not a solution; however, a way to "keep things working" I created a simple automation that reloads the integration every "x" seconds (45) but testing timing still but seems to work well... here's the code:

alias: Ring Integration reload
description: Reloads broken pipe ring integration
trigger:
  - platform: state
    entity_id: camera.front_door
    for: '00:00:45'
condition: []
action:
  - service: homeassistant.reload_config_entry
    target:
      entity_id: camera.front_door
mode: single

thanks, your automation got my feeds back

craebby commented 3 years ago

Any news here? The workaround works only sometimes for me. Most time i see no image.

github-actions[bot] commented 3 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Sweepr commented 3 years ago

Installed:

Version core-2021.8.8
Installation Type Home Assistant Core
Development false
Supervisor false
Docker false
user sc-homeassistant
Virtual Environment true
Python Version 3.8.11
Operating System Family Linux
Operating System Version 4.4.180+
CPU Architecture aarch64
Timezone Europe/Amsterdam

`

Issue:

afbeelding

Logger: homeassistant.components.ring Source: components/ring/init.py:292 Integration: Ring (documentation, issues) First occurred: September 5, 2021, 6:33:39 PM (1507 occurrences) Last logged: November 1, 2021, 10:02:23 AM

`Error fetching Ring health data for device 54e0194c7f45: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
Error fetching Ring history data for device 54e0194c7f45: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
Error fetching Ring health data for device 54e0194c7f45: 401 Client Error: Unauthorized for url: https://api.ring.com/clients_api/doorbots/51945795/health?api_version=9
Error fetching Ring health data for device 54e0194c7f45: HTTPSConnectionPool(host='api.ring.com', port=443): Max retries exceeded with url: /clients_api/doorbots/51945795/health?api_version=9 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f67b9d460>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))
Error fetching Ring history data for device 54e0194c7f45: HTTPSConnectionPool(host='api.ring.com', port=443): Max retries exceeded with url: /clients_api/doorbots/51945795/history?api_version=9&limit=10 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f66e1bbe0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))

Logger: aiohttp.server Source: components/ring/camera.py:136 First occurred: September 5, 2021, 8:44:53 AM (7 occurrences) Last logged: 7:45:05 AM

Error handling request Traceback (most recent call last): File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request resp = await self._request_handler(request) File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle resp = await handler(request) File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl return await handler(request) File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware return await handler(request) File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/components/http/forwarded.py", line 89, in forwarded_middleware return await handler(request) File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/components/http/request_context.py", line 24, in request_context_middleware return await handler(request) File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/components/http/ban.py", line 78, in ban_middleware return await handler(request) File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/components/http/auth.py", line 144, in auth_middleware return await handler(request) File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/components/http/view.py", line 135, in handle result = await result File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/components/camera/__init__.py", line 517, in get return await self.handle(request, camera) File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/components/camera/__init__.py", line 552, in handle stream = await camera.handle_async_mjpeg_stream(request) File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/components/ring/camera.py", line 136, in handle_async_mjpeg_stream await stream.close() File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/haffmpeg/core.py", line 158, in close await self._loop.run_in_executor(None, _close) File "/var/packages/python38/target/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/haffmpeg/core.py", line 153, in _close self._proc.stdin.write(b"q") BrokenPipeError: [Errno 32] Broken pipe

Error fetching Ring device data: 503 Server Error: Service Unavailable for url: https://api.ring.com/clients_api/ring_devices?api_version=9