Node-red-contrib-sonos-plus integration with Spotify

Hi @hklages or anyone else that can help,

Background: I'm an old dinosaur on S1. I don't see myself upgrading to S2 as I was an early adopter of Sonos... 30% of a very big number is still a big number, if you know what I mean. I am not sure if this impacts any of my findings so far, but thought I'd share, just in case.

I have been playing around with node-red-contrib-sonos-plus and have managed to figure out how to get Spotify playlists to play... I have marked my Spotify playlists as Sonos favourites.

I have tested this and when I add new tracks to my Spotify playlist they add to the Sonos favourites link to that playlist, so, happy days. In fact, very happy days... :slight_smile:

I notice in the wiki: https://github.com/hklages/node-red-contrib-sonos-plus/wiki, this note in the history log: 2019-12 COMPLETED Spotify functionality

I also notice lots of references to Spotify in the wiki e.g.
My Sonos Playlists:

  • Spotify: Daily Mix 2, GloomySunday

However I have not found a way to access my Spotify anything directly, including playlist, unless I mark them as favourites; as mentioned above.

I'd love to directly reference my Spotify playlists, so I don't have to remember to mark them as favourites in Sonos and I'd also love to be able to search for Spotify songs via the Node.

Are these two things possible?

Hi Alex. node-red-contrib-sonos-plus works with S1 and S2 (at least so far) - so it supports Dinosauriers :slight_smile:

As you already realized the preferred way is to mark the Spotify playlists/song/album so that they show up in "My Sonos" tab in the SONOS app. Then you can easily select and play them. This should work for all other Music Service Napster, Deezer, etc.

You can try to play a spotify playlist directly with the command "group.queue.urispotify" in the Universal node followed by "group.play.queue".

Examples for valid payloads are:

spotify:track:5AdoS3gS47x40nBNlNmPQ8
spotify:album:1TSZDcvlPtAnekTaItI3qO
spotify:artistTopTracks:1dfeR4HaWDbWqFHLkxsg1d
spotify:user:spotify:playlist:37i9dQZEVXbMDoHDwVN2tF'

It may happen that spotify or SONOS change their syntax - in that case this will not work. So the first method should be more reliable.

Hmmm, I tried this and it didn't work. I wonder if I am doing something wrong.

What happens when you use the following flow (and change config to one of your players)?

[{"id":"bb67878e.ba03c8","type":"inject","z":"fcb24b59.997048","name":"insert_spotify_uri Album","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"spotify:album:1TSZDcvlPtAnekTaItI3qO","payloadType":"str","x":1000,"y":1584,"wires":[["634d07c2.0a4e08"]]},{"id":"634d07c2.0a4e08","type":"sonos-universal","z":"fcb24b59.997048","confignode":"88e9fa70.4a53e8","compatibilityMode":false,"command":"group.queue.urispotify","state":"","stateType":"str","name":"","x":1245,"y":1584,"wires":[["4202ee3.f67c41"]]},{"id":"4202ee3.f67c41","type":"debug","z":"fcb24b59.997048","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1265,"y":1544,"wires":[]},{"id":"88e9fa70.4a53e8","type":"sonos-config","z":"","name":"coordinator","serialnum":"5C-AA-FD-00-22-36:1","ipaddress":"192.168.178.37"}]
1 Like

I'll try it when I get back from my holiday. Thanks!

Thanks, I tested it with limited success.

I wanted to play my personal playlist without having to add them to Sonos favourites each time, but the URI does not work for playlist from my testing.

It does work for other combos of public data, but not all instances e.g. when I tried it on an artist it didn't work, but I see you used toptracks in your URI artist, so i guess this does work.

It's good to know it's there, but for now I shall have to revert to the slightly more manual method. Thanks anyway!

BTW the node-red-contrib-sonos-plus node is awesome despite this limitation. I'm really happy with it and can't wait to implement it.