dahua icon indicating copy to clipboard operation
dahua copied to clipboard

cameras become unavailable

Open jdvorecky opened this issue 2 years ago • 8 comments

Hi rroller, i have some issues witht he cameras becoming unavaialable all at random times. I have tried to simulate various situations in homeassistant which could casue this but without success.

here is the log from the debuger, so i wonder if you can help me resolve this and possibly fix the problem in the Dahua plugin code? Thank you very very much in advance.

Logger: custom_components.dahua Source: custom_components/dahua/init.py:285 Integration: Dahua (documentation, issues) First occurred: 2:36:05 PM (45 occurrences) Last logged: 2:38:42 PM

Unexpected error fetching dahua data: Dahua device at 10.20.30.200 isn't fully initialized yet Traceback (most recent call last): File "/config/custom_components/dahua/client.py", line 737, in get response = await auth.request("GET", 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.10/site-packages/aiohttp/client.py", line 559, in _request await resp.start(conn) File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 898, in start message, payload = await protocol.read() # type: ignore[union-attr] File "/usr/local/lib/python3.10/site-packages/aiohttp/streams.py", line 616, 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 227, in _async_update_data await self.client.async_get_coaxial_control_io_status() File "/config/custom_components/dahua/client.py", line 160, in async_get_coaxial_control_io_status return await self.get(url) File "/config/custom_components/dahua/client.py", line 749, in get raise exception File "/config/custom_components/dahua/client.py", line 733, in get async with async_timeout.timeout(TIMEOUT_SECONDS): File "/usr/local/lib/python3.10/site-packages/async_timeout/init.py", line 129, in aexit self._do_exit(exc_type) File "/usr/local/lib/python3.10/site-packages/async_timeout/init.py", line 212, in _do_exit raise asyncio.TimeoutError asyncio.exceptions.TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh self.data = await self._async_update_data() File "/config/custom_components/dahua/init.py", line 285, in _async_update_data raise PlatformNotReady("Dahua device at " + self._address + " isn't fully initialized yet") homeassistant.exceptions.PlatformNotReady: Dahua device at 10.20.30.200 isn't fully initialized yet

jdvorecky avatar Sep 29 '22 13:09 jdvorecky

anyone else have issues with cameras becoming randomly unavailable???

jdvorecky avatar Oct 03 '22 14:10 jdvorecky

anyone else have issues with cameras becoming randomly unavailable???

I do have such issue with one of the cameras. And recently it was never working.

giedriuskilcauskas avatar Oct 08 '22 07:10 giedriuskilcauskas

