Skip to content

Commit

Permalink
Merge pull request #509 from alandtse/#475
Browse files Browse the repository at this point in the history
fix(media_player): fix clearing of data on state change
  • Loading branch information
alandtse authored Jan 15, 2020
2 parents 1ee9556 + 4f05988 commit 9fe40d9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions custom_components/alexa_media/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ async def _refresh_if_no_audiopush(already_refreshed=False):
player_state["audioPlayerState"],
)
# allow delay before trying to refresh to avoid http 400 errors
await asyncio.sleep(0.5)
await asyncio.sleep(2)
await self.async_update()
already_refreshed = True
elif "mediaReferenceId" in player_state:
Expand Down Expand Up @@ -486,8 +486,7 @@ async def refresh(self, device=None):
session = await self.alexa_api.get_state()
await self._clear_media_details()
# update the session if it exists
if session:
self._session = session
self._session = session if session else None
if self._session and self._session.get("playerInfo"):
self._session = self._session["playerInfo"]
if self._session.get("transport"):
Expand Down

0 comments on commit 9fe40d9

Please sign in to comment.