Skip to content

Commit

Permalink
fix: missing detector wiring and access mode #53
Browse files Browse the repository at this point in the history
  • Loading branch information
petrleocompel committed Jul 5, 2023
1 parent f8f9855 commit f16cb5e
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions custom_components/hikvision_axpro/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@ def to_dict(self) -> dict:

class DetectorAccessMode(Enum):
NO = "NO"
NC = "NC"


class DetectorWiringMode(Enum):
Expand Down Expand Up @@ -694,8 +695,18 @@ def from_dict(obj: Any) -> 'ZoneConfig':
final_door_exit_enabled = from_union([from_bool, from_none], obj.get("finalDoorExitEnabled"))
time_restart_enabled = from_union([from_bool, from_none], obj.get("timeRestartEnabled"))
swinger_limit_activation = from_union([from_int, from_none], obj.get("swingerLimitActivation"))
detector_wiring_mode = from_union([DetectorWiringMode, from_none], obj.get("detectorWiringMode"))
detector_access_mode = from_union([DetectorAccessMode, from_none], obj.get("detectorAccessMode"))
try:
detector_wiring_mode = from_union([DetectorWiringMode, from_none], obj.get("detectorWiringMode"))
except:
_LOGGER.warning("Invalid detector_wiring_mode %s", obj.get("detectorWiringMode"))
_LOGGER.warning("Detector info: %s", obj)
detector_wiring_mode = None
try:
detector_access_mode = from_union([DetectorAccessMode, from_none], obj.get("detectorAccessMode"))
except:
_LOGGER.warning("Invalid detector_access_mode %s", obj.get("detectorAccessMode"))
_LOGGER.warning("Detector info: %s", obj)
detector_access_mode = None
anti_masking_enabled = from_union([from_bool, from_none], obj.get("antiMaskingEnabled"))
am_mode = from_union([AMMode, from_none], obj.get("AMMode"))
am_delay_time = from_union([from_int, from_none], obj.get("AMDelayTime"))
Expand Down

0 comments on commit f16cb5e

Please sign in to comment.