Handle missing transport_state on media update in sonos (#50051)

This commit is contained in:
J. Nick Koston
2021-05-03 20:54:31 -10:00
committed by GitHub
parent 2eae87fb1b
commit 016a4433d2

View File

@@ -488,7 +488,9 @@ class SonosMediaPlayerEntity(SonosEntity, MediaPlayerEntity):
"""Update information about currently playing media.""" """Update information about currently playing media."""
variables = event and event.variables variables = event and event.variables
if variables: if variables and "transport_state" in variables:
# If the transport has an error then transport_state will
# not be set
new_status = variables["transport_state"] new_status = variables["transport_state"]
else: else:
transport_info = self.soco.get_current_transport_info() transport_info = self.soco.get_current_transport_info()