HomeKit Alarm Control Panel Code Exception Fix (#14025)

* Catch exception for KeyError
* Use get and added test
This commit is contained in:
Matt Schmitt authored and Paulus Schoutsen committed 2018-04-24 23:19:15 -04:00
1 parent 2bc87bfcf0
commit cb839eff0f
2 files changed
+11 -3

No files matched your search

@@ -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)