Skip to content

Commit

Permalink
fix: fix seen_command testing for manual refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
alandtse committed Oct 12, 2019
1 parent 8238300 commit d4ce25a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions custom_components/alexa_media/__init__.py
Expand Up @@ -678,6 +678,10 @@ async def ws_handler(message_obj):
serial = None
if command not in seen_commands:
seen_commands[command] = time.time()
_LOGGER.debug(
"Adding %s to seen_commands: %s",
command,
seen_commands)
if ('dopplerId' in json_payload and
'deviceSerialNumber' in json_payload['dopplerId']):
serial = (json_payload['dopplerId']['deviceSerialNumber'])
Expand Down
7 changes: 5 additions & 2 deletions custom_components/alexa_media/media_player.py
Expand Up @@ -179,14 +179,17 @@ async def _handle_event(self, event):
async def _refresh_if_no_audiopush():
email = self._login.email
seen_commands = ((self.hass.data[DATA_ALEXAMEDIA]['accounts']
[email]['websocket_commands'].keys())
[email]['websocket_commands'].keys()
if 'websocket_commands' in (
self.hass.data[DATA_ALEXAMEDIA]
['accounts']
[email]['websocket_commands']) else None)
[email]) else None))
if (not already_refreshed and seen_commands and
'PUSH_AUDIO_PLAYER_STATE' not in seen_commands):
# force refresh if player_state update not found, see #397
_LOGGER.debug(
"%s: No PUSH_AUDIO_PLAYER_STATE in %s; forcing refresh",
email, seen_commands)
await self.async_update()
try:
if not self.enabled:
Expand Down

0 comments on commit d4ce25a

Please sign in to comment.