0

API help

Dave De Busschere 8 months ago in bOS Configurator / Devices updated 8 months ago 15

Hi,

I'm newt the api's. I'd like to get some information from our Bose. but I don't know how to get started with the api.

this is what I want to do:

https://bosedevs.bose.com/discussion/433/power-control

do I use http or basic devices, how do I put the get command in the api (command, string,....?)

thanks in advance,

Dave

Hi,

According to documentation of the SoundTouch API, you can control your BOSE products using third party software, like bOS.

For that, you need to use HTTP devices, to mimic the commands you need to send to the SoundTouch products.

"All data for the SoundTouch Control API is formatted as XML. When sending a GET or POST request you must format the data in the correct XML structure, rather than using key-value pairs. Similarly, all responses will be returned in an XML format that you must parse. Properties will be attributes, elements, or content.".

Volume POST example:
<?xml version="1.0" ?>

<volume>$INT</volume>

You can do a quick test, for let's say change volume:

- Find one of your SoundTouch products, and find out its LAN IP address
- Create a HTTP device on bOS
- Set Enable to True
- On Host URL, insert the SoundTouch IP address
- Right mouse click on the HTTP device and add a Command
- On the Command, insert /volume
- Choose POST as method type
- On Post Data, insert:

<?xml version="1.0" ?>

<volume>50</volume>


- Use the HTTP device on visualization to send that command

And see if it works. I don't own any SoundTouch product, so I can't test it out. I just read some quick info on the BOSE Developer portal.

Best regards

Thanks for the clear step by step tutorial.

- The parsing (http) I set type to xml?

In the visualization I put a command button, but I don't get any action/response. 

I guess that the volume should increase to 50 <volume>50</volume> when I press the button.


Hi,

You are actually placing not a button, but a label... If you notice, you're "button" is showing as a label for Http.Connected info, so you'll never be able to "send" anything.

Double check it. When you place the right http command on the visualization, one of the options shown is "Send".

I'm not with my computer right now, but I'll check it later to tell you how to place the right command button.

Best regards

I've reached my computer now...

To place a button as "Run function":

- Right button click on your visualization;

- Add Object Control;

- Go to your Http device created for the volume;

- Expand that Http device, where you'll find your command;

- Choose that command, and on the dropdown menu Control, choose Send(RunFunction);

That way your button will send that command.

As I don't own any SoundTouch products, I can't say if the command and data fields are correct. Probably you'll need to fiddle around until you get the command working...

Best regards

unable to read data from the transport connection

Found this in the log file:

But I'm a dummy in trying to understand this :-)

Anyone with a clue?

Devices : 11/17/2019 9:58:19 PM : Error : Devices\Http : Error connecting to device. Unable to read data from the transport connection: Connection reset by peer. at System.Net.HttpWebRequest.RunWithTimeoutWorkerT (System.Threading.Tasks.Task`1TResult workerTask, System.Int32 timeout, System.Action abort, System.Func`1TResult aborted, System.Threading.CancellationTokenSource cts) 0x000f8 in :0

at System.Net.WebResponseStream.ReadAsync (System.Byte buffer, System.Int32 offset, System.Int32 count, System.Threading.CancellationToken cancellationToken) 0x0025d in :0

at System.IO.Stream.CopyToAsyncInternal (System.IO.Stream destination, System.Int32 bufferSize, System.Threading.CancellationToken cancellationToken) 0x00116 in :0

at System.Net.Http.HttpContent.LoadIntoBufferAsync (System.Int64 maxBufferSize) 0x000a9 in <5f44f3bd9eda455dbecd0c6b7eee09cc>:0

at System.Net.Http.HttpClient.SendAsyncWorker (System.Net.Http.HttpRequestMessage request, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationToken cancellationToken) 0x00171 in <5f44f3bd9eda455dbecd0c6b7eee09cc>:0

at ComfortClick.Http.Driver.HttpDriver.SendCommand (ComfortClick.Http.Commands.HttpCommand command, System.Object stateValue, ComfortClick.Http.Common.TextEncodingEnum encoding) 0x00213 in :0

Got it working, I had to put the correct

 port in the url ;-)

Really? That's great.

Haven't noticed any ports references on the SoundTouch API documentation...I read so quickly that I don't even remember any ports.


Now you can improve it, and even share your integration if you want.

Best regards

I didn't know either because when I typed the url In the browser without port number it connected to the Bose.

I found it by luck in seeing it the Bose api forum.

I'll share when I have something. 

I have some ideas, perhaps some people here have more knowledge/ideas in controlling audio

I thought about:

- all off

- music on when you come home

- zone select (living room, TV-room, bathroom, office,...)

- maybe doorbell sound (when someone rings the doorbell)

- ....

Hey Dave, great work!

As Ricardo said, please publish this integration to our Example Library once you have it ready for a chance to win a free Jigsaw/Colibri unit or additional discount for your next purchase and also help other users! :)

Tks!

Hi Dave,

I think that most of the features you refer are possible to create, but it needs some time, effort, and specially one/more SoundTouch products to test several scenarios.

I'd be happy to help, unfortunately I don't own any Bose SoundTouch products, so I think you'll have to be our "lab mouse" :-)


PS: Anyone's who's willing to send me any compatible SoundTouch product for testing, I'm in Portugal, contact me :-P


Best regards

Hi guys,

I'm able to get response from the Bose when I give a GET command.


example: GET /volume

get this respons from the Bose


<?xml version="1.0" ?>
<volume deviceID="$MACADDR">
<targetvolume>$INT</targetvolume>
<actualvolume>$INT</actualvolume>
<muteenabled>$BOOL</muteenabled>
</volume>

Where actualvolume in this case was 16.

How can I make this particular value visible in the app.

So I can see in the app the actual volume.

Or in other cases: which room is playing, what channel is playing, ....

I don't see what object I must chose to do display this particular value?

Thanks,

Hi,

When you send the Get command, you get a Response Data, and a Response Data Xml to Json on bOS.

Can you copy past your Response Data Xml to Json here?

Best regards

I get this response:

{"?xml":{"@version":"1.0","@encoding":"UTF-8"},"volume":{"@deviceID":"C4F312D5994F","targetvolume":"16","actualvolume":"16","muteenabled":"false"}}

When I look at the Bose website (special-types) it looks like the response is a flag?

sorry for being a amateur, but when I able to retrieve the responsdata and publish it in bos I'm on a go. 

https://developer.bose.com/special-types