HomeKit Alarm Control Panel Code Exception Fix (#14025)
* Catch exception for KeyError * Use get and added test
This commit is contained in:
parent
4c23a61853
commit
51f55bddb7
2 changed files with 11 additions and 3 deletions
|
@ -30,7 +30,7 @@ class SecuritySystem(HomeAccessory):
|
|||
def __init__(self, *args, config):
|
||||
"""Initialize a SecuritySystem accessory object."""
|
||||
super().__init__(*args, category=CATEGORY_ALARM_SYSTEM)
|
||||
self._alarm_code = config[ATTR_CODE]
|
||||
self._alarm_code = config.get(ATTR_CODE)
|
||||
self.flag_target_state = False
|
||||
|
||||
serv_alarm = add_preload_service(self, SERV_SECURITY_SYSTEM)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue