Skip to content

Commit

Permalink
fix: Zone, AMMode model parse #94
Browse files Browse the repository at this point in the history
  • Loading branch information
petrleocompel committed Feb 1, 2024
1 parent 61aa83c commit fb11c2a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion custom_components/hikvision_axpro/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ def to_dict(self) -> dict:

class AMMode(Enum):
ARM = "arm"
DISARM = "disarm"


class ArmModeConf(Enum):
Expand Down Expand Up @@ -786,7 +787,12 @@ def from_dict(obj: Any) -> 'ZoneConfig':
_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"))
try:
am_mode = from_union([AMMode, from_none], obj.get("AMMode"))
except:
_LOGGER.warning("Invalid AMMode %s", obj.get("AMMode"))
_LOGGER.warning("Detector info: %s", obj)
am_mode = None
am_delay_time = from_union([from_int, from_none], obj.get("AMDelayTime"))
pulse_sensitivity = from_union([from_int, from_none], obj.get("pulseSensitivity"))
alarm_resistence = from_union([from_float, from_none], obj.get("alarmResistence"))
Expand Down

0 comments on commit fb11c2a

Please # to comment.