rroller / dahua

Dahua Camera and Doorbell Home Assistant Integration
MIT License
398 stars 80 forks source link

0.9.66 Failed to Sync Device State #414

Open robertvorthman opened 1 day ago

robertvorthman commented 1 day ago

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
sebastiannowicki commented 1 day ago

same issue for my 2 Dahua cams. Other Dahua cams works fine.

lsantoro commented 18 hours ago

Same issue with my 3 IP cameras DH-IPC-HFW3849T1-AS-PV-S3 with the latest firmware: 2.840.0000000.28.R, build: 2024-08-07. Last working version: 0.9.63.

The S5 version DH-IPC-HFW3849T1-AS-PV works correctly with 0.9.64, 0.9.65 e 0.9.66.

jgverweij commented 7 hours ago

Also 0.9.66 fails with camera IPC-T5442T-ZEB - Firmware: 2.820.15OG004.0.R,build:2021-07-29 So does 0.9.64 But 0.9.63 is fine

jgverweij commented 7 hours ago

error.log

brianegge commented 1 hour ago

Same with my four dahua cameras. My three amcrest and eight lorex ones are fine.

sasukebinbin commented 1 hour ago

Same with my four Imou cameras connected with dahua NVR.

sasukebinbin commented 1 hour ago

Just made a test, the last working version is 0.9.60