petrleocompel / hikaxpro_hacs

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

Config bug (zoneType : 24h ?) #67

Closed mced76 closed 1 year ago

mced76 commented 1 year ago

Hello, In the last release (2.1.0b7) i have an error after config HIKVision (I dont know if the error was in prior release)

The end of the log is :

2023-08-21 19:09:16.020 WARNING (SyncWorker_4) [custom_components.hikvision_axpro.model] Invalid zone type 24h
2023-08-21 19:09:16.021 WARNING (SyncWorker_4) [custom_components.hikvision_axpro.model] Detector info: {'id': 6, 'name': 'Inondation cave', 'status': 'online', 'sensorStatus': 'normal', 'tamperEvident': False, 'shielded': False, 'bypassed': False, 'armed': False, 'isArming': False, 'alarm': False, 'charge': 'normal', 'signal': 121, 'temperature': 22, 'waterDetectorAlarm': 'no', 'subSystemNo': 1, 'linkageSubSystem': [1], 'detectorType': 'waterLeakDetector', 'model': '0x00016', 'stayAway': False, 'zoneType': '24h', 'isViaRepeater': False, 'zoneAttrib': 'wireless', 'version': 'V1.0.1', 'deviceNo': 16, 'abnormalOrNot': False}
2023-08-21 19:09:16.023 WARNING (SyncWorker_4) [custom_components.hikvision_axpro.model] Invalid zone type 24h
2023-08-21 19:09:16.023 WARNING (SyncWorker_4) [custom_components.hikvision_axpro.model] Detector info: {'id': 7, 'name': 'inondation salle de bain étage', 'status': 'online', 'sensorStatus': 'normal', 'tamperEvident': False, 'shielded': False, 'bypassed': False, 'armed': False, 'isArming': False, 'alarm': False, 'charge': 'normal', 'signal': 121, 'temperature': 23, 'waterDetectorAlarm': 'no', 'subSystemNo': 1, 'linkageSubSystem': [1], 'detectorType': 'waterLeakDetector', 'model': '0x00016', 'stayAway': False, 'zoneType': '24h', 'isViaRepeater': False, 'zoneAttrib': 'wireless', 'version': 'V1.0.1', 'deviceNo': 17, 'abnormalOrNot': False}
2023-08-21 19:09:16.024 DEBUG (SyncWorker_4) [custom_components.hikvision_axpro] Zones: {'ZoneList': [{'Zone': {'id': 0, 'name': 'Couloir porte arrière', 'status': 'online', 'sensorStatus': 'normal', 'tamperEvident': False, 'shielded': False, 'bypassed': False, 'armed': False, 'isArming': False, 'alarm': False, 'charge': 'normal', 'chargeValue': 100, 'signal': 121, 'temperature': 26, 'subSystemNo': 1, 'linkageSubSystem': [1], 'detectorType': 'pircam', 'model': '0x00012', 'stayAway': False, 'zoneType': 'Delay', 'isViaRepeater': False, 'zoneAttrib': 'wireless', 'version': 'V1.0.0T', 'deviceNo': 1, 'abnormalOrNot': False}}, {'Zone': {'id': 1, 'name': 'Couloir entrée', 'status': 'online', 'sensorStatus': 'normal', 'tamperEvident': False, 'shielded': False, 'bypassed': False, 'armed': False, 'isArming': False, 'alarm': False, 'charge': 'normal', 'chargeValue': 100, 'signal': 121, 'temperature': 26, 'subSystemNo': 1, 'linkageSubSystem': [1], 'detectorType': 'passiveInfraredDetector', 'model': '0x00001', 'stayAway': True, 'zoneType': 'Delay', 'isViaRepeater': False, 'zoneAttrib': 'wireless', 'version': 'V1.0.25', 'deviceNo': 2, 'abnormalOrNot': False}}, {'Zone': {'id': 2, 'name': 'Bureau bas', 'status': 'online', 'sensorStatus': 'normal', 'tamperEvident': False, 'shielded': False, 'bypassed': False, 'armed': False, 'isArming': False, 'alarm': False, 'charge': 'normal', 'chargeValue': 100, 'signal': 121, 'temperature': 25, 'subSystemNo': 1, 'linkageSubSystem': [1], 'detectorType': 'passiveInfraredDetector', 'model': '0x00001', 'stayAway': False, 'zoneType': 'Delay', 'isViaRepeater': False, 'zoneAttrib': 'wireless', 'version': 'V1.0.25', 'deviceNo': 3, 'abnormalOrNot': False}}, {'Zone': {'id': 3, 'name': 'Etage', 'status': 'online', 'sensorStatus': 'normal', 'tamperEvident': False, 'shielded': False, 'bypassed': False, 'armed': False, 'isArming': False, 'alarm': False, 'charge': 'normal', 'chargeValue': 100, 'signal': 121, 'temperature': 29, 'subSystemNo': 1, 'linkageSubSystem': [1], 'detectorType': 'passiveInfraredDetector', 'model': '0x00001', 'stayAway': False, 'zoneType': 'Delay', 'isViaRepeater': False, 'zoneAttrib': 'wireless', 'version': 'V1.0.25', 'deviceNo': 4, 'abnormalOrNot': False}}, {'Zone': {'id': 4, 'name': 'Couloir WC', 'status': 'online', 'sensorStatus': 'normal', 'tamperEvident': False, 'shielded': False, 'bypassed': False, 'armed': False, 'isArming': False, 'alarm': False, 'charge': 'normal', 'chargeValue': 100, 'signal': 121, 'temperature': 25, 'subSystemNo': 1, 'linkageSubSystem': [1], 'detectorType': 'passiveInfraredDetector', 'model': '0x00001', 'stayAway': False, 'zoneType': 'Delay', 'isViaRepeater': False, 'zoneAttrib': 'wireless', 'version': 'V1.0.25', 'deviceNo': 5, 'abnormalOrNot': False}}, {'Zone': {'id': 5, 'name': 'Fumée Couloir', 'status': 'online', 'sensorStatus': 'normal', 'shielded': False, 'armed': False, 'isArming': False, 'alarm': False, 'charge': 'normal', 'chargeValue': 100, 'signal': 121, 'temperature': 23, 'subSystemNo': 1, 'linkageSubSystem': [1], 'detectorType': 'wirelessSmokeDetector', 'model': '0x00015', 'stayAway': False, 'zoneType': 'Fire', 'isViaRepeater': False, 'zoneAttrib': 'wireless', 'version': 'V1.0.0T', 'deviceNo': 6, 'abnormalOrNot': False}}, {'Zone': {'id': 6, 'name': 'Inondation cave', 'status': 'online', 'sensorStatus': 'normal', 'tamperEvident': False, 'shielded': False, 'bypassed': False, 'armed': False, 'isArming': False, 'alarm': False, 'charge': 'normal', 'signal': 121, 'temperature': 22, 'waterDetectorAlarm': 'no', 'subSystemNo': 1, 'linkageSubSystem': [1], 'detectorType': 'waterLeakDetector', 'model': '0x00016', 'stayAway': False, 'zoneType': '24h', 'isViaRepeater': False, 'zoneAttrib': 'wireless', 'version': 'V1.0.1', 'deviceNo': 16, 'abnormalOrNot': False}}, {'Zone': {'id': 7, 'name': 'inondation salle de bain étage', 'status': 'online', 'sensorStatus': 'normal', 'tamperEvident': False, 'shielded': False, 'bypassed': False, 'armed': False, 'isArming': False, 'alarm': False, 'charge': 'normal', 'signal': 121, 'temperature': 23, 'waterDetectorAlarm': 'no', 'subSystemNo': 1, 'linkageSubSystem': [1], 'detectorType': 'waterLeakDetector', 'model': '0x00016', 'stayAway': False, 'zoneType': '24h', 'isViaRepeater': False, 'zoneAttrib': 'wireless', 'version': 'V1.0.1', 'deviceNo': 17, 'abnormalOrNot': False}}, {'Zone': {'id': 8, 'name': 'détecteur salle à manger', 'status': 'online', 'sensorStatus': 'normal', 'tamperEvident': False, 'shielded': False, 'bypassed': False, 'armed': False, 'isArming': False, 'alarm': False, 'charge': 'normal', 'chargeValue': 100, 'signal': 121, 'temperature': 26, 'subSystemNo': 1, 'linkageSubSystem': [1], 'detectorType': 'glassBreakDetector', 'model': '0x00003', 'stayAway': False, 'zoneType': 'Delay', 'isViaRepeater': False, 'zoneAttrib': 'wireless', 'version': 'V1.1.0', 'deviceNo': 18, 'abnormalOrNot': False}}]}
2023-08-21 19:09:16.051 DEBUG (SyncWorker_4) [custom_components.hikvision_axpro] { "ExDevStatus": { "OutputModList": [ { "OutputMod": { "id": 1, "seq": "Q05637905", "status": "online", "model": "0x71001", "relayList": [ { "id": 0, "name": "Relais 1", "subSystem": [ 1 ], "status": "on", "scenarioType": [ "alarm", "manual" ] } ], "deviceNo": 7, "version": "V1.0.0", "tamperEvident": false, "signal": 121, "temperature": 41, "isViaRepeater": false, "voltValue": 14, "voltValueV20": 14.200, "abnormalOrNot": false } } ], "OutputList": [ { "Output": { "id": 0, "name": "Relais 1", "status": "on", "charge": "normal", "chargeValue": 14, "linkage": "manualCtrl", "signal": 121, "temperature": 41, "subSystemList": [ 1 ], "relayAttrib": "wireless", "version": "V1.0.0", "deviceNo": 7 } } ], "SirenList": [ { "Siren": { "id": 1, "name": "Sirène interieur", "seq": "Q03801748", "status": "off", "tamperEvident": false, "charge": "normal", "chargeValue": 100, "signal": 121, "model": "0x7A001", "temperature": 29, "subSystemList": [ 1 ], "sirenColor": "white", "isViaRepeater": false, "version": "V1.0.20", "deviceNo": 8, "abnormalOrNot": false } }, { "Siren": { "id": 2, "name": "Sirène 2", "seq": "Q04333478", "status": "off", "tamperEvident": false, "charge": "normal", "chargeValue": 100, "signal": 121, "model": "0x7D001", "temperature": 25, "subSystemList": [ 1 ], "sirenColor": "orange", "isViaRepeater": false, "version": "V1.0.20", "deviceNo": 9, "abnormalOrNot": false } } ], "RepeaterList": [ ], "CardReaderList": [ ], "KeypadList": [ { "Keypad": { "id": 1, "seq": "Q03613239", "name": "Clavier 1", "status": "online", "tamperEvident": false, "charge": "normal", "chargeValue": 100, "signal": 121, "model": "0x92000", "temperature": 25, "subSystemList": [ 1 ], "isViaRepeater": false, "version": "V1.0.25", "deviceNo": 11, "abnormalOrNot": false } } ], "RemoteList": [ { "Remote": { "id": 1, "name": "porte-clés cedric", "seq": "Q02973748", "charge": "normal", "isViaRepeater": false, "subSystemList": [ 1 ], "SelKeyList": [ { "SelKey": { "key": 3, "func": "queryArmState" } }, { "SelKey": { "key": 4, "func": "stayArming" } } ], "CombKeyList": [ { "CombKey": { "keys": "13", "func": "" } }, { "CombKey": { "keys": "24", "func": "" } }, { "CombKey": { "keys": "34", "func": "" } }, { "CombKey": { "keys": "12", "func": "" } } ], "relatedNetUserName": "sv6xjh", "userNickName": "CedAdmin", "version": "V1.0.2", "deviceNo": 10, "abnormalOrNot": false } } ], "TransmitterList": [ ] } }
2023-08-21 19:09:16.055 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Hikvision_axpro_192.168.0.113 for hikvision_axpro
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 388, 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 182, in init_device
    self._update_data()
  File "/config/custom_components/hikvision_axpro/__init__.py", line 285, in _update_data
    devices_status = self._load_ext_devices_status()
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/__init__.py", line 214, in _load_ext_devices_status
    return ExDevStatusResponse.from_dict(response.json())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/model.py", line 2505, in from_dict
    ex_dev_status = from_union([ExDevStatus.from_dict, from_none], obj.get("ExDevStatus"))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/model.py", line 43, in from_union
    assert False
AssertionError
2023-08-21 19:09:18.596 DEBUG (MainThread) [custom_components.hikvision_axpro.config_flow] Saving options Hikvision_axpro_192.168.0.113 {'host': '192.168.0.113', 'username': 'svxxxxxxxxx', 'password': 'xxxxxxxxxxxxx', 'enabled': True, 'code_format': 'NUMBER', 'code': '9999', 'use_code_arming': False, 'scan_interval': 30, 'allow_subsystems': True, 'internal_api': False, 'debug': False}

An Idea ? Thanks a lot

petrleocompel commented 1 year ago

I did not saw on first glance the problem. I have to try parse the response. Maybe tomorrow could be fixed

petrleocompel commented 1 year ago

Fixed in v2.1.0-beta8

mced76 commented 1 year ago

Yes, it works ! Thx a lot