Write SimpliSafe alarm control panel state after arming/disarming (#47649)

* Write SimpliSafe alarm control panel state after arming/disarming

* Include locks
This commit is contained in:
Aaron Bach 2021-03-11 07:22:35 -07:00 committed by GitHub
parent cf4954fead
commit f92b75cbb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View file

@ -163,6 +163,7 @@ class SimpliSafeAlarm(SimpliSafeEntity, AlarmControlPanelEntity):
return
self._state = STATE_ALARM_DISARMED
self.async_write_ha_state()
async def async_alarm_arm_home(self, code=None):
"""Send arm home command."""
@ -178,6 +179,7 @@ class SimpliSafeAlarm(SimpliSafeEntity, AlarmControlPanelEntity):
return
self._state = STATE_ALARM_ARMED_HOME
self.async_write_ha_state()
async def async_alarm_arm_away(self, code=None):
"""Send arm away command."""
@ -193,6 +195,7 @@ class SimpliSafeAlarm(SimpliSafeEntity, AlarmControlPanelEntity):
return
self._state = STATE_ALARM_ARMING
self.async_write_ha_state()
@callback
def async_update_from_rest_api(self):

View file

@ -55,6 +55,9 @@ class SimpliSafeLock(SimpliSafeEntity, LockEntity):
LOGGER.error('Error while locking "%s": %s', self._lock.name, err)
return
self._is_locked = True
self.async_write_ha_state()
async def async_unlock(self, **kwargs):
"""Unlock the lock."""
try:
@ -63,6 +66,9 @@ class SimpliSafeLock(SimpliSafeEntity, LockEntity):
LOGGER.error('Error while unlocking "%s": %s', self._lock.name, err)
return
self._is_locked = False
self.async_write_ha_state()
@callback
def async_update_from_rest_api(self):
"""Update the entity with the provided REST API data."""