EW1 Posted February 20, 2023 Posted February 20, 2023 I have a couple rooms with a single keypad button used to set sones to a preselected favorite for the room and play or pause. I also have a couple rooms where the primary light switch fast on and fast off triggers sonos to play/pause a favorite channel. This generally works well, except when the last person to use sonos in the room has adjusted the volume very high or low using the app. Is there a way to send a fixed volume percentage command vs just volume up/down commands?
lilyoyo1 Posted February 20, 2023 Posted February 20, 2023 30 minutes ago, EW1 said: I have a couple rooms with a single keypad button used to set sones to a preselected favorite for the room and play or pause. I also have a couple rooms where the primary light switch fast on and fast off triggers sonos to play/pause a favorite channel. This generally works well, except when the last person to use sonos in the room has adjusted the volume very high or low using the app. Is there a way to send a fixed volume percentage command vs just volume up/down commands? Yes..... Just add the set volume you want to your program.
Geddy Posted February 20, 2023 Posted February 20, 2023 @EW1 welcome to the Universal Devices forums. It appears there are two Sonos node servers available (Sonos and ST-Sonos). Which one are you using? I think @lilyoyo1 covers the how to achieve this. Hopefully it works with the node server you're using. If not please provide more information related to your system for which node server and what Universal Device system you are using.
EW1 Posted February 20, 2023 Author Posted February 20, 2023 I have an ISY994 and Sonos 2.0.8 running on a rpi. I haven't actually used the node server yet - my programs are old and done with network resources. An example is below. I'm only seeing volume up/down options with the node server I have. I suppose I could send enough volume down commands that even from 100% it would go to zero, and then send a few volume up commands to get to desired volume, but this doesn't seem very elegant. Also, I don't think I can wire shark the set volume to desired percentage given the app doesn't seem to have this option either, just up/down. POST /MediaRenderer/AVTransport/Control HTTP/1.1 Host: 192.168.0.252:1400 Connection: Close Content-Type: text/xml; charset="utf-8" Content-Length: 267 SOAPACTION: "urn:schemas-upnp-org:service:AVTransport:1#Play" <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:Play xmlns:u="urn:schemas-upnp-org:service:AVTransport:1"><InstanceID>0</InstanceID><Speed>1</Speed></u:Play></s:Body></s:Envelope> 1
lilyoyo1 Posted February 20, 2023 Posted February 20, 2023 26 minutes ago, EW1 said: I have an ISY994 and Sonos 2.0.8 running on a rpi. I haven't actually used the node server yet - my programs are old and done with network resources. An example is below. I'm only seeing volume up/down options with the node server I have. I suppose I could send enough volume down commands that even from 100% it would go to zero, and then send a few volume up commands to get to desired volume, but this doesn't seem very elegant. Also, I don't think I can wire shark the set volume to desired percentage given the app doesn't seem to have this option either, just up/down. POST /MediaRenderer/AVTransport/Control HTTP/1.1 Host: 192.168.0.252:1400 Connection: Close Content-Type: text/xml; charset="utf-8" Content-Length: 267 SOAPACTION: "urn:schemas-upnp-org:service:AVTransport:1#Play" <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:Play xmlns:u="urn:schemas-upnp-org:service:AVTransport:1"><InstanceID>0</InstanceID><Speed>1</Speed></u:Play></s:Body></s:Envelope> I use node servers for my Sonos which allows for volume to be set (both of them do). I don't use your method so I can't help you with that one. 1
EW1 Posted February 20, 2023 Author Posted February 20, 2023 Thanks for the help. Just knowing that it was possible got me on the right track. Sonos has pretty good documentation of their API and there is a DesiredVolume control. Pasted below in case any others are using the old school network resources instead of a node server. <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:SetVolume xmlns:u="urn:schemas-upnp-org:service:RenderingControl:1"><InstanceID>0</InstanceID><Channel>Master</Channel><DesiredVolume>20</DesiredVolume></u:SetVolume></s:Body></s:Envelope>
lilyoyo1 Posted February 20, 2023 Posted February 20, 2023 1 minute ago, EW1 said: Thanks for the help. Just knowing that it was possible got me on the right track. Sonos has pretty good documentation of their API and there is a DesiredVolume control. Pasted below in case any others are using the old school network resources instead of a node server. <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:SetVolume xmlns:u="urn:schemas-upnp-org:service:RenderingControl:1"><InstanceID>0</InstanceID><Channel>Master</Channel><DesiredVolume>20</DesiredVolume></u:SetVolume></s:Body></s:Envelope> You may want to take a look at going the node server route. The 2 way communication really comes in handy 2
Recommended Posts