Action to Shuffle a spotify search or playlist with Music Assistant

Hey everyone; I want to write a script that will use Music Assistant to play and shuffle a playlist or even a search term; (“dog music”) and send it to a specific Music Assistant speaker.

I cannot find any documentation on how I could go about doing this; does anybody have something similar setup they would be willing to share with me so that I can take a look and figure this out ? :slight_smile:

This exact question is in the FAQ…

Shuffle Spotify/playlist/YouTube etc

You don’t shuffle the music providers you enable shuffle on the queue for the player and then whatever gets added to the queue gets shuffled. You enable shuffle on the queue from within MA by selecting the Shuffle Icon in the Player frontend or you can select the QUEUE at the bottom, then the context menu Top Right then SETTINGS then SHUFFLE ON or you can do it with yaml as follows:

action: media_player.shuffle_set
target:
  entity_id: media_player.mass_bath
data:
  shuffle: true

This is not my question. This assumes that music is already playing.

I am looking for how to start playback. How do I obtain or find the Uri to feed it…

You explicitly asked how to shuffle a playlist, the answer is that you don’t, you shuffle the player queue.

As for how to get a playlist URI or perform a search, that is also covered in the linked FAQ.

A Spotify playlist ID is easier to just copy-paste from an official Spotify client though.

Hello Lewys Martin,

Is there any particular reason you didn’t ask in the thread for Music assistant? The people that are watching that thread are all either interested. users of, or authors of Music Assistant. They are likely your best resource.

There is also a discord server for it. Not certain if this invite link still works, but here it is.