Handle unhandled exceptions related to unavailable SimpliSafe features (#38812)

This commit is contained in:
Aaron Bach 2020-08-12 15:21:17 -06:00 committed by GitHub
parent 991bf126d4
commit 9e21fb6b52
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 4 deletions

View file

@ -3,7 +3,7 @@ import asyncio
from uuid import UUID
from simplipy import API
from simplipy.errors import InvalidCredentialsError, SimplipyError
from simplipy.errors import EndpointUnavailable, InvalidCredentialsError, SimplipyError
from simplipy.websocket import (
EVENT_CAMERA_MOTION_DETECTED,
EVENT_CONNECTION_LOST,
@ -555,6 +555,13 @@ class SimpliSafe:
LOGGER.error("Error while using stored refresh token: %s", err)
return
if isinstance(result, EndpointUnavailable):
# In case the user attempt an action not allowed in their current plan,
# we merely log that message at INFO level (so the user is aware,
# but not spammed with ERROR messages that they cannot change):
LOGGER.info(result)
return
if isinstance(result, SimplipyError):
LOGGER.error("SimpliSafe error while updating: %s", result)
return

View file

@ -3,6 +3,6 @@
"name": "SimpliSafe",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/simplisafe",
"requirements": ["simplisafe-python==9.2.2"],
"requirements": ["simplisafe-python==9.3.0"],
"codeowners": ["@bachya"]
}

View file

@ -1975,7 +1975,7 @@ simplehound==0.3
simplepush==1.1.4
# homeassistant.components.simplisafe
simplisafe-python==9.2.2
simplisafe-python==9.3.0
# homeassistant.components.sisyphus
sisyphus-control==2.2.1

View file

@ -893,7 +893,7 @@ sentry-sdk==0.13.5
simplehound==0.3
# homeassistant.components.simplisafe
simplisafe-python==9.2.2
simplisafe-python==9.3.0
# homeassistant.components.sleepiq
sleepyq==0.7