Handle scenario where SimpliSafe code is falsey (#53912)

pull/53914/head
Aaron Bach 2021-08-03 08:56:15 -06:00 committed by GitHub
parent 56360feb9a
commit 7518c58806
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -70,8 +70,8 @@ class SimpliSafeAlarm(SimpliSafeEntity, AlarmControlPanelEntity):
"""Initialize the SimpliSafe alarm."""
super().__init__(simplisafe, system, "Alarm Control Panel")
if CONF_CODE in self._simplisafe.config_entry.options:
if self._simplisafe.config_entry.options[CONF_CODE].isdigit():
if code := self._simplisafe.config_entry.options.get(CONF_CODE):
if code.isdigit():
self._attr_code_format = FORMAT_NUMBER
else:
self._attr_code_format = FORMAT_TEXT