mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Constrain SimpliSafe's check for emergency token usage (#31214)
This commit is contained in:
parent
4e2737bfb7
commit
f95a072877
@ -316,7 +316,6 @@ class SimpliSafe:
|
|||||||
"""Update a system."""
|
"""Update a system."""
|
||||||
try:
|
try:
|
||||||
await system.update()
|
await system.update()
|
||||||
latest_event = await system.get_latest_event()
|
|
||||||
except InvalidCredentialsError:
|
except InvalidCredentialsError:
|
||||||
# SimpliSafe's cloud is a little shaky. At times, a 500 or 502 will
|
# SimpliSafe's cloud is a little shaky. At times, a 500 or 502 will
|
||||||
# seemingly harm simplisafe-python's existing access token _and_ refresh
|
# seemingly harm simplisafe-python's existing access token _and_ refresh
|
||||||
@ -338,7 +337,9 @@ class SimpliSafe:
|
|||||||
|
|
||||||
_LOGGER.warning("SimpliSafe cloud error; trying stored refresh token")
|
_LOGGER.warning("SimpliSafe cloud error; trying stored refresh token")
|
||||||
self._emergency_refresh_token_used = True
|
self._emergency_refresh_token_used = True
|
||||||
await self._api.refresh_access_token(self._config_entry.data[CONF_TOKEN])
|
return await self._api.refresh_access_token(
|
||||||
|
self._config_entry.data[CONF_TOKEN]
|
||||||
|
)
|
||||||
except SimplipyError as err:
|
except SimplipyError as err:
|
||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
'SimpliSafe error while updating "%s": %s', system.address, err
|
'SimpliSafe error while updating "%s": %s', system.address, err
|
||||||
@ -348,7 +349,7 @@ class SimpliSafe:
|
|||||||
_LOGGER.error('Unknown error while updating "%s": %s', system.address, err)
|
_LOGGER.error('Unknown error while updating "%s": %s', system.address, err)
|
||||||
return
|
return
|
||||||
|
|
||||||
self.last_event_data[system.system_id] = latest_event
|
self.last_event_data[system.system_id] = await system.get_latest_event()
|
||||||
|
|
||||||
# If we've reached this point using an emergency refresh token, we're in the
|
# If we've reached this point using an emergency refresh token, we're in the
|
||||||
# clear and we can discard it:
|
# clear and we can discard it:
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"name": "SimpliSafe",
|
"name": "SimpliSafe",
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/simplisafe",
|
"documentation": "https://www.home-assistant.io/integrations/simplisafe",
|
||||||
"requirements": ["simplisafe-python==6.0.0"],
|
"requirements": ["simplisafe-python==6.1.0"],
|
||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
"codeowners": ["@bachya"]
|
"codeowners": ["@bachya"]
|
||||||
}
|
}
|
||||||
|
@ -1816,7 +1816,7 @@ simplehound==0.3
|
|||||||
simplepush==1.1.4
|
simplepush==1.1.4
|
||||||
|
|
||||||
# homeassistant.components.simplisafe
|
# homeassistant.components.simplisafe
|
||||||
simplisafe-python==6.0.0
|
simplisafe-python==6.1.0
|
||||||
|
|
||||||
# homeassistant.components.sisyphus
|
# homeassistant.components.sisyphus
|
||||||
sisyphus-control==2.2.1
|
sisyphus-control==2.2.1
|
||||||
|
@ -591,7 +591,7 @@ sentry-sdk==0.13.5
|
|||||||
simplehound==0.3
|
simplehound==0.3
|
||||||
|
|
||||||
# homeassistant.components.simplisafe
|
# homeassistant.components.simplisafe
|
||||||
simplisafe-python==6.0.0
|
simplisafe-python==6.1.0
|
||||||
|
|
||||||
# homeassistant.components.sleepiq
|
# homeassistant.components.sleepiq
|
||||||
sleepyq==0.7
|
sleepyq==0.7
|
||||||
|
Loading…
x
Reference in New Issue
Block a user