Supereg / homebridge-http-speaker

Http Speaker for Homebridge: https://github.com/nfarina/homebridge
ISC License
5 stars 4 forks source link

Bose SoundTouch HTTP POST API support? #3

Open jsadeli opened 6 years ago

jsadeli commented 6 years ago

Hi Supereg,

Thanks for this homebridge plugin, was looking for one to support my Bose SoundTouch speaker. Any plans to support HTTP POST? The Bose SoundTouch API uses it to control the speaker, and uses HTTP GET to get statuses.

Jeffrey

Supereg commented 6 years ago

Sorry for the long time to respond, I was on vacation this week.

Without an account I cannot view the SoindTouch API documentation. Could you detail the requests you want to make. Does it expect parameters in the post body or does it simply require a post request?

jsadeli commented 6 years ago

Hi Supereg, no worries...

2017-02-13_123201_Part 1-SoundTouchAPI_WebServices_v1 1 0.pdf. Attached is the downloaded Bose SoundTouch API in PDF format.

I did a quick test using Restlet Client and it expects a POST with control parameters in the BODY. E.g. to make the speaker start playing/pausing, I would have to do the following: send a HTTP POST command to http://192.168.xxx.xxx:8090/key with content-type in the header as application/xml with the following in the body <key state="press" sender="Gabbo">PLAY_PAUSE</key>

note: i'm not sure why the sender must be set to Gabbo. It won't work with anything else.

to check on the status of the device, i do the following: send a HTTP GET command to http://192.168.xxx.xxx:8090/now_playing the reply/result could be something like the following: `<?xml version="1.0" encoding="UTF-8" ?>

`
Supereg commented 6 years ago

Okay thanks for the overview.

I probably need to add a way to specify a post body for a specific request as well allow somehow more complex get request responses. Both are already on my todo list. I don't know when I will be able to implement those changes, more specifically when I have some time to do it. I'll definitely keep you notified.

I don't know how experienced you are in programming. As a workaround you could probably create a simple proxy server which accepts GET requests and forwards those as the POST requests SoundTouch expects. But maybe I already find some time tomorrow to get my head behind those changes.

Greets Andi

jsadeli commented 6 years ago

Hi Andi,

Hmm, I'm not a full expert, but using a proxy server workaround seems fragile (lots of failure points). Might be better with a separate homebridge-bose-soundtouch specific plugin?

Supereg commented 6 years ago

A separat plugin would probably best to get things running fast without any big configuration needed. I'm definitely interest adding SoundTouch support since I own a SoundTouch device myself. However I guess I have not the time for it in the moment. Additionally I would like to point out that the Home App isn't supporting the speaker accessory. You can read more in the README in the Disclaimer section. I got some new information lately that the speaker accessory is used for Doorbells and not for speaker devices itself. You can read the remaining of the story in the README

jsadeli commented 6 years ago

Yes, it's fine that the Bose SoundTouch isn't being recognized as a proper speaker accessory per se. I have the Sonos plugin and it behaves as a switch. Not ideal (can't do volume up/down, change station/presets, etc.), but sufficient (resume and stop).