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’
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’
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.