Issues with Still image Cameras

Hi, I’ve been having an issue since around 2021.8 with still image cameras that load weather radars from various websites. It used to be once in a while, I would need to restart HA because my cameras would be showing broken images in the dash. Restarting HA fixes the issue. However, lately its gotten much worse, dying nearly every day, sometimes multiple times a day.

I’ve tracked it to this error in the log:

Logger: aiohttp.server
Source: components/generic/camera.py:146
First occurred: 8:52:51 AM (10 occurrences)
Last logged: 10:02:43 AM

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.9/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 98, 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 138, 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 618, in get
    return await self.handle(request, camera)
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 636, in handle
    image = await _async_get_image(
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 166, in _async_get_image
    image_bytes = await camera.async_camera_image(
  File "/usr/src/homeassistant/homeassistant/components/generic/camera.py", line 146, in async_camera_image
    response = await async_client.get(
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1740, in get
    return await self.request(
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1494, in request
    response = await self.send(
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1586, in send
    response = await self._send_handling_auth(
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1616, in _send_handling_auth
    response = await self._send_handling_redirects(
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1655, in _send_handling_redirects
    response = await self._send_single_request(request, timeout)
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1699, in _send_single_request
    ) = await transport.handle_async_request(
  File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 281, in handle_async_request
    ) = await self._pool.handle_async_request(
  File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 219, in handle_async_request
    async with self._connection_acquiry_lock:
  File "/usr/local/lib/python3.9/site-packages/httpcore/_backends/base.py", line 76, in __aenter__
    await self.acquire()
  File "/usr/local/lib/python3.9/site-packages/httpcore/_backends/anyio.py", line 104, in acquire
    await self._lock.acquire()
  File "/usr/local/lib/python3.9/site-packages/anyio/_core/_synchronization.py", line 119, in acquire
    self.acquire_nowait()
  File "/usr/local/lib/python3.9/site-packages/anyio/_core/_synchronization.py", line 146, in acquire_nowait
    raise RuntimeError('Attempted to acquire an already held Lock')
RuntimeError: Attempted to acquire an already held Lock

and

Logger: homeassistant.components.generic.camera
Source: components/generic/camera.py:155
Integration: generic (documentation, issues)
First occurred: November 8, 2021, 10:33:14 AM (23 occurrences)
Last logged: 12:20:14 AM

Error getting new camera image from Weather Radar: [Errno -3] Try again
Error getting new camera image from 7 Day NY Forecast: [Errno -3] Try again
Error getting new camera image from Radar Regional Animated: [Errno -3] Try again
Error getting new camera image from 7 Day NY Forecast: All connection attempts failed

My config:

  - platform: generic
    still_image_url: http://cdn.abclocal.go.com/three/wabc/weather/16_9/hd/wabc_d_1_1280.jpg
    name: 'Weather Radar'
    framerate: 0.012
  - platform: generic
    still_image_url: https://s.w-x.co/staticmaps/wu/wu/wxtype1200_cur/usbgm/animate.png
    name: 'Radar Regional Animated'
    framerate: 0.010
  - platform: generic
    still_image_url: https://s.w-x.co/staticmaps/wu/wu/wxtype1200_cur/usbgm/current.png
    name: 'Radar Regional Current'
    framerate: 0.012

Its gotten really frustrating and Ive tried everything, originally thinking it was some kind of network or dns issue, but it doesnt appear it is.

2 Likes