Author Topic: Got the Bose SoundTouch 10 to do announcements  (Read 3872 times)

Offline dagrider

  • Sr. Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
Got the Bose SoundTouch 10 to do announcements
« on: March 30, 2017, 07:33:00 pm »
It's kind of clunky, but it works for what I need...thought I would post for others that may want to give it a try.

Currently the Bose API doesn't allow for you to send it a file to play, hope it may in the future. But you can set 6 presets via the Bose app (which BTW has a Windows version, yay!) and the preset can be a file, playlist, etc. I created mp3 files to announce "front door", "back door", "garage door" and "patio door" and set each one to a preset in the Bose app. I used the "music library on computer" option for the music service.

Then I created a scene per sensor for when the sensor reports open, and put the following lua code in the scene:

local request_body = '<?xml version=\'1.0\' ?><key state=\"press\" sender=\"Gabbo\">PRESET_1</key>'
local http = require('socket.http')
http.TIMEOUT = 5
local result, status = http.request("http://bose_ip:8090/key", request_body)
request_body = '<?xml version=\'1.0\' ?><key state=\"release\" sender=\"Gabbo\">PRESET_1</key>'
result, status = http.request("http://bose_ip:8090/key", request_body)
return true

You would put this code (substitute your bose_ip in the code) in your desired scenes and just change the PRESET_1 to the proper preset number for the announcement you want to play.

Improvements/additions would be greatly appreciated! I noticed during testing that if I am already playing music and then the announcement comes in, the music doesn't restart, so eventually I will see if I can save off the currently playing music and start it back up again.

Offline robie

  • Sr. Newbie
  • *
  • Posts: 37
  • Karma: +0/-0
Re: Got the Bose SoundTouch 10 to do announcements
« Reply #1 on: December 03, 2017, 10:02:10 am »
this works great! thanks! my first lua code, haha.  also got it to turn off by replacing PRESET_1 with POWER

« Last Edit: December 03, 2017, 10:07:42 am by robie »

Offline maaxmelbourne

  • Newbie
  • *
  • Posts: 19
  • Karma: +0/-0
Re: Got the Bose SoundTouch 10 to do announcements
« Reply #2 on: October 25, 2018, 05:45:14 am »
this solution has been working fine for months (using Power cmd to use as an alarm clock in vera), but has stoped working overnight. Has Bose changed APIs??