Sonos Grouping

Can the Sonos driver/app be updated to support grouping of Sonos speakers?

1 Like

I actually did this in a very slip shod fashion.

If you search around github, there is a Sonos API server that allows you access and http:// commands to your Sonos.

Using that I recognized the speakers that I would usually want joined (as HE has a nasty habit of breaking up my speakers). I then created a series of automations that run upon certain events (or certain times of day), to send the http:// command to join the speakers.

I’ve had it running for months and it works like a charm because the Sonos API is all local so it never goes down.

I did see that on another thread and the suggestion was to create a new post for feature requests so the HE folks might consider it. If it was part of the driver then you could expose it in RM.

This is the Sonos API GitHub - jishi/node-sonos-http-api: An HTTP API bridge for Sonos easing automation. Hostable on any node.js capable device, like a raspberry pi or similar.

It looks like it might even be easier than the MakerAPI Home Bridge integration... I might give this a try in the next few weeks.

2 Likes

It works quite well. I am by no means sophisticated in the ways of implementing anything and this was a life saver as HE somehow breaks up groups through varying automations.

Again, probably 3 months without a single ungrouping

@JDogg016 - I could really use your help. I am struggling with Sonos and Hubitat. When I group speakers in the Sonos app, they seem to ungroup when I play an announcement through RM.

The other thing that happens is that sometimes after playing the announcements, they will continue playing the music (or radio station they were playing previously. While other times this doesn't happen.

Hubitat also doesn't provide any way to play my favorites on Sonos, so I took your advice and installed node-sonos-http-api. I can get all the basic commands to work on each of my two Sonos speakers individually, but I am completely lost on how to group them.

This is my settings.json:

{
  "all": {
    "playmode": {
      "shuffle": true
   },
   "players": [
     {
       "roomName": 'Master Bedroom',
       "volume": 15
     },
     {
       "roomName": 'Living Room',
       "volume": 15
     }
  ],
  "pauseOthers": true
}
}

Could you please tell me how to modify my settings.json so I can control both speakers with a single http command, so music plays synchronously on both.

Thank you very much!

One thing to note when using Sonos groups guys.

When you use an app (rm?) to ‘speak’ to the speakers.. only configure it for the ‘master’ of the group.
If you select more than 1 speaker, it will split the group.

I have had my group stay together for a number of months now by only sending tts to one of the group.

Andy

3 Likes

Are you insisting the Sonos api?

I don't know what that means - illustrating my naivette.

@JDogg016

I guess what would really help is seeing a sample configuration file and an example http command to send to a group of speakers.

Many thanks!

Sorry. Auto correct. I meant are you using the Sonos API. I don’t recall doing Anything withRespect to the config.json file.

So I have a rule that triggers after certain events that use my kitchen Sonos. The point of the rule is to regroup two speakers in Sonos by sending the following command:

http://[IP Address of Sonos API Server:5005]/Kitchen%20Overhead/join/Kitchen%20TV%20Speaker

@Cobra @JDogg016

Thanks a lot - I got this figured out with your help. First off, I've stopped sending commands to both of my Sonos. Second, after I start playing something on one, I can "join" the other if necessary.

Works great!

1 Like

How do you group 3 speakers together?

1 Like

Same as two, you send a 2nd HTTP command with the other speaker name. Just make sure you join it to the same master as you joined the first one to.

1 Like

It would still be a better solution to create the ability to create a group in HE instead of yet another connected device. I had a thought about how to actually create a rule to use Sonos groups I have created in Alexa but so far none of my IFTTT tricks has worked!

Most people use a local Node.js server with the following Node.js app

It works very reliably without going out to the cloud. In rules, you can send HTTP commands to this node server to group or ungroup

I hear you about the native support, I know it has been requested before, I am not sure how high it is on the priority list....

Ok. So I can have two http statements to put three SONOS into a group! That's great. Is there a way to use the presets.json to achieve the same thing?

1 Like

If you find one, could you share it? Many thanks!

Are you trying to speak on ALL Sonos players? The node-sonos-api also offers the "sayall" endpoint and uses it's internal TTS. It will join all the players to a group and restore the original state after the TTS was spoken.

Just an alternative.

I haven't used the presets.json, but I'll take a look at the documentation

So here is a http command that I send to node-sonos-api with a preset:

http://192.168.10.63:5005/preset/{"players":[{ "roomName": "Office", "volume": 15},{"roomName": "Outside", "volume": 25}]}

This joined the two players that I have specified there. I am sure you can also put that JSON into a preset file and call it by name. This made my Office speaker the master. Basically the first one will become the master