rroller / dahua

Dahua Camera and Doorbell Home Assistant Integration
MIT License
395 stars 79 forks source link

Support of DH-SD22404T-GN #85

Closed nakoukal closed 3 years ago

nakoukal commented 3 years ago

Hi my dahua version is DH-SD22404T-GN. I have last version of integration running on RPI4 Home Assistant core v: 2021.9.6

Before this integration i connected dahua with amcrest. All worked great, i installed this integration and few days works without problems but now i have this errors .... Is this version supported ? Thanks for help. Screenshot_20210914-205653

Log


Logger: homeassistant.components.stream.worker
Source: components/stream/worker.py:323
Integration: Stream (documentation, issues)
First occurred: 12:39:32 (1 occurrences)
Last logged: 12:39:32

Error opening stream rtsp://****:****@192.168.1.108:554/cam/realmonitor?channel=0&subtype=1

Debug log


2021-09-13 12:39:32 ERROR (stream_worker) [libav.rtsp] method OPTIONS failed: 404 Not Found
2021-09-13 12:39:32 ERROR (stream_worker) [homeassistant.components.stream.worker] Error opening stream rtsp://****:****@192.168.1.108:554/cam/realmonitor?channel=0&subtype=1
2021-09-13 12:40:18 WARNING (MainThread) [custom_components.dahua] Failed to sync device state
Traceback (most recent call last):
  File "/config/custom_components/dahua/client.py", line 606, in get_bytes
    response = await auth.request("GET", self._base + url)
  File "/config/custom_components/dahua/digest.py", line 50, in request
    return await self._handle_401(response)
  File "/config/custom_components/dahua/digest.py", line 151, in _handle_401
    return await self.request(
  File "/config/custom_components/dahua/digest.py", line 46, in request
    response = await self.session.request(method, url, headers=headers, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/client.py", line 544, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 890, in start
    message, payload = await self._protocol.read()  # type: ignore
  File "/usr/local/lib/python3.9/site-packages/aiohttp/streams.py", line 604, in read
    await self._waiter
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/dahua/__init__.py", line 171, in _async_update_data
    await self.client.async_get_snapshot(0)
  File "/config/custom_components/dahua/client.py", line 67, in async_get_snapshot
    return await self.get_bytes(url)
  File "/config/custom_components/dahua/client.py", line 612, in get_bytes
    response.close()
  File "/usr/local/lib/python3.9/site-packages/async_timeout/__init__.py", line 55, in __aexit__
    self._do_exit(exc_type)
  File "/usr/local/lib/python3.9/site-packages/async_timeout/__init__.py", line 92, in _do_exit
    raise asyncio.TimeoutError
asyncio.exceptions.TimeoutError
2021-09-13 12:40:18 WARNING (MainThread) [homeassistant.config_entries] Config entry 'dah-home01' for dahua integration not ready yet; Retrying in background
2021-09-13 12:40:22 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/dahua/__init__.py", line 603, in async_reload_entry
    await async_unload_entry(hass, entry)
  File "/config/custom_components/dahua/__init__.py", line 583, in async_unload_entry
    coordinator = hass.data[DOMAIN][entry.entry_id]
KeyError: 'a59e9b1616b9e49fbceab75c6b01e31b'
2021-09-13 12:40:33 WARNING (MainThread) [custom_components.dahua] Failed to sync device state
Traceback (most recent call last):
  File "/config/custom_components/dahua/client.py", line 606, in get_bytes
    response = await auth.request("GET", self._base + url)
  File "/config/custom_components/dahua/digest.py", line 50, in request
    return await self._handle_401(response)
  File "/config/custom_components/dahua/digest.py", line 151, in _handle_401
    return await self.request(
  File "/config/custom_components/dahua/digest.py", line 46, in request
    response = await self.session.request(method, url, headers=headers, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/client.py", line 544, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 890, in start
    message, payload = await self._protocol.read()  # type: ignore
  File "/usr/local/lib/python3.9/site-packages/aiohttp/streams.py", line 604, in read
    await self._waiter
asyncio.exceptions.CancelledError
rroller commented 3 years ago

Looks like you are getting a TimeoutError. Some of these cameras are pretty crappy and get overloaded if you stream or stream from too many concurrent devices. Not a lot I can do here. Just try to make sure you aren't pulling multiple streams or overloading the camera somehow.