Monday, 29 August 2022

Home Assistant - Google Cast Does not Support Playlists

Looking at the python code for the media_player.py component of the homeassistant cast module, it is clear that once a playlist is identified, only the first entry, playlist[0], is actually actioned.

From: https://github.com/trumpton/core/blob/dev/homeassistant/components/cast/media_player.py

try:
playlist = await parse_playlist(self.hass, media_id)
_LOGGER.debug(
"[%s %s] Playing item %s from playlist %s",
self.entity_id,
self._cast_info.friendly_name,
playlist[0].url,
media_id,
)
media_id = playlist[0].url
if title := playlist[0].title:
extra = {
**extra,
"metadata": {"title": title},
}
except PlaylistSupported as err:
_LOGGER.debug(
"[%s %s] Playlist %s is supported: %s",
self.entity_id,
self._cast_info.friendly_name,
media_id,
err,
)
except PlaylistError as err:
_LOGGER.warning(
"[%s %s] Failed to parse playlist %s: %s",
self.entity_id,
self._cast_info.friendly_name,
media_id,
err,
)