Sonos Grouping

There are a few ways to do that but in all my playing I found the following as the most reliable:

  1. In the Sonos App, search radio.com for the station you want to play
  2. Click that little arrow next to the station and add it to your Sonos favorites.
  3. Give it an "easy" name in your favorites. With easy I mean easy from an HTTP perspective (e.g. no blanks or special characters)
  4. Call the following HTTP endpoint to play the station:
    http://[IP]/[ROOM]/favorite/[FAVORITENAME]
    e.g.: http://192.168.10.63:5005/Office/favorite/Mix1041

This has been working flawlessly for me for months.

I think you can also call the favorite within the preset with the entry:

  "favorite": "my favorite name",

but I have never tried that

I have not observed that but I only open the Sonos app to make favorites.
I use my MagicCube to control my Sonos and play/stop my favorite stations and control volume

I finally removed the Sonos App from HE. Now I have a virtual button which sends an HTTP GET http://IP_address:5005/pauseall and that stops things. I'm really loving the Node API solution. Well done.

1 Like

Excuse my ignorance here but to run the "node-sonos-http-api" server you need a separate device to host it correct? Like a RSPi connected to the network somewhere?

That is correct. There has to be an external device running Node. I'm using a Mac mini.

2 Likes

Not sure why I didn’t get a notice about your response but thanks!! I’ll probably pick up a RPi or something.

If only Trueplay profiles were discoverable/configurable :frowning_face:

I posted some thoughts in this thread. There is some limited info on web hooks too in the API documentation.

How would you find out which speaker is the ‘master’

Regards
Jan

Apologies for reviving this thread, but didn't want to start a new one since there's a lot of info here that's relevant to what I'm trying to do. Also, the question isn't entirely about HE, but I gather some people in this thread may have gone through a similar setup and be able to help me.

I have managed to get the sonos http api working thanks to the great info and tips in this thread.
I am now wanting to host that node.js server in a Synology NAS, for convenience. I have found versions of that api wrapped on a docker image, and it is working so far, but I have no idea where to place the presets and setting files when using a docker image.
I see I can define and mount volumes in the Synology docker app, but not sure what my mount point should be so that the sonos api can find them.

Any help or pointer is greatly appreciated.

Thanks!

I’ve mapped /app/settings.json to /mnt/user/appdata/node-sonos-http/settings/settings.json

Thanks!
I had to map /usr/src/settings.json instead, but thanks for setting me on the right track.

From there, and to avoid linking other preset files one by one, you can specify a path to your custom presets in settings.json.

"presetDir": "/path/to/presets/"

1 Like

Cool, I'm going to follow your posts about NAS/docker configuration, because I have been considering moving to docker from my nodejs installation on a vanilla Raspberry Pi OS installation.

In case it is useful to anyone else, I just posted by Sonos node-sonos-http-api drivers here and added them to my HPM repo.

These drivers give a lightweight abstraction of grouping/ungrouping and album or track art for display on dashboards. They also give the ability to create custom commands for the node-sonos-http-api and expose them through numbered button pushes. I found this easier than assembling a bunch of HTTP queries in RM rules and other virtual devices.

How is the master of the group identified?

It’s the first one you put in the group if I remember correctly

1 Like

I guess I'm not going to hold my breath for native support of Sonos groups, since this feature request has been pending for quite some time. Looks like I'll have to go the node.js route. Can somebody inform me whether it can do what I want though? I want to be able to dynamically choose how to group sonos speakers, on the fly, just like in the sonos mobile app (or spotify app). So, I come home, press play on my dashboard, and then use my dashboard to choose which speakers to group for playing that. Doable with the node.js solution or can you only set more or less static groups?

Dunno about node.js but you can do that in Node Red. I do it now. I use node-red-contrib-sonos-plus and this my Node Red dashboard. It's pretty simple, as I've just been forcibly removed due cancellation from Google play music and transitioning to Amazon streaming.

Yes, is doable with the node sonos http api.

There are join and leave commands. With join, you also supply the name of the zone to join. If you specify yourself, it's a noop (which simplifies some logic). For an existing group, you can use the name of any member in the group. Leave is just leave, and the rest of the group status intact regardless of whether you were the first member or not.

1 Like

Yes, you can do that with Jishi's Node.js app for Sonos... but it's all REST requests, so you'll have to script them together into the routines you want.

1 Like

Download the Hubitat app