From 7940f46a6cf009065ab990af38c5c7052901a53b Mon Sep 17 00:00:00 2001 From: RenierM26 <66512715+RenierM26@users.noreply.github.com> Date: Thu, 11 Aug 2022 20:17:19 +0200 Subject: [PATCH] Fix index out of range when no stay profile for partition configured. --- custom_components/ids_hyyp/alarm_control_panel.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/custom_components/ids_hyyp/alarm_control_panel.py b/custom_components/ids_hyyp/alarm_control_panel.py index 8586369..416d030 100644 --- a/custom_components/ids_hyyp/alarm_control_panel.py +++ b/custom_components/ids_hyyp/alarm_control_panel.py @@ -66,9 +66,11 @@ def __init__( self._arm_code = arm_code self._attr_unique_id = f"{self._site_id}_{partition_id}" self._attr_code_arm_required = bool(arm_code) - self._arm_home_profile_id = list(self.partition_data["stayProfiles"])[ - 0 - ] # Supports multiple stay profiles. Assume first is arm home. + self._arm_home_profile_id = ( + (list(self.partition_data["stayProfiles"])[0]) + if self.partition_data["stayProfiles"] + else 0 + ) # Supports multiple stay profiles. Assume first is arm home. @property def available(self) -> bool: