rroller / dahua

Dahua Camera and Doorbell Home Assistant Integration
MIT License
382 stars 73 forks source link

Integration not starting in 0.9.45 #280

Closed TECH7Fox closed 1 year ago

TECH7Fox commented 1 year ago

I just updated the integration, but now the integration fails to start.

Logs:

2023-05-28 22:40:21.991 ERROR (MainThread) [custom_components.dahua] Failed to initialize device at 192.168.2.73
Traceback (most recent call last):
  File "/config/custom_components/dahua/__init__.py", line 263, in _async_update_data_int
    is_doorbell = self.is_doorbell()
  File "/config/custom_components/dahua/__init__.py", line 553, in is_doorbell
    return m.startswith("VTO") or m.startswith("DH-VTO") or ( "NVR" not in m and m.startswitch("DHI")) or self.is_amcrest_doorbell()
AttributeError: 'str' object has no attribute 'startswitch'
2023-05-28 22:40:22.015 ERROR (MainThread) [custom_components.dahua] Unexpected error fetching dahua data: Dahua device at 192.168.2.73 isn't fully initialized yet
Traceback (most recent call last):
  File "/config/custom_components/dahua/__init__.py", line 263, in _async_update_data_int
    is_doorbell = self.is_doorbell()
  File "/config/custom_components/dahua/__init__.py", line 553, in is_doorbell
    return m.startswith("VTO") or m.startswith("DH-VTO") or ( "NVR" not in m and m.startswitch("DHI")) or self.is_amcrest_doorbell()
AttributeError: 'str' object has no attribute 'startswitch'

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

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _async_refresh
    self.data = await self._async_update_data()
  File "/config/custom_components/dahua/__init__.py", line 187, in _async_update_data
    data = await self._async_update_data_int()
  File "/config/custom_components/dahua/__init__.py", line 305, in _async_update_data_int
    raise PlatformNotReady("Dahua device at " + self._address + " isn't fully initialized yet") from exception
homeassistant.exceptions.PlatformNotReady: Dahua device at 192.168.2.73 isn't fully initialized yet
2023-05-28 22:40:22.028 WARNING (MainThread) [homeassistant.config_entries] Config entry '(device name redacted)' for dahua integration not ready yet: Dahua device at 192.168.2.73 isn't fully initialized yet; Retrying in background

Running on HA core: 2023.5.0

It worked with the previous version 0.9.44

Tried to delete and setup the integration again, but got the same error.

rroller commented 1 year ago

Thanks for reporting. Checking it out...

rroller commented 1 year ago

Can you please try 0.9.46? https://github.com/rroller/dahua/releases/tag/0.9.46

TECH7Fox commented 1 year ago

0.9.46 works for me, thanks for the quick fix!

TECH7Fox commented 1 year ago

Btw I just tried the NFC and it works great!