From 3de2c900f3f23e89b2182b2867b4538ad4764683 Mon Sep 17 00:00:00 2001 From: Greg Dowling Date: Mon, 25 Jan 2021 16:44:18 +0000 Subject: [PATCH] Fix Roon play_media (#45532) --- homeassistant/components/roon/media_player.py | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/roon/media_player.py b/homeassistant/components/roon/media_player.py index 9bdf4286291..8abcba189da 100644 --- a/homeassistant/components/roon/media_player.py +++ b/homeassistant/components/roon/media_player.py @@ -475,13 +475,21 @@ class RoonDevice(MediaPlayerEntity): def play_media(self, media_type, media_id, **kwargs): """Send the play_media command to the media player.""" - # media_id is treated as a path matching the Roon menu structure - path_list = split_media_path(media_id) - if not self._server.roonapi.play_media(self.zone_id, path_list): - _LOGGER.error( - "Playback request for %s / %s was unsuccessful", media_id, path_list - ) + _LOGGER.debug("Playback request for %s / %s", media_type, media_id) + if media_type in ("library", "track"): + # media_id is a roon browser id + self._server.roonapi.play_id(self.zone_id, media_id) + else: + # media_id is a path matching the Roon menu structure + path_list = split_media_path(media_id) + if not self._server.roonapi.play_media(self.zone_id, path_list): + _LOGGER.error( + "Playback request for %s / %s / %s was unsuccessful", + media_type, + media_id, + path_list, + ) def join(self, join_ids): """Add another Roon player to this player's join group."""