Im not sure whats causing it in homeassistant, as there are no other activities that could triger this unavailability. it seems thats its just some kind of a timeout for retrieveing data from the NVR and that maybe causes it to crash. i have about 14 cameras which are included in the dahua plugin so not sure if that might be too much for it to handle and just crashes. i see various log errors like this. but i have no idea whats behind it :( it really seems random. sometimes its at 3am, sometimes cameras become unavailable three times within an hour or so. then they reconect and become avaialable again.

This error originated from a custom integration.

Logger: custom_components.dahua Source: custom_components/dahua/client.py:200 Integration: Dahua (documentation, issues) First occurred: October 4, 2022 at 2:44:58 PM (7884 occurrences) Last logged: October 9, 2022 at 8:04:19 PM

TimeoutError fetching information from https://XXXXXX:443/cgi-bin/configManager.cgi?action=getConfig&name=Lighting[5][0] TimeoutError fetching information from https://XXXXXXX:443/cgi-bin/configManager.cgi?action=getConfig&name=Lighting[15][0] TimeoutError fetching information from https://XXXXXXXX:443/cgi-bin/configManager.cgi?action=getConfig&name=Lighting[4][0] TimeoutError fetching information from https://XXXXXXXXX:443/cgi-bin/configManager.cgi?action=getConfig&name=Lighting[8][0] TimeoutError fetching information from https://XXXXXXXXX:443/cgi-bin/configManager.cgi?action=getConfig&name=Lighting[2][0]

TimeoutError fetching information from https://1XXXXXXXX:443/cgi-bin/configManager.cgi?action=getConfig&name=SmartMotionDetect

Failed to sync device state for 10.20.30.200. See README to enable debug logs to get full exception

Error fetching dahua data:

any suggestions or thoughts on this???

jdvorecky avatar Oct 10 '22 07:10 jdvorecky

I have this issue too eg - TimeoutError fetching information from http://192.168.2.94:80/cgi-bin/configManager.cgi?action=getConfig&name=General.MachineName

Even though, visiting te above URL in my browser gives a response.

Currently the doorbell does not work for me 95% of the time using the integration.


This error originated from a custom integration.

Logger: custom_components.dahua
Source: custom_components/dahua/client.py:733
Integration: Dahua (documentation, issues)
First occurred: 9:38:47 AM (2 occurrences)
Last logged: 9:41:54 AM

Failed to initialize device at 192.168.2.94
Traceback (most recent call last):
  File "/config/custom_components/dahua/client.py", line 737, in get
    response = await auth.request("GET", 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.10/site-packages/aiohttp/client.py", line 559, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 898, in start
    message, payload = await protocol.read()  # type: ignore[union-attr]
  File "/usr/local/lib/python3.10/site-packages/aiohttp/streams.py", line 616, 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 227, in _async_update_data
    await self.client.async_get_coaxial_control_io_status()
  File "/config/custom_components/dahua/client.py", line 160, in async_get_coaxial_control_io_status
    return await self.get(url)
  File "/config/custom_components/dahua/client.py", line 749, in get
    raise exception
  File "/config/custom_components/dahua/client.py", line 733, in get
    async with async_timeout.timeout(TIMEOUT_SECONDS):
  File "/usr/local/lib/python3.10/site-packages/async_timeout/__init__.py", line 129, in __aexit__
    self._do_exit(exc_type)
  File "/usr/local/lib/python3.10/site-packages/async_timeout/__init__.py", line 212, in _do_exit
    raise asyncio.TimeoutError
asyncio.exceptions.TimeoutError

Rustymage avatar Jan 22 '23 09:01 Rustymage

Hi Anthony

Well I resolved the issue by removing one of my wifi cameras that was causing some kind of network issue.

Im not sure what exactly it was, but seems to be network related and maybe the dahua plugin was not getting fast enough of a response from the NVR and thus gave this error.

I still get it from time to time and it seems that it’s a network delay issue.

But I no longer have the devices becoming unavailable and completely breaking down the dahua addon. So its fine w me I guess.

If you figure it out, whats causing the problem, do let me know please.

Thxn and good luck.

JD

From: Anthony @.> Sent: Sunday, January 22, 2023 10:47 AM To: rroller/dahua @.> Cc: jdvorecky @.>; Author @.> Subject: Re: [rroller/dahua] cameras become unavailable (Issue #225)

I have this issue too eg - TimeoutError fetching information from http://192.168.2.94:80/cgi-bin/configManager.cgi?action=getConfig http://192.168.2.94:80/cgi-bin/configManager.cgi?action=getConfig&name=General.MachineName &name=General.MachineName

Even though, visiting te above URL in my browser gives a response.

Currently the doorbell does not work for me 95% of the time using the integration.

— Reply to this email directly, view it on GitHub https://github.com/rroller/dahua/issues/225#issuecomment-1399441832 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AWKECSC6VLOIMZ7BZD75QJLWTT62RANCNFSM6AAAAAAQYYFVP4 . You are receiving this because you authored the thread. https://github.com/notifications/beacon/AWKECSF7VOJ2WVU3YUU4N5LWTT62RA5CNFSM6AAAAAAQYYFVP6WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTSTNHE2Q.gif Message ID: @.*** @.***> >

jdvorecky avatar Jan 23 '23 07:01 jdvorecky

Thanks for the heads up. I have mine streaming perfectly over RTSP, yet still has time outs.

I'll take a harder look at my network though and report back.

Rustymage avatar Jan 23 '23 19:01 Rustymage

I have the same issue. Could the problem be related to this? https://youtu.be/pwTcZLf3wMw?t=514

Unfortunately, he doesn't say how to write or setup the curl command.

guttermonk avatar Apr 06 '23 23:04 guttermonk

my AD110 doorbell button press has been becoming unavailable with high frequency since maybe the last few releases. If I reload the integration it comes right back.

I suspect that something has changed in the timeout / retry logic as previously this would only happen if my doorbell was completely offline for some reason.

bagobones avatar Jun 07 '23 19:06 bagobones