Hi all,
while researching I’ve seen a lot of threads discussing how to set e.g. Spotify playlists or radio streams in Sonos using HA. Most of them where quiet “complicated” using the media_content_id attribute from the play_media function while looking up the URL from the local Sonos API. As far as I know this does not even work with Spotify playlist, since they don’t offer a native URL.
Once I noticed in the dev-state, that every Sonos component had a Source List (marked blue):
and that this source list was completely identical to my Sonos-Favorites (on the right):
I just tried to use the select_source function from the Media Player component using the string I saw in the dev-states and what shall I say, it worked!
One example from a script of mine:
- service: media_player.select_source
data:
entity_id: media_player.kinderzimmer
source: 'KiRaKa - KiRaKa - Der KinderRadioKanal des WDR.'
I tested it for radio streams as well as for Spotify playlist and everything worked. I guess its working for every kind of service Sonos supports, as long as you have it in your Sonos favorites. This should also work in scenes, but I have not tested that yet.
So, whenever you want a playlist or stream to be available easily in HA, just add it to your Sonos favorites, look up the string and your it as a source!