Skip to content

Commit

Permalink
fix: treat lack of mac_dms as login failure
Browse files Browse the repository at this point in the history
mac_dms field is required for websocket. To avoid degraded operations
that generate issues, we are now removing degraded operations.
  • Loading branch information
alandtse committed May 29, 2022
1 parent 92bab7c commit d7c9a8c
Show file tree
Hide file tree
Showing 4 changed files with 251 additions and 177 deletions.
12 changes: 12 additions & 0 deletions custom_components/alexa_media/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,7 @@ async def ws_connect() -> WebsocketEchoClient:
This will only attempt one login before failing.
"""
websocket: Optional[WebsocketEchoClient] = None
email = login_obj.email
try:
if login_obj.session.closed:
_LOGGER.debug(
Expand All @@ -818,6 +819,17 @@ async def ws_connect() -> WebsocketEchoClient:
)
_LOGGER.debug("%s: Websocket created: %s", hide_email(email), websocket)
await websocket.async_run()
except AlexapyLoginError as exception_:
_LOGGER.debug(
"%s: Login Error detected from websocket: %s",
hide_email(email),
exception_,
)
hass.bus.async_fire(
"alexa_media_relogin_required",
event_data={"email": hide_email(email), "url": login_obj.url},
)
return
except BaseException as exception_: # pylint: disable=broad-except
_LOGGER.debug(
"%s: Websocket creation failed: %s", hide_email(email), exception_
Expand Down
2 changes: 1 addition & 1 deletion custom_components/alexa_media/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"issue_tracker": "https://github.com/custom-components/alexa_media_player/issues",
"dependencies": ["persistent_notification", "http"],
"codeowners": ["@alandtse", "@keatontaylor"],
"requirements": ["alexapy==1.25.5", "packaging>=20.3", "wrapt>=1.12.1"],
"requirements": ["alexapy==1.25.6", "packaging>=20.3", "wrapt>=1.12.1"],
"iot_class": "cloud_polling"
}
Loading

0 comments on commit d7c9a8c

Please sign in to comment.