Skip to main content
Contributor I
February 16, 2022

Local Communication with sonos to group between rooms

  • February 16, 2022
  • 7 replies
  • 520 views

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
February 16, 2022

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

Author of the leading independent Sonos apps for Android, MacOS, iOS, Windows and Xbox.
controlav
Lead Maestro
February 16, 2022

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

Author of the leading independent Sonos apps for Android, MacOS, iOS, Windows and Xbox.
Contributor I
February 21, 2022

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.

Contributor I
February 21, 2022

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.

controlav
Lead Maestro
February 21, 2022

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.

Author of the leading independent Sonos apps for Android, MacOS, iOS, Windows and Xbox.
pwt
Virtuoso
February 21, 2022

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

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
February 22, 2022

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