Page 1 of 1

SONOS - 2 Way Feedback

Posted: Thu Oct 16, 2014 10:55 am
by robertwo
Hi

I was wondering if anyone has had any luck with 2 way feedback from Sonos devices?

I have the basic controls for volume, playing Radio Station, Play, Stop and the usual, but I would really like to query the Sonos device and set the Volume Gauge to the same setting as the actual device on Page Load.

So, to query the volume I sent a command as follows:

POST /MediaRenderer/RenderingControl/Control HTTP/1.1\x0D\x0ACONNECTION: close HOST: 192.168.0.27:1400\x0D\x0ACONTENT-LENGTH: 304\x0D\x0ACONTENT-TYPE: text/xml; charset="utf-8"\x0D\x0ASOAPACTION: "urn:schemas-upnp-org:service:AVTransport:1#GetVolume"\x0D\x0A\x0D\x0A<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encodin ... :GetVolume xmlns:u="urn:schemas-upnp-org:service:RenderingControl:1"><InstanceID>0</InstanceID><Channel>Master</Channel></u:GetVolume></s:Body></s:Envelope>\x0D\x0A


I have tested this using a Goolge Chrome Plug-in called POSTMAN and I get the following response from the Sonos Device:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encodin ... meResponse xmlns:u="urn:schemas-upnp-org:service:RenderingControl:1"><CurrentVolume>26</CurrentVolume></u:GetVolumeResponse></s:Body></s:Envelope>

From this I can see that the current volume of the MASTER Channel is returned and all is correct and corresponds exactly to the Volume Gauge.

Where I am stuck is capturing this data from the above. I have setup the 2 Way for the Device as below:

Device Response Terminator: \x0D\x0A
Condition Type: feedback matches pattern
Data: <CurrentVolume>(.*)</CurrentVolume>
Action for captured data: ReturnData & Send Catured Data to Label

The problem is it doesn't seem to find the data, not sure if that's due to the Terminator or not, or if it just isn't capturing the entire response after the Headers i.e. the text/xml section of the reply in the ENVELOPE

I have tested using a simple Condition Type of (.*) and I can see sometimes, not always, a response of HTTP/1.1 200 OK. It seems if I double tap the Volume Gauge I get this response showing in the Dynamic Label. Now I am not sure if the response above is the full response or if it is a limitation of the Dynamic Label only being able to show a single line of text? Does anyone know how to show the full text will multiple lines as this would be a great test to actually see what data is being captured by the 2 Way Feedback Condition?

Any help here to get this working would be much appreciated.

Thanks

Re: SONOS - 2 Way Feedback

Posted: Tue Dec 06, 2016 11:28 am
by DemoPad