Skip to main content
Contributor I
Feb 16, 2022 11:51 AM UTC

Local Communication with sonos to group between rooms

Hello Team,

 

I want to send commands to sonos to group between multiple players, but I want to do it in my local network setup, don’t want to use cloud api, so how can I do that, please help.

This topic has been closed for further comments. You can use the search bar to find a similar topic, or create a new one by clicking Create Topic at the top of the page.

7 replies

controlav
Lead Maestro
Feb 16, 2022 1:21 PM UTC

Easy via UPnP, use SetAVTransportURI. Take a network capture to see how the args work.

Translate
Author of the leading independent Sonos apps for Android, MacOS, iOS, Windows and Xbox.
controlav
Lead Maestro
Feb 16, 2022 1:59 PM UTC

if you can’t be bothered to capture a network trace, the detailed answer can be found here: https://stackoverflow.com/questions/69296625/add-players-to-existing-group-without-pausing-music

Translate
Author of the leading independent Sonos apps for Android, MacOS, iOS, Windows and Xbox.
Contributor I
Feb 21, 2022 10:41 AM UTC

I am using this method for local sonos communication

url:- http://172.16.3.39:1400/MediaRenderer/AVTransport/Control

method:- POST

headers:-

Content-Type: text/xml; 

soapaction: "urn:schemas-upnp-org:service:AVTransport:1#SetAVTransportURI";

body:- 

<?xml version="1.0" encoding="utf-8"?>

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">

  <s:Body>

    <u:SetAVTransportURI xmlns:u="urn:schemas-upnp-org:service:AVTransport:1">

  <InstanceID>0</InstanceID>

  <CurrentURI>x-rincon-queue:RINCON_48A6B8DBCC2A01400#0</CurrentURI>

  <CurrentURIMetaData></CurrentURIMetaData>

</u:SetAVTransportURI>

  </s:Body>

</s:Envelope>

 

I get the success response 200, but the players are not grouped, as it does using global api.

Translate
Contributor I
Feb 21, 2022 10:43 AM UTC

if you can’t be bothered to capture a network trace, the detailed answer can be found here: https://stackoverflow.com/questions/69296625/add-players-to-existing-group-without-pausing-music

 

I am using this method for local sonos communication

url:- http://172.16.3.39:1400/MediaRenderer/AVTransport/Control

method:- POST

headers:-

Content-Type: text/xml; 

soapaction: "urn:schemas-upnp-org:service:AVTransport:1#SetAVTransportURI";

body:- 

<?xml version="1.0" encoding="utf-8"?>

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">

  <s:Body>

    <u:SetAVTransportURI xmlns:u="urn:schemas-upnp-org:service:AVTransport:1">

  <InstanceID>0</InstanceID>

  <CurrentURI>x-rincon-queue:RINCON_48A6B8DBCC2A01400#0</CurrentURI>

  <CurrentURIMetaData></CurrentURIMetaData>

</u:SetAVTransportURI>

  </s:Body>

</s:Envelope>

 

I get the success response 200, but the players are not grouped, as it does using global api.

Translate
controlav
Lead Maestro
Feb 21, 2022 2:14 PM UTC

Please use stackoverlow for this stuff, this forum sucks as code fragments (or SOAP fragments in this case) render terribly.

Eyeballing this I see your CurrentuRI is wrong. SO shows it as just the rincon address, for some reason you are using a queue address.

Translate
Author of the leading independent Sonos apps for Android, MacOS, iOS, Windows and Xbox.
pwt
Virtuoso
Feb 21, 2022 7:06 PM UTC

I want to send commands to sonos to group between multiple players, but I want to do it in my local network setup, don’t want to use cloud api, so how can I do that, please help.

In addition to the helpful responses above, note that there are several third-party libraries and utilities that have done the UPnP/SOAP hard work for you. I know the Python ones best: SoCo [1] if you want a Python library to use in your own code, or SoCo-CLI [2] if you just want an easy-to-use command line (plus other tools).

[1] https://github.com/SoCo/SoCo

[2] https://github.com/avantrec/soco-cli

Translate
4 x P:5 | Sub | 4 x P:1 | 3 x Connect | 2 x Boost | Connect:Amp | 2 x One | Amp | Move | Port | Era 300
Contributor I
Feb 22, 2022 5:10 AM UTC

Please use stackoverlow for this stuff, this forum sucks as code fragments (or SOAP fragments in this case) render terribly.

Eyeballing this I see your CurrentuRI is wrong. SO shows it as just the rincon address, for some reason you are using a queue address.

I  already used rincon address but it throws 714 error code.

I have uploaded the question related to sonos player grouping in stackoverflow

https://stackoverflow.com/questions/71216179/sonos-player-grouping-via-local-communication-not-working

 

Translate