Sonos / Spotify / Alexa - Instructions to clear playlist and shuffle

Hi All,

I have seen a number of threads/discussions without a great answer to Sonos Shuffle and Clearing the playlist.

Please let me know if you used this or found it helpful by liking the post. I am trying to gauge how much I should be sharing what I am doing for others, so it would be good to know how much value others get from this.

Problem: Existing tools and instructions have lots of great information, however, there are some known issues. When using a media tile to trigger a Sonos playlist, there are two pain points
(1) The playlist is added to the know playing queue and the historical queue is not removed (i.e. New Playlist + Old Playlist).
(2) You are not able to easily shuffle the playlist

Here is what I did … the ?Solution-ish?

  1. Of course I started with the great tools that exist today:
    Create "Jukebox" Dashboard with Album Art for Echo or Sonos Devices

  2. Next I used a switch & contact sensor device in Smartthings to create a trigger for Alexa to pick up on. You may need to create a device handler to do this. If you do, here is one option for you to consider →
    How to: SmartThings_MyQ SmartApp using MyQ Sensors with IFTTT - How-To - SmartThings Community
    ** In these instructions you only need to follow steps 1.X. **

  3. Create a new device in ST IDE using the new handler

  4. Create Alexa Routine (assumes Alexa and ST are linked)
    a. Name it as you wish
    b. Set the trigger to the contact switch you created in step 3
    c. Create first action to “shuffle spotify’s XYZ”
    d. Create second action to set the contact switch (step 3) back to off
    e. Select the speaker you want

  5. Refresh the ST devices in SharpTools

  6. Create a rule in SharpTools (or modify the rule from step 1) for the playlist to turn on the contact sensor (step 3)

  7. Create a media tile (or modify from step 1) and set the tap action to hyperlink and .$runRule("—your rule ID here—"), using the rule you created in step 6.

I think this was overly complicated, but so far it has worked perfectly for me. When (if) time permits, I think there is a much better solution, which would be to either:

  1. Learn the syntax needed (if it is even possible) to trigger the command directly via Sonos’ REST API
  2. Build a custom app to manage this

Sonos API - Sonos Developer
Sonos Sample Apps - Sonos Developer

Good Luck all.

-Walt

1 Like