From 1f2c07681def0b5a2f174bd9937dd9a939107333 Mon Sep 17 00:00:00 2001 From: Radu Cotescu Date: Thu, 22 Sep 2022 15:05:14 +0200 Subject: [PATCH] fix #142: Cannot arm alarm with version 0.29 when no code is required for arming * when the JA-82K control panel doesn't required a code for arming and the panel is configured in unsplit mode the arming must be done by simulating a keypad press on the ABC button; sending an empty code has no effect --- custom_components/jablotron80/alarm_control_panel.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/custom_components/jablotron80/alarm_control_panel.py b/custom_components/jablotron80/alarm_control_panel.py index 006a54b..322d503 100644 --- a/custom_components/jablotron80/alarm_control_panel.py +++ b/custom_components/jablotron80/alarm_control_panel.py @@ -137,13 +137,17 @@ async def async_alarm_arm_home(self, code=None) -> None: async def async_alarm_arm_away(self, code=None) -> None: if not self._cu.is_code_required_for_arm(): code = "" - elif not self.code_arm_required : + elif not self.code_arm_required : code = self._cu._master_code if code == None: return if self._cu.mode == JA80CentralUnit.SYSTEM_MODE_UNSPLIT: - # just one zone so input code without any "kinks" - self._cu.arm(code) + # if we have received a code use it to arm the system + if len(code) > 0: + self._cu.arm(code) + # otherwise simulate an ABC key press (zone C means all zones) + else: + self._cu.arm(code, "C") elif self._cu.mode in [JA80CentralUnit.SYSTEM_MODE_PARTIAL,JA80CentralUnit.SYSTEM_MODE_SPLIT]: self._cu.arm(code,"C")