dahua: 0.9.66 Failed to Sync Device State

One of my cameras stopped working after upgrading to 0.9.66. It’s possible the camera stopped working on an earlier version and I did not notice. I’m getting a 403 forbidden error. My other 3 cameras work fine.

Camera model: IPC-T54IR-ZE

Logs

2024-11-04 14:41:23.572 DEBUG (MainThread) [custom_components.dahua] ClientError fetching information from http://192.168.1.62:80/cgi-bin/configManager.cgi?action=getConfig&name=DisableEventNotify
2024-11-04 14:41:23.574 WARNING (MainThread) [custom_components.dahua] Failed to sync device state for 192.168.1.62. See README to enable debug logs to get full exception
2024-11-04 14:41:23.574 DEBUG (MainThread) [custom_components.dahua] Failed to sync device state for 192.168.1.62
aiohttp.client_exceptions.ClientResponseError: 403, message='Forbidden', url='http://192.168.1.62/cgi-bin/configManager.cgi?action=getConfig&name=DisableEventNotify'
2024-11-04 14:41:56.984 DEBUG (MainThread) [custom_components.dahua] ClientError fetching information from http://192.168.1.62:80/cgi-bin/configManager.cgi?action=getConfig&name=DisableEventNotify

2024-11-04 14:41:23.574 DEBUG (MainThread) [custom_components.dahua] Failed to sync device state for 192.168.1.62
Traceback (most recent call last):
  File "/config/custom_components/dahua/__init__.py", line 334, in _async_update_data
    results = await asyncio.gather(*coros)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/dahua/client.py", line 655, in async_get_event_notifications
    return await self.get(url)
           ^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/dahua/client.py", line 812, in get
    raise exception
  File "/config/custom_components/dahua/client.py", line 795, in get
    response.raise_for_status()
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 1121, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 403, message='Forbidden', url='http://192.168.1.62/cgi-bin/configManager.cgi?action=getConfig&name=DisableEventNotify'
2024-11-04 14:41:23.576 DEBUG (MainThread) [custom_components.dahua] Finished fetching dahua data in 8.573 seconds (success: False)

Debug

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1061, in _wrap_create_connection
    sock = await aiohappyeyeballs.start_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohappyeyeballs/impl.py", line 104, in start_connection
    raise first_exception
  File "/usr/local/lib/python3.12/site-packages/aiohappyeyeballs/impl.py", line 82, in start_connection
    sock = await _connect_sock(
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohappyeyeballs/impl.py", line 174, in _connect_sock
    await loop.sock_connect(sock, address)
  File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 641, in sock_connect
    return await fut
           ^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 681, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
OSError: [Errno 113] Connect call failed ('192.168.1.62', 80)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/dahua/__init__.py", line 197, in _async_update_data
    self._max_streams = await self.client.get_max_extra_streams() + 1
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/dahua/client.py", line 141, in get_max_extra_streams
    result = await self.get("/cgi-bin/magicBox.cgi?action=getProductDefinition&name=MaxExtraStream")
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/dahua/client.py", line 812, in get
    raise exception
  File "/config/custom_components/dahua/client.py", line 794, in get
    response = await auth.request("GET", url)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  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.12/site-packages/aiohttp/client.py", line 659, in _request
    conn = await self._connector.connect(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 557, in connect
    proto = await self._create_connection(req, traces, timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1002, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1336, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1305, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1076, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.1.62:80 ssl:default [Connect call failed ('192.168.1.62', 80)]
Screenshot 2024-11-04 at 2 56 08 PM

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 24 (6 by maintainers)

Commits related to this issue

Most upvoted comments

0.9.67 fixed the issue for me! Thanks, @brianegge!

Can confirm 0.9.67 works with DH-IPC-HDW3641TMP-AS-0280B-AUS

@jakon89 can you take a look. It seems your change last week broke many cameras.