Extract from the post on sonos forums...
These are based on simple curl calls, from the http calls and explinations on page 12 of the thread.
Each of the AS calls the zone first (set the renderer) and then tell the zone what to do. First make sure sonospy is running from terminal
Code:
sudo ./sonospy_web
from the installed directory. There is no need to have a browser open.
For play/pause/mute/next or previous...
Code:
--set renderer
do shell script "curl
http://sonospyIP:50101/data/rendererData?R::TV Room%20%28ZP%29"
--set play/pause
do shell script "curl
http://SonospyIP:50101/data/rendererAction?data=PLAY"
Replace sonospy IP in both lines and zonename in the first line. Play is a toggle for play/pause. Play can be replaced with STOP PAUSE NEXT PREVIOUS MUTE
For volume:
Code:
--set the renderer to the tv room
do shell script "curl
http://sonospyIP:50101/data/rendererData?R::TV Room%20%28ZP%29"
--set volume
tell application "IndigoServer"
set vol to ((value of variable "sonosvoltvroom") - 5)
end tell
do shell script "curl
http://sonospyIP:50101/data/rendererAction?data=VOLUME:: & vol
tell application "IndigoServer"
set value of variable "sonosvoltvroom" to vol
end tell
Create a variable in indigo called "sonosvoltvroom" or similar, replace variable name in AS if different. Change the IP and zone names where necessary. This obviously wont keep track of volume changes made by the sonos controller, but with a little more work could be made to do so.
finally, set the zone to line-in
Code:
--renderer to the tv room
do shell script "curl
http://sonospyIP:50101/data/rendererData?data=R::TV Room%20%28ZP%29"
--these may need to be called to work after reboot although not worked out why yet
--get line in zone settings
do shell script "curl
http://sonospyIP:50101/data/rootData?data=S::TV Room%20%28ZP%29"
do shell script "curl
http://sonospyIP:50101/data/getData?dat ... In::1,0,10"
--based on above calls the data in this line will need amending - could be automated with variable
do shell script "curl
http://sonospyIP:50101/data/playData?da ... ema:::PNDQ"
tell application "IndigoServer"
set value of variable "currenttrack" to "Line-in Cinema"
end tell
Please note the 3rd and 4th curl call data will need amending to suit your sonos set up (details on thread page 12 or call the renderer by using http 1 and then 2 in a browser, amend the 3rd based on the server responce, then again amend the 4th call dependant on the server responce from the 3rd. This could easily be automated, but I only have one line in.
My code is very basic, but also appears very stable. This can go alot further and I havesimple script for getting the queue etc. My AS is vitually no existant, but please ask if the above is unclear.