Fix SimpliSafe to work with new MFA (#38097)

* Fix SimpliSafe to work with new MFA

* Code review (part 1)

* Input needed from Martin

* Code review

* Code review

* Restore YAML

* Tests

* Code review

* Remove JSON patching in tests

* Add reauth test

* One more reauth test

* Don't abuse the word "conf"

* Update homeassistant/components/simplisafe/config_flow.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Test coverage

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
Aaron BachandMartin Hjelmare authored and GitHub committed 2020-07-23 20:02:29 -06:00
1 parent 2dfd767b8c
commit a5b7a2c228
11 files changed
+314 -116

No files matched your search

+3 -7
View File
@@ -1,6 +1,4 @@
"""Support for SimpliSafe locks."""
import logging
from simplipy.errors import SimplipyError
from simplipy.lock import LockStates
from simplipy.websocket import EVENT_LOCK_LOCKED, EVENT_LOCK_UNLOCKED
@@ -9,9 +7,7 @@ from homeassistant.components.lock import LockEntity
from homeassistant.core import callback
from . import SimpliSafeEntity
from .const import DATA_CLIENT, DOMAIN
_LOGGER = logging.getLogger(__name__)
from .const import DATA_CLIENT, DOMAIN, LOGGER
ATTR_LOCK_LOW_BATTERY = "lock_low_battery"
ATTR_JAMMED = "jammed"
@@ -52,7 +48,7 @@ class SimpliSafeLock(SimpliSafeEntity, LockEntity):
try:
await self._lock.lock()
except SimplipyError as err:
_LOGGER.error('Error while locking "%s": %s', self._lock.name, err)
LOGGER.error('Error while locking "%s": %s', self._lock.name, err)
return
self._is_locked = True
@@ -62,7 +58,7 @@ class SimpliSafeLock(SimpliSafeEntity, LockEntity):
try:
await self._lock.unlock()
except SimplipyError as err:
_LOGGER.error('Error while unlocking "%s": %s', self._lock.name, err)
LOGGER.error('Error while unlocking "%s": %s', self._lock.name, err)
return
self._is_locked = False