The Bose Soundtouch wireless speaker product line runs a web server on the speaker to accept queries and control commands. It responds to html requests even when in Standby mode, to allow remote power-up.
FrBa TCL can send commands to the Bose Soundtouch wireless network speaker. The Bose API uses HTTP GET and POST messages with XML data. You can control the speaker's volume and switch to a preset from within TCL. Uses the Http package. Simple examples:
package require http set url "http://soundtouch:8090" # power on with key press and release ::http::geturl $url/key -query "<?xml version=\"1.0\" ?><key state=\"press\" sender=\"Gabbo\">POWER</key>" ::http::geturl $url/key -query "<?xml version=\"1.0\" ?><key state=\"release\" sender=\"Gabbo\">POWER</key>" # request device name/identifier, returns xml set [::http::geturl $url/name](body) # request current volume, returns xml set [::http::geturl $url/volume](body) # request list of presets, returns xml set [::http::geturl $url/presets](body) # request list of input sources, returns xml, common sources: AUX, AIRPLAY, QPLAY, UPNP, SPOTIFY, BLUETOOTH # usable sources are listed with isLocal=true, ignore sources marked isLocal=false which will return error HTTP 500 set [::http::geturl $url/sources](body) # change input to a new source set source AUX ::http::geturl $url/select -query "<?xml version=\"1.0\" ?><ContentItem source=\"$source\" sourceAccount=\"$source\"></ContentItem>" # change volume to 30% using HTTP POST ::http::geturl $url/volume -query "<?xml version=\"1.0\" ?><volume>30</volume>" # change to preset 3 of 6 using HTTP POST ::http::geturl $url/key -query "<?xml version=\"1.0\" ?><key state=\"release\" sender=\"Gabbo\">PRESET_3</key>" # get info about what is currently playing, find itemName in returned XML set [::http::geturl $url/now_playing](body)
The official Bose Soundtouch app available from https://downloads.bose.com/ced/soundtouch/soundtouch_controller_app/index.html
I am currently developing an TCL/TK interface to the speaker to control some of its basic functions:
Set Power On/off
Get What is currently playing
Get/Set speaker volume
Get/Set channel presets 1-6
Comments are welcome.