Remove duplicated options handling in SimpliSafe (#41806)
* Remove duplicated options handling in SimpliSafe * Incorrect property name
This commit is contained in:
parent
368bc0c34b
commit
db7c16162d
2 changed files with 17 additions and 18 deletions
|
@ -119,11 +119,11 @@ class SimpliSafeAlarm(SimpliSafeEntity, AlarmControlPanelEntity):
|
|||
@property
|
||||
def code_format(self):
|
||||
"""Return one or more digits/characters."""
|
||||
if not self._simplisafe.options.get(CONF_CODE):
|
||||
if not self._simplisafe.config_entry.options.get(CONF_CODE):
|
||||
return None
|
||||
if isinstance(self._simplisafe.options[CONF_CODE], str) and re.search(
|
||||
"^\\d+$", self._simplisafe.options[CONF_CODE]
|
||||
):
|
||||
if isinstance(
|
||||
self._simplisafe.config_entry.options[CONF_CODE], str
|
||||
) and re.search("^\\d+$", self._simplisafe.config_entry.options[CONF_CODE]):
|
||||
return FORMAT_NUMBER
|
||||
return FORMAT_TEXT
|
||||
|
||||
|
@ -140,10 +140,10 @@ class SimpliSafeAlarm(SimpliSafeEntity, AlarmControlPanelEntity):
|
|||
@callback
|
||||
def _is_code_valid(self, code, state):
|
||||
"""Validate that a code matches the required one."""
|
||||
if not self._simplisafe.options.get(CONF_CODE):
|
||||
if not self._simplisafe.config_entry.options.get(CONF_CODE):
|
||||
return True
|
||||
|
||||
if not code or code != self._simplisafe.options[CONF_CODE]:
|
||||
if not code or code != self._simplisafe.config_entry.options[CONF_CODE]:
|
||||
LOGGER.warning(
|
||||
"Incorrect alarm code entered (target state: %s): %s", state, code
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue