Skip to main content

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.

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


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.


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.


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 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 C1] if you want a Python library to use in your own code, or SoCo-CLI L2] 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


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