From 468803f0b9a389d677c3f5937c88a1a409f2709f Mon Sep 17 00:00:00 2001 From: David O'Neill Date: Sun, 24 Nov 2024 19:50:43 -0800 Subject: [PATCH] Fix Honeywell Night mode when using Instant (#156) Fixed knock on from previous changes to Night mode handling. If a Honeywell system was configured to use `Instant` for night mode then the alarm panel would incorrectly show `Armed Home` instead of `Armed Night`. --- .../envisalink_new/alarm_control_panel.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/custom_components/envisalink_new/alarm_control_panel.py b/custom_components/envisalink_new/alarm_control_panel.py index e08c0fb..ea8a7f6 100644 --- a/custom_components/envisalink_new/alarm_control_panel.py +++ b/custom_components/envisalink_new/alarm_control_panel.py @@ -25,6 +25,7 @@ DEFAULT_PANIC, DEFAULT_PARTITION_SET, DOMAIN, + HONEYWELL_ARM_MODE_INSTANT_VALUE, LOGGER, ) from .helpers import find_yaml_info, generate_entity_setup_info, parse_range_string @@ -160,7 +161,7 @@ def alarm_state(self) -> AlarmControlPanelState | None: if self._info["status"]["alarm"]: state = AlarmControlPanelState.TRIGGERED - elif self._info["status"]["armed_night"]: + elif self._is_night_mode(): state = AlarmControlPanelState.ARMED_NIGHT elif self._info["status"]["armed_away"]: state = AlarmControlPanelState.ARMED_AWAY @@ -231,3 +232,10 @@ async def invoke_custom_function(self, pgm, code=None): if not code: code = self._code await self._controller.controller.command_output(code, self._partition_number, pgm) + + def _is_night_mode(self) -> bool: + if self._controller.controller.panel_type == PANEL_TYPE_HONEYWELL: + if self._arm_night_mode == HONEYWELL_ARM_MODE_INSTANT_VALUE: + return self._info["status"]["armed_zero_entry_delay"] + + return self._info["status"]["armed_night"]