Controlling Sonos using HTTP requests?
-
Hmm. (minor) Progress. I managed to send a "play" command to one player but I am not able to tune it to a radio station or add a player to a group (I found a thread mentioning that setting currentURI to x-rincon:{UUID of master} should do the trick).
Any attempt at setting currentURI returns error 500:-(/Thomas
-
@bambi2000 thanks! Apparently this is over my capabilities:( All I get is an internal server error (500). And I also have a little trouble actually desciphering the command part of the code.
How sensitive is the code to case? And should it all be one long string or are there any CR's (looks like there is one)./Thomas
-
@thomas204 Sure, I havn't tried to group or ungroup players using requests, but here is the request that selects Line-In as input:
URL:
http://192.168.172.67:1400/MediaRenderer/AVTransport/Control
Method:
POST
Body:
<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-stream:RINCON_000E5887151E01400</CurrentURI><CurrentURIMetaData /></u:SetAVTransportURI></s:Body></s:Envelope>
Content type:
text/xml
Key:
SOAPACTION
Value:
"urn:schemas-upnp-org:service:AVTransport:1#SetAVTransportURI"
You will have to replace
192.168.172.67
with the IP address of your Sonos device, andRINCON_000E5887151E01400
with the identifier assigned to your Sonos device (I think the last part is the MAC address).-Dennis
-
@bambi2000 Any chance you could post an example with the exact contents of (one of) your internet request settings?
I would like to have (for a start):
- A Flic button group 3 players, then start a specific radio station
- Another button that ungroups if grouped and then starts playback of a different favorite on a single player
Is that possible?
I am sure if I could get an example of the basic "framework" needed then i should be able to tweak the commands myself
/Thomas
-
@anton Custom headers was implemented some time ago, and I have successfully created requests that allows me to toggle between playing from line in, the queue and radio stations -- my own preset button for Sonos!
-Dennis
-
Anything happening here?
-
Hi Anton,
I'm jumping in on this topic.
Since I have Sonos in multiple rooms I got myself 4 flic's but the options are not sufficient for what I thought would be possible.The scenario's I was thinking about;
- Leaving the house;
I placed a Flic at our entrance. By pressing it, it should stop all Sonos players from playing. Some of them may be in a group, some stand alone.
There is an option for "toggle" but that would start not-playing speakers.
The I thought of using "pause". Same problem here. When there's another sonos not playing, that one would start playing.
It would be wonderfull to have an option like "Stop all playing speakers"
- Turn on specific channel or spotify playlist on set-volume
In the morning we listen to a news radio station. I intended to put a button in the bathroom which, when clicked once, would a) remove the bathroom speaker from any groups (so music only plays there) b) select the desired radiostation c) set the speaker to a fixes volume.
At the same time I would also like to be able to do the same for a Spotify playlist and have it play my "Starred" list on shuffle.
I was thinking of solving it on my own by installing a Raspberry Pi and running something like https://github.com/SoCo/SoCo but seeing you're looking into this I was thinking it might help to share my ideas with you.
Kind regards,
Jaap
- Leaving the house;
-
-
@anton I would love to see some more Sonos actions. These are the tasks I do everyday:
- With bedroom, Replace queue with Sonos playlist "good night Ebba"
- With bedroom, Set Volume to 10
- With Lukas, Replace queue with Sonos favorite "goodnight.mp3"
- With Lukas, Set Volume to 15
- With Lukas, Set Crossfade to On
- With Lukas, Set Repeat On
- With Lukas, Set sleep timer to 45 min
And on my wish list I also would like to have a toggle button for two different Volume levels for the Sonos playing my TV sound. Watching movies when the kids are asleep I always have to turn the volume up and down (slow) when there is loud music or car crashes or someone whispers. TV remotes miss the button "Semi mute" and having this option with the press of a button would be super awesome!
-
-
@bambi2000 Btw, are there any particular features that you are looking for when it comes to the Sonos integration? I am actually working on it at the moment, so if you have any suggestions (beyond those already mentioned) then let me know!
-
@anton Thanks for the update!
-Dennis
-
@bambi2000 Improvement to the Internet Request action is in our roadmap, but I can not comment on when it will be released. Although custom headers it is a commonly requested feature so I hope we will be able to add it soon. We are currently also looking at making improvements to the Sonos action itself in order to extend the features there. For example to select songs and playlists.
-
My Sonos devices already have a button for play/pause/next, so I would like to use my Flic to select what to play, like a predefined radio station, the line-in or the queue.
I thought I saw a post saying that custom headers for the Internet request was added recently, but apparently it isn't true. Is it in the works?
-Dennis
-
Hi!
Although it should be possible to do this, the Internet Request action doesn't have support for adding custom request headers, which is needed for Sonos. It would also be a real pain to set Sonos up like this.
May I ask why you are not using the Sonos action? Is it something you are missing?