Handle transport errors when updating media via events (#50481)

pull/50493/head
jjlawren 2021-05-11 16:00:56 -05:00 committed by GitHub
parent d877c0c1ff
commit 897dd012cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -722,12 +722,11 @@ class SonosSpeaker:
update_position = new_status != self.media.playback_status
self.media.playback_status = new_status
if variables:
if variables and "transport_state" in variables:
self.media.play_mode = variables["current_play_mode"]
track_uri = variables["current_track_uri"]
music_source = self.soco.music_source_from_uri(track_uri)
else:
# This causes a network round-trip so we avoid it when possible
self.media.play_mode = self.soco.play_mode
music_source = self.soco.music_source
@ -765,7 +764,7 @@ class SonosSpeaker:
self.media.title = source
self.media.source_name = source
def update_media_radio(self, variables: dict) -> None:
def update_media_radio(self, variables: dict | None) -> None:
"""Update state when streaming radio."""
self.media.clear_position()