Play Spotify Playlist on Sonos Speakers


#1

1) Give a description of the problem
Would like to create a piston that can begin to play a Spotify playlist on 3 Sonos speakers (grouped) at a certain date/time.

Specifically, this will be a Christmas Spotify Playlist to begin playing at 8am on Christmas Day.

2) What is the expected behavior?
As above

3) What is happening/not happening?
I am able to put together a piston to play something on the Sonos speakers at a specific time, the tricky bits where I need help are:

  • Grouping the speakers
  • Playing a playlist from Spotify (ideally on shuffle and looped)

4) Post a Green Snapshot of the pistonimage
Don’t have one as yet

5) Attach any logs (From ST IDE and by turning logging level to Full)
No Logs

REMOVE BELOW AFTER READING
If a solution is found for your question then please mark the post as the solution.


Sonos announcement and start music
#2

Unfortunately, it’s not currently possible to use WebCoRE (or SmartThings in general) to group/ungroup the Sonos speakers. With the release of the Sonos API in 2018, hopefully that will change.

I don’t use Spotify, but for some ideas on how to capture and play a Spotify playlist, see this post here.


#3

Solutions for getting SmartThings to automate playback of Spotify playlists on Sonos devices:

  1. If you have a Harmony Hub, create Harmony activities for playing your playlists on the Sonos then invoke those Harmony activities from ST (this is the most reliable and close to native solution. It is my recommended solution).
  2. If your Sonos is near a voice assistant, use an ST smart app or webCoRE to have the Sonos speak to Alexa/Google to trigger the playlist (e.g. "Alexa play playlist in the “”
  3. Duplicate your Spotify playlist tracks into a Sonos playlist and play that - ST can play Sonos playlists
  4. Duplicate your Spotify playlist tracks into a webCoRE Piston and use the piston
  5. Use a software tool like TRIGGERcmd that integrates with ST to trigger the playlist from your desktop. Video here: https://youtu.be/5LNVrFHCKkA

#4

I do this by setting up Node on a computer and then you can use a web request to play playlists. See here…jishi node-sonos


#5

All your solutions to making the Sonos play a particular playlist via webcore are long. After 5 minutes of fiddling about I can confirm that there is in fact a way to select your playlist or track directly from spotify by pointing the webcore code directly at the URL of the playlist:


#6

I got hugely excited seeing your post, it just doesnt work for me… It wont play anything… silence…

I can get it to play a single track but after that nothing! What have I missed with the playlist? I am trying to set this up so that buttons, or you arriving trigger a playlist not just one song…

Nick


#7

I must admit (with my tail between my legs) that that post was prematurely submitted. I also cannot make it work. I fiddled for hours trying as well.

I saw it, submitted the post, tried to get it to work then became overcome by frustration.

I have a feeling that the sonos may need a special port forwarding rule to allow webcore to contact it via tcpip. I will have another crack but it would be great to hear back from a web ore dev on this as the functionality is there, although just doesn’t work.


#8

As @pcgirl65 said in post 4… Using the nodejs https://github.com/jishi/node-sonos-http-api is the only reliable way I’ve been able to work with the multiple sonos speakers in my house. Once you have that part setup properly, it really does just work.


#9

Does anyone know why the webcore direct integration doesn’t work?

Is there any way to get someone working getting webcore to what it should?


#10

I don’t believe this is a WebCoRE issue, as WebCoRE can only work with whatever capabilities the DTH for a given device provides. There are several other actions involving the Sonos speakers, like Speak & Resume, that either don’t work at all or are hit and miss at best. I am hopeful that when Sonos releases it’s much anticipated SDK this year, that at better DTH with new and improved options might become available.


#11

And here is the reason that Sonos haven’t allowed this level of control yet:

If they allow SmartThings access to select playlists this device won’t sell.


#12

I’d be shocked if Sonos has sold more than a couple dozen of those things.


#13

OK I have figured it out (I think).

Go into your Sonos and play the playlist or track that you want to run from WebCore.

Then go into the SmartThings API and locate your SONOS player. In its properties you see this:

Add these to your piston and Robert is your fathers brother!


#14

Tested it and YES IT WORKS!!! Such a result. The trick is to set the track then put in a play command after.


#15

I used the trackuri data from the sonos device in the API


#16

Well done…NeoCortex
Thank you so much…
Just tried and works really well…
Tried with SiriusXM but no luck…
Tried with Amazon music… Worked perfectly…


#17

Hey Neo,
here is the problem though:
I got the playlist URI BUT it only plays a single song…
Did you get the play the whole list???


#18

As for me, to play Spotify music on Sonos via voice control, I usually connect my iPhone with the Sonos. Then directly play Spotify with Alexa. If you need, here is a detailed tutorial about how to play Spotify on Sonos easily.


#19

This is great thanks; is there a way to have it loop the playlist, i.e. continuously play until stopped?