Sonos playlists etc?

So I am getting around (after a week or so of adding devices (120 or so)) to creating all my dashboards.
Right now im making my wifes dashboard for her phone. I want to add in sonos playlists. or spotify to sonos to be exact.
So right now the sonos is there, and i can play, change volume etc, which is fine and dandy. But is there a way to create a dashboard icon that plays a particular playlist on a particular sonos?
For example id love an icon that was "Jills Eric Church Spotify Playlist on Sonos"
Is that possible? if so, I must have it :slight_smile: shes smart home inept, so this would be awesome


1 Like

I am not 100% certain on this, but I bet @stephack would know if it is doable. I would like to see something like this as well.

Totally possible. You'll need to have an RPi or some other computer running node-sonos-http-api. Then create a rule that is triggered by a virtual switch that uses http to talk to node-sonos and start the specified playlist.

The virtual switch goes in the dashboard.

That doesnt seem too daunting... now to get to work on it

Once you have it running, take a look here:

It shows you on how you can play favorites via the node-sonos-http-api

haha already stuck... image is booted, logged in as root. cant install the npm. cant find sudo. basically its like the image is locked down to the gills. readme is useless for setup too.
soldier on

There is no sudo for root....

I realized that after I typed it... So yeah unfortunately there is no real guide for this that I can find... I usually dont need one, but im not strong in linux... basic functions to build arcade emulators etc.

from what it shows on that link, it should be as simple as (at least to get started)
imaging the sd, booting up, logging in, and running that npm for dependancies, but thats where it basically bombs out early.
I think the problem is I need to move some of the files I dl'd from github to a directory where the npm install is looking at. So Im poking around that now :slight_smile:

Here is a guide on how to install node.js via nvm on Linux, maybe they can help

So I am working off a different angle of just cloning the git... seems to be progressing.

EDIT - he/she really assumes some linux knowledge ahead of time... perhaps if/when I get this working I will write something up for the home automators who arent that bright (like me)

You could make your life even easier and use docker

1 Like

@njschwartz, long time no see. I'm sure you're making reference to my Sonos Playlist Control app that I had on ST. I tried to port it over to HE but there are a few differences with how HE integrates with Sonos. The differences were subtle but still threw a wrench in the simplicity of how it worked with ST. I did a rewrite for HE but never shared it because I still feel it's a bit wonky...That said, it works great for my needs. I just didn't really have the motivation to work on it further. I have also shared it with a few others privately (@aaron @bill.d) and they had success, Not sure if they still use it though.

@Dunginhawk, feel free to try it out if the http-api proves to be too challenging and you want everything to be handled within HE.
You would need to install both the parent and child apps and also the virtual container driver to store your presets. Feel free to reach out to me if you get stuck along the way.

P.S. it far from perfect but functional:


Do you have any plans on being able to group speakers? If not, is the best course of action to create a preset in the API for a group and then choose the "main" speaker for the preset?

Update: This does seem to work.

Would it be better to create virtual buttons since there isn't an "off" or "pause" function with the switch?

1 Like

I am up and running, after a lot of little oddities :slight_smile: now i just have to work with it to output what I want :slight_smile: stay tuned

@homeauto2112, was your reply directed at me?

1 Like

Yes sir :smile:

My app is limited by what HE provides in its speaker driver. If they eventually support grouping then I can try to add that functionality.

I can't say for sure because I don't know how you created the virtual speaker for "main".

In the virtual container are the "presets" that act as momentary switches (essentially buttons). The app was designed to allow you to start playback of a preset easily (from a dashboard or button device). It is not designed for speaker control...that will have to be done from the speaker device itself.

Edit: also forgot to mention that the reason I used switches (with autoOff) is that they could be used with Voice Assistants to start playback of the presets.

1 Like

I'm sorry. I don't know the correct word for it. When a group is created, there is speaker which controls the group as a whole (e.g. play/pause). At this point, I created one preset with the API and call that with a HTTP GET command. Then I use your switch to pick what feeds that group.


The use of switches vs buttons makes a lot of sense. I didn't think about the Voice or being able to execute it within RM.

Brilliant app. Thank you so much for putting it together!


@stephack I got your app installed. At this point Im a little lost on what to do from here. DO you have a writeup anywhere on how to create a preset button etc? I created a virtual device for a sonos player, but I dont think thats what I should be doing (there is no option for integrating with spotify or any presets etc)
As my friend always says "ur doing it wrong" haha

I never really planned on posting this I never wrote any documentation. I actually haven't even opened the app in almost a year so I barely remember how to configure

This app was designed to work with the built in HE Sonos App. Do you already have the Hubitat Sonos integration configured?