From 51ec2517ff283944b6eda438b238d0d168dfde9b Mon Sep 17 00:00:00 2001 From: "Alan D. Tse" Date: Sun, 27 Sep 2020 14:16:28 -0700 Subject: [PATCH] fix: catch login errors for bluetooth/lastcalled --- custom_components/alexa_media/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/custom_components/alexa_media/__init__.py b/custom_components/alexa_media/__init__.py index 6e303a95..e50f2f84 100644 --- a/custom_components/alexa_media/__init__.py +++ b/custom_components/alexa_media/__init__.py @@ -56,7 +56,7 @@ SCAN_INTERVAL, STARTUP, ) -from .helpers import _existing_serials +from .helpers import _existing_serials, _catch_login_errors from .notify import async_unload_entry as notify_async_unload_entry from .services import AlexaMediaServices @@ -446,6 +446,7 @@ async def async_update_data(): hass.data[DATA_ALEXAMEDIA]["accounts"][email]["new_devices"] = False + @_catch_login_errors async def process_notifications(login_obj, raw_notifications=None): """Process raw notifications json.""" if not raw_notifications: @@ -488,6 +489,7 @@ async def process_notifications(login_obj, raw_notifications=None): ), ) + @_catch_login_errors async def update_last_called(login_obj, last_called=None): """Update the last called device for the login_obj. @@ -518,6 +520,7 @@ async def update_last_called(login_obj, last_called=None): ) hass.data[DATA_ALEXAMEDIA]["accounts"][email]["last_called"] = last_called + @_catch_login_errors async def update_bluetooth_state(login_obj, device_serial): """Update the bluetooth state on ws bluetooth event.""" bluetooth = await AlexaAPI.get_bluetooth(login_obj)