petrleocompel / hikaxpro_hacs

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

DS-PM1-I1-WE - Undocumented type #55

Closed petrleocompel closed 1 year ago

petrleocompel commented 1 year ago

I've recently added the DS-PM1-I1-WE input transmitter (to add external contact sensor) https://www.hikvision.com/en/products/Alarm-Products/wireless-intrusion-alarm/ax-pro/ds-pm1-i1-we/ but once added the integration would fail to reload giving this error.

Can it be added (or at least ignored) so that the integration would load correctly?

This error originated from a custom integration.

Logger: homeassistant.config_entries
Source: custom_components/hikvision_axpro/model.py:43
Integration: hikvision_axpro
First occurred: 09:38:05 (1 occurrences)
Last logged: 09:38:05

Error setting up entry AX PRO M2H for hikvision_axpro
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 390, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/__init__.py", line 105, 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 177, in init_device
    self.load_devices()
  File "/config/custom_components/hikvision_axpro/__init__.py", line 181, in load_devices
    devices = self._load_devices()
              ^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/__init__.py", line 194, in _load_devices
    return ZonesConf.from_dict(response.json())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/model.py", line 887, in from_dict
    list = from_list(ListElement.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 871, in from_dict
    zone = ZoneConfig.from_dict(obj.get("Zone"))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/model.py", line 720, in from_dict
    access_module_type = from_union([AccessModuleType, from_none], obj.get("accessModuleType"))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/model.py", line 43, in from_union
    assert False
AssertionError
<deviceName>AX PRO</deviceName>
<deviceID>48513132-3934-3534-3937-acb92feea921</deviceID>
<model>DS-PWA96-M2H-WE</model>
<serialNumber>DS-PWA96-M2H-WE20220420AAWRQ12945497WU</serialNumber>
<macAddress>ac:b9:2f:ee:a9:21</macAddress>
<firmwareVersion>V1.2.88</firmwareVersion>
<firmwareReleasedDate>build 230216</firmwareReleasedDate>
<hardwareVersion>0x1000</hardwareVersion>
<encoderVersion>V1.0</encoderVersion>
<encoderReleasedDate>build 000000</encoderReleasedDate>
<deviceType>PWA</deviceType>
<telecontrolID>1</telecontrolID>
<charEncodeFormat>GB2312</charEncodeFormat>
<languageType opt="english,spanish,portuguese,italian,french,russian,german,polish,czech,greek,turkish,dutch,hungarian,croatian,ukrainian,brazilianPortuguese,slovenian,swedish,norwegian,romanian,danish,slovak,serbian,bulgarian,hebrew,lithuanian,anglicism,estonian,latvian">english</languageType>
<customizedInfo></customizedInfo>
</DeviceInfo>
2023-07-30 09:38:05.606 DEBUG (SyncWorker_43) [custom_components.hikvision_axpro] {'DeviceInfo': {'@version': '2.0', '@xmlns': 'http://www.hikvision.com/ver20/XMLSchema', 'deviceName': 'AX PRO', 'deviceID': '48513132-3934-3534-3937-acb92feea921', 'model': 'DS-PWA96-M2H-WE', 'serialNumber': 'DS-PWA96-M2H-WE20220420AAWRQ12945497WU', 'macAddress': 'ac:b9:2f:ee:a9:21', 'firmwareVersion': 'V1.2.88', 'firmwareReleasedDate': 'build 230216', 'hardwareVersion': '0x1000', 'encoderVersion': 'V1.0', 'encoderReleasedDate': 'build 000000', 'deviceType': 'PWA', 'telecontrolID': '1', 'charEncodeFormat': 'GB2312', 'languageType': {'@opt': 'english,spanish,portuguese,italian,french,russian,german,polish,czech,greek,turkish,dutch,hungarian,croatian,ukrainian,brazilianPortuguese,slovenian,swedish,norwegian,romanian,danish,slovak,serbian,bulgarian,hebrew,lithuanian,anglicism,estonian,latvian', '#text': 'english'}, 'customizedInfo': None}}
2023-07-30 09:38:05.624 DEBUG (SyncWorker_43) [custom_components.hikvision_axpro] { "List": [ { "Zone": { "id": 0, "zoneName": "Contatto Porta", "detectorType": "magneticContact", "zoneType": "Delay", "subSystemNo": 1, "linkageSubSystem": [ 1 ], "supportLinkageSubSystemList": [ 1 ], "enterDelay": 30, "exitDelay": 1, "stayArmDelayTime": 1, "sirenDelayTime": 0, "stayAwayEnabled": false, "chimeEnabled": false, "silentEnabled": false, "chimeWarningType": "single", "timeoutType": "recover", "timeout": 30, "relateDetector": true, "RelatedChanList": [ { "RelatedChan": { "relator": "app", "cameraSeq": "", "relatedChan": 0, "linkageCameraName": "" } } ], "doubleKnockEnabled": false, "doubleKnockTime": 5, "CrossZoneCfg": { "isAssociated": false, "supportAssociatedZone": [ 1, 2 ], "alreadyAssociatedZone": [ ], "supportLinkageChannelID": [ ], "alreadyLinkageChannelID": [ ], "associateTime": 1800 }, "newKeyZoneTriggerTypeCfg": "zoneStatus", "zoneStatusCfg": "triggerArm", "armNoBypassEnabled": false, "RelatedPIRCAM": { "supportLinkageZones": [ ], "linkageZone": [ ], "linkagePIRCAMName": "" }, "finalDoorExitEnabled": false, "timeRestartEnabled": false, "armMode": "and", "swingerLimitActivation": 3, "detectorWiringMode": "SEOL", "detectorAccessMode": "NC", "antiMaskingEnabled": true, "AMMode": "arm", "AMDelayTime": 60, "pulseSensitivity": 250, "alarmResistence": 2.2, "tamperResistence": 2.2, "moduleChannel": 1, "doubleZoneCfgEnable": false, "accessModuleType": "localTransmitter", "zoneAttrib": "wired" } }, { "Zone": { "id": 1, "zoneName": "Sensore Living", "detectorType": "indoorDualTechnologyDetector", "zoneType": "Instant", "subSystemNo": 1, "linkageSubSystem": [ 1 ], "supportLinkageSubSystemList": [ 1 ], "enterDelay": 30, "exitDelay": 30, "stayArmDelayTime": 30, "sirenDelayTime": 0, "stayAwayEnabled": false, "chimeEnabled": false, "silentEnabled": false, "chimeWarningType": "single", "timeoutType": "recover", "timeout": 30, "relateDetector": true, "detectorSeq": "Q12076044", "RelatedChanList": [ { "RelatedChan": { "relator": "app", "cameraSeq": "", "relatedChan": 0, "linkageCameraName": "" } } ], "doubleKnockEnabled": false, "doubleKnockTime": 5, "CrossZoneCfg": { "isAssociated": false, "supportAssociatedZone": [ 0, 2 ], "alreadyAssociatedZone": [ ], "supportLinkageChannelID": [ ], "alreadyLinkageChannelID": [ ], "associateTime": 1800 }, "newKeyZoneTriggerTypeCfg": "zoneStatus", "zoneStatusCfg": "triggerArm", "armNoBypassEnabled": false, "RelatedPIRCAM": { "supportLinkageZones": [ ], "linkageZone": [ ], "linkagePIRCAMName": "" }, "armMode": "and", "zoneAttrib": "wireless" } }, { "Zone": { "id": 2, "zoneName": "Test", "detectorType": "other", "zoneType": "Instant", "subSystemNo": 1, "linkageSubSystem": [ 1 ], "supportLinkageSubSystemList": [ 1 ], "enterDelay": 30, "exitDelay": 30, "stayArmDelayTime": 30, "sirenDelayTime": 0, "stayAwayEnabled": false, "chimeEnabled": false, "silentEnabled": false, "chimeWarningType": "single", "timeoutType": "recover", "timeout": 30, "RelatedChanList": [ { "RelatedChan": { "cameraSeq": "", "relatedChan": 0, "linkageCameraName": "" } } ], "doubleKnockEnabled": false, "doubleKnockTime": 5, "CrossZoneCfg": { "isAssociated": false, "supportAssociatedZone": [ 0, 1 ], "alreadyAssociatedZone": [ ], "supportLinkageChannelID": [ ], "alreadyLinkageChannelID": [ ], "associateTime": 1800 }, "newKeyZoneTriggerTypeCfg": "zoneStatus", "zoneStatusCfg": "triggerArm", "armNoBypassEnabled": false, "RelatedPIRCAM": { "supportLinkageZones": [ ], "linkageZone": [ ], "linkagePIRCAMName": "" }, "finalDoorExitEnabled": false, "timeRestartEnabled": false, "armMode": "and", "swingerLimitActivation": 3, "detectorContactMode": "NC", "impulseCountTime": 20, "impulsesBeforeAlarm": 8, "detectorInputMode": "pulse", "detectorTamperMode": "NC", "accessModuleType": "transmitter", "relatedAccessModuleID": 1, "zoneAttrib": "wired" } } ] }
2023-07-30 09:38:05.628 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry AX PRO M2H for hikvision_axpro
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 390, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/hikvision_axpro/__init__.py", line 105, 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 177, in init_device
self.load_devices()
File "/config/custom_components/hikvision_axpro/__init__.py", line 181, in load_devices
devices = self._load_devices()
^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/hikvision_axpro/__init__.py", line 194, in _load_devices
return ZonesConf.from_dict(response.json())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/hikvision_axpro/model.py", line 887, in from_dict
list = from_list(ListElement.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 871, in from_dict
zone = ZoneConfig.from_dict(obj.get("Zone"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/hikvision_axpro/model.py", line 720, in from_dict
access_module_type = from_union([AccessModuleType, from_none], obj.get("accessModuleType"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/hikvision_axpro/model.py", line 43, in from_union
assert False
AssertionError

_Originally posted by @r0bb10 in https://github.com/petrleocompel/hikaxpro_hacs/issues/14#issuecomment-1657069770_