petrleocompel / hikaxpro_hacs

HACS repository of Hikvision Ax Pro integration for home assistant
MIT License
40 stars 4 forks source link

180 wireless detector #85

Closed Yaseen14643 closed 8 months ago

Yaseen14643 commented 8 months ago

Hi, the config fails to setup after adding a 180 wireless detector. As it's not on the device list is there anyway of just ignoring it and loading the rest of the devices. Logs below:

Logger: homeassistant.config_entries
Source: config_entries.py:406
First occurred: 7:32:53 AM (1 occurrences)
Last logged: 7:32:53 AM

Error setting up entry Hikvision_axpro_192.168.68.115 for hikvision_axpro
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 406, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/__init__.py", line 107, in async_setup_entry
    await hass.async_add_executor_job(coordinator.init_device)
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/__init__.py", line 185, in init_device
    self.load_devices()
  File "/config/custom_components/hikvision_axpro/__init__.py", line 223, in load_devices
    devices = self._load_devices()
              ^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/__init__.py", line 236, in _load_devices
    return ZonesConf.from_dict(response.json())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/model.py", line 937, in from_dict
    list = from_list(ZoneConfListWrap.from_dict, obj.get("List"))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/model.py", line 29, in from_list
    return [f(y) for y in x]
           ^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/model.py", line 29, in <listcomp>
    return [f(y) for y in x]
            ^^^^
  File "/config/custom_components/hikvision_axpro/model.py", line 921, in from_dict
    zone = ZoneConfig.from_dict(obj.get("Zone"))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/model.py", line 676, in from_dict
    detector_type = DetectorType(obj.get("detectorType"))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/enum.py", line 712, in __call__
    return cls.__new__(cls, value)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/enum.py", line 1135, in __new__
    raise ve_exc
ValueError: 'wireless180PanoramicDetector' is not a valid DetectorType
petrleocompel commented 8 months ago

Perfect I will add this value

petrleocompel commented 8 months ago

Fixed in v2.1.0-beta12

still can contain problems. Just reopen issue in any case

Yaseen14643 commented 8 months ago

Perfect, thanks. I was on v2.1.0-beta11 but updated and its working again. Much appreciated.