Hi, what I’m largely unsuccesful while working with HA is random media playback. I have several automations such as playback of cartoons for kids or lunchtime playlists but I cannot get them to play randomly. I don’t almost ever want them to play in direct order as that results in me hearing the first track over and over again. I have made several threads and tried many approaches over two years, to no real avail.
I cannot get random playback to work on Kodi, Sonos nor Spotify. For example, Spotify has the “random_song: true” attribute that doesn’t do anything on my setup (also, toying with the Spotify integration often boots me out with "[spotipy.client] HTTP Error for PUT to https://api.spotify.com/v1/me/player/play with Params: {} returned 403 due to Player command failed: Restriction violated" which requires HA restart, which is not really HA’s fault but no fun nevertheless.
A different example, official documentation says this, emphasis mine:
script:
play_kodi_smp:
alias: "Turn on the silly box with ***random*** Firefighter Sam episode"
sequence:
- alias: "TV on"
service: media_player.turn_on
target:
entity_id: media_player.kodi
- service: media_player.play_media
target:
entity_id: media_player.kodi
data:
media_content_type: DIRECTORY
media_content_id: special://profile/playlists/video/feuerwehrmann_sam.xsp
Nope, not random.
I would love some sort of built-in support for this, or any help at all really. I don’t think this is too much to ask from an advanced automation system such as HA, is it? Thanks!
I assume you are using Spotcast for your Spotify playback. There is an offset parameter that you can set to choose which song in the playlist to start at. I’ll bet you can use the random sensor to dynamically assign that offset. Using this technique along with the shuffle parameter set to true would probably do what you want.
I have a slight issue that I don’t have these kids’ cartoons outside the Kodi library (meaning it has no metadata and is accessed through File/Folder hierarchy) - I don’t want it to clutter my library. That’s a an issue a bit of my own making, but anyway, this shouldn’t be so hard.
Hey,
I just stumbled over your topic here and dont know, if you already solved it.
I build a similar solution, for my kids spotify accounts, using nfc tag reader.
First of all, I created some input_selects that look for example like this: