Bose SoundTouch Binding

Is it possible to manually add the Soundtouch device MAC address to the OpenHAB configuration file to possibly get the binding working in OpenHAB version 1?

Hi @marvkis, I finally got around to installing OpenHab2 so I could try this out. Discovery isn’t working for me, it’s not finding any SoundTouch devices, and I’m not seeing anything in the log. I’m on a Pi-B, running the latest Jesse, and I added the ipv4 variable at both CLI and in the systemd file so that it will be applied for the service. I have a 3rd Gen ST10 and ST20, and a first Gen SA4.

Any advice? I’m not sure what logging to set for debugging this binding.

Hi @mishakim,

Sorry for the late answer - I was on a weekend trip hand had no access to my network…

Okay, it seems the discovery is causing some trouble. The bad thing: I just create a new workspace with a brand-new checkout of the latest openhab sources (my devel env was quite old), added the plugin sources, started it and - it discovered my devices without any issues during startup ;(

One of these lovely ‘works for me’ but not on other environments bugs - The best loved by all developers :wink:

Okay, let’s try to find out why it isn’t working for you. First of all - You running it on an RPI B - that might be a real ordeal. I also tried OH2 on an PI almost a Year ago (when I started writing own Bindings for OH2) and it took almost 15 minutes to boot up and it was not really useable - Maaany seconds of delay between the press of a button and the action really appearing. Maybe things have changed - I had seen some tickets regarding the performance on RPI like platforms but I have no idea how OH2 performs today. The message is - It should work but it might be very slow :wink:

To get more detailed debugging messages you have to use the debugging logging configuration:
in the folder openhab/runtime/etc exists two logback configuration files: logback_debug.xml and logback.xml. Just move logback.xml out of the way and copy logback_debug.xml into it’s place. Now start openhab again and it’s very chatty on what it is doing.

Okay, now look for the right messages:

During the bootup in an quite early stage I see those messages:

2016-03-13 21:58:52.719 [DEBUG] [SoundTouchDiscoveryParticipant:76   ] - ServiceInfo: [ServiceInfoImpl@1118765881 name: 'Office Marvin._soundtouch._tcp.local.' address: '(null):0' status: 'DNS: kis-little-m.local. [kis-little-m.local./192.168.xx.yy] state: probing 1 task: null', has NO data empty]
2016-03-13 21:58:52.720 [WARN ] [SoundTouchDiscoveryParticipant:82   ] - SoundTouch Device Office Marvin delivered no MAC Address!
2016-03-13 21:58:52.721 [DEBUG] [SoundTouchDiscoveryParticipant:76   ] - ServiceInfo: [ServiceInfoImpl@1118765881 name: 'Office Marvin._soundtouch._tcp.local.' address: '(null):0' status: 'DNS: kis-little-m.local. [kis-little-m.local./192.168.xx.yy] state: probing 1 task: null', has NO data empty]
2016-03-13 21:58:52.721 [WARN ] [SoundTouchDiscoveryParticipant:82   ] - SoundTouch Device Office Marvin delivered no MAC Address!
2016-03-13 21:58:52.740 [DEBUG] [SoundTouchDiscoveryParticipant:76   ] - ServiceInfo: [ServiceInfoImpl@1281946908 name: 'Office Sandra._soundtouch._tcp.local.' address: '(null):0' status: 'DNS: kis-little-m.local. [kis-little-m.local./192.168.xx.yy] state: probing 1 task: null', has NO data empty]
2016-03-13 21:58:52.741 [WARN ] [SoundTouchDiscoveryParticipant:82   ] - SoundTouch Device Office Sandra delivered no MAC Address!

Don’t care about the ‘delivered no MAC Address!’ warnings. I think that are broadcasts without from the speakers without any explicit search initiated by openhab. When these messages get logged we knew openhab sees the MDNS messages - if not, we have to debug why those messages aren’t received.

Later during the startup phasis the “MDNSDiscoveryService” should state that it has found servises for _soundtouch._tcp.local. and then they should added to the

2016-03-13 21:58:58.459 [DEBUG] [s.i.t.m.d.MDNSDiscoveryService:88   ] - 5 services found for _soundtouch._tcp.local.
2016-03-13 21:58:58.460 [DEBUG] [SoundTouchDiscoveryParticipant:76   ] - ServiceInfo: [ServiceInfoImpl@480049604 name: 'Office Sandra._soundtouch._tcp.local.' address: '/192.168.xx.19:8090 ' status: 'DNS: kis-little-m.local. [kis-little-m.local/192.168.xx.yy] state: probing 1 task: null' is persistent, has data
	MAC: AABBCCDDEE04
]
2016-03-13 21:58:58.466 [INFO ] [smarthome.event.ItemStateEvent:43   ] - CurrentDate updated to 2016-03-13T21:58:58.454+0100
2016-03-13 21:58:58.468 [INFO ] [s.event.ItemStateChangedEvent :43   ] - CurrentDate changed from NULL to 2016-03-13T21:58:58.454+0100
2016-03-13 21:58:58.480 [INFO ] [s.c.d.internal.PersistentInbox:176  ] - Added new thing 'bosesoundtouch:device:AABBCCDDEE04' to inbox.
2016-03-13 21:58:58.480 [DEBUG] [SoundTouchDiscoveryParticipant:76   ] - ServiceInfo: [ServiceInfoImpl@1652509807 name: 'Bose ST 20._soundtouch._tcp.local.' address: '/192.168.xx.21:8090 ' status: 'DNS: kis-little-m.local. [kis-little-m.local/192.168.xx.yy] state: probing 1 task: null' is persistent, has data
	MAC: AABBCCDDEE03
]
2016-03-13 21:58:58.480 [INFO ] [marthome.event.InboxAddedEvent:43   ] - Discovery Result with UID 'bosesoundtouch:device:AABBCCDDEE04' has been added.
2016-03-13 21:58:58.497 [INFO ] [s.c.d.internal.PersistentInbox:176  ] - Added new thing 'bosesoundtouch:device:AABBCCDDEE03' to inbox.
2016-03-13 21:58:58.497 [INFO ] [marthome.event.InboxAddedEvent:43   ] - Discovery Result with UID 'bosesoundtouch:device:AABBCCDDEE03' has been added.
2016-03-13 21:58:58.497 [DEBUG] [SoundTouchDiscoveryParticipant:76   ] - ServiceInfo: [ServiceInfoImpl@1354535846 name: 'Wohnzimmer._soundtouch._tcp.local.' address: '/192.168.xx.17:8090 ' status: 'DNS: kis-little-m.local. [kis-little-m.local/192.168.xx.yy] state: probing 1 task: null' is persistent, has data
	MAC: AABBCCDDEE02
]
2016-03-13 21:58:58.514 [INFO ] [s.c.d.internal.PersistentInbox:176  ] - Added new thing 'bosesoundtouch:device:AABBCCDDEE02' to inbox.
2016-03-13 21:58:58.514 [INFO ] [marthome.event.InboxAddedEvent:43   ] - Discovery Result with UID 'bosesoundtouch:device:AABBCCDDEE02' has been added.
2016-03-13 21:58:58.514 [DEBUG] [SoundTouchDiscoveryParticipant:76   ] - ServiceInfo: [ServiceInfoImpl@860479827 name: 'Küche._soundtouch._tcp.local.' address: '/192.168.xx.01:8090 ' status: 'DNS: kis-little-m.local. [kis-little-m.local/192.168.xx.yy] state: probing 1 task: null' is persistent, has data
	MAC: AABBCCDDEE01
]
2016-03-13 21:58:58.531 [INFO ] [marthome.event.InboxAddedEvent:43   ] - Discovery Result with UID 'bosesoundtouch:device:AABBCCDDEE01' has been added.
2016-03-13 21:58:58.530 [INFO ] [s.c.d.internal.PersistentInbox:176  ] - Added new thing 'bosesoundtouch:device:AABBCCDDEE01' to inbox.

After that the devices are in the inbox and can be added to the system.

If there are no messages of the SoundTouchDiscoveryParticipant then it might be that openhab is not listening to the MDNS messages properly:
Run the command netstat -aunp while openhab is running and look that java is bound to 0.0.0.0:5353

root@kis-hc-2:/opt/openhab# netstat -aunp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
udp        0      0 0.0.0.0:162             0.0.0.0:*                           23849/java
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           23849/java
udp        0      0 0.0.0.0:1900            0.0.0.0:*                           23849/java

the ‘java’ program name is openhab. And it’s important that it’s listening on udp / 0.0.0.0:5353 and not on udp6 / :::5353

Hope that helps you to track the problem down…

Bye,
Chris

Hi @mark_cornhill,

sorry, it seems I missed your message.

I’m not sure if it is enough just to create a possibility to manually configure all autodiscovered parameters. OH2 bindings heavily rely on eclipse smarthome where OH2 is based on - and what I know OH1 dosn’t have the eclipse smarthome included. That also would explain why OH1 bindings can be used by OH2 but not the other way.
But for me - I started writing bindings for OH2 and never have studied the binding guide for OH1. So I really have no idea what I need to change to get it working for OH1…

Maybe someone other has the time and experience to create an OH1 version of it. Maybe it’s your first java project? :wink:

Bye,
Chris

Awesome - that’s a lot to look at, and it will probably be a week till I get a chance to try much, but I’ll report back when I do. The old Pi is definitely limiting, but I find that after initial setup, it works well. I may move to my Mac if that’s what it takes to get things all working.

Misha

I’m moving my OpenHab2 setup to a Mac, and this binding worked without a hitch on that. One thing I’m not getting though – how to use the Control channel. What kind of Item does it work with? When I try to link it, no items appear in the drop-down selection, so I assume that means none of the items I have anywhere are the right type.

Edit:
Ok, so I figured out that the item type seems to be Player, but I don’t understand how to specify the controls. In my .items, I just assigned a Player item to a group, and then in my sitemap I call that group, and it shows Last, Pause, Play, and Next. Pause and Play work, the other two do not. If I place the control item directly in my sitemap, that breaks things - the rest of the page renders on the previous page, as if there is a phantom } in the item closing the frame prematurely.

How do I specifically control the presets or other input, or make the next/prev/ff/rw controls work? Should I explicitly provide a binding command in the item definition? It looks like the Paper item type has a limited list of supported functions, but the comment on the Control channel includes presets and Bluetooth.

Interesting bug I’m finding: openHab does not like it when there is punctuation in the strings generated by the metadata channels. That is, when there are apostrophes or colons in the album or song (and presumably other fields), it confuses things. At a minimum, only part of the string appears in the UI (sitemap showing the text field in Basic UI), and when the album had a colon, the log showed this:
2016-03-26 17:00:19.706 [WARN ] [ternal.render.AbstractWidgetRenderer] - Cannot escape path 'Baby Einstein: Lullaby Classics' in URL. Returning unmodified path. as if it thinks it’s a URL it should be parsing

Hi @mark_cornhill,
have you tried the binding with OH1? I’d like to buy one speaker and I’m thinking between sonos and bose, the first has already a binding working but the second one is more interesting.
Thank you.

Hi @mortommy, I have not tried the Bose Soundtouch binding with OpenHAB 1. I do not have the coding knowledge to debug and make any necessary changes.
After reading the Bose developers guide, I was thinking of using the exec binding and some simple curl scripts to access the basic functions such as selecting a present and the stop button. This might cover the basics to get started.

I’ve spent the last two days looking into Openhab and tons of other automation resources. I’m super amped to see Soundtouch is already supported. I have 8 systems around the house, 3xST10, 1x ST20 II, 1x ST20III, 1x ST30II, LS525, LS135. so I can’t wait to use this. There is also a Hackster project out there for Alexa support. Just got that up and running.

I had to uninstall the binding – it was causing my whole openHAB system to freeze with “out of memory” errors if the music played overnight. I didn’t have debug logging at the time . I have a suspicion that it was due to the problem I noted above – special characters in the song metadata were causing the system to try to process the text instead of treating it as just string data to output. I may try reinstalling it and only connecting control-related channels and see if that stops the errors.

PS I never did figure out how to get the Player channel to select presets.

forgive me , but I just installed my first openhab2 and I can not find a way to add your plugin you could tell me the installation method ? I would be grateful

I’ve re-installed the binding (@CalibroZero, just download the binary from post #11 at the top of the thread and put it in /addons), and got the presets working through the Control channel by setting it as a string item, manually assigning the channel, and then using a switch with mapped commands in the sitemap.

@marvkis is there a way to send control commands directly via an item, so that I could export a homekit switch that just activates one preset?

I didn’t re-assign any of the metadata channels to items, but I’m still seeing my logs fill with
2016-04-30 11:59:50.017 [ERROR] [dtouch.handler.BoseSoundTouchHandler] - org.eclipse.smarthome.core.thing.internal.ThingImpl@7d06b55f: Unknown Source: PANDORA - needs to be defined! 2016-04-30 11:59:50.017 [ERROR] [dtouch.handler.BoseSoundTouchHandler] - org.eclipse.smarthome.core.thing.internal.ThingImpl@7d06b55f: Unknown Source: PANDORA - needs to be defined! 2016-04-30 11:59:50.018 [WARN ] [dtouch.handler.BoseSoundTouchHandler] - Unhandled XML entity during NowPlaying: time 2016-04-30 11:59:50.018 [WARN ] [dtouch.handler.BoseSoundTouchHandler] - Unhandled XML entity during NowPlaying: time 2016-04-30 11:59:50.018 [WARN ] [dtouch.handler.BoseSoundTouchHandler] - Unhandled XML entity during NowPlaying: rating 2016-04-30 11:59:50.018 [WARN ] [dtouch.handler.BoseSoundTouchHandler] - Unhandled XML entity during NowPlaying: rating 2016-04-30 11:59:50.018 [WARN ] [dtouch.handler.BoseSoundTouchHandler] - Unhandled XML entity during NowPlaying: skipEnabled 2016-04-30 11:59:50.018 [WARN ] [dtouch.handler.BoseSoundTouchHandler] - Unhandled XML entity during NowPlaying: skipEnabled 2016-04-30 11:59:50.018 [WARN ] [dtouch.handler.BoseSoundTouchHandler] - Unhandled XML entity during NowPlaying: rateEnabled 2016-04-30 11:59:50.018 [WARN ] [dtouch.handler.BoseSoundTouchHandler] - Unhandled XML entity during NowPlaying: rateEnabled
every 30 seconds

Not sure if it’s the best way to do this, but I ended up creating unbound switch items that I could export to homekit, and then using rules to send preset commands when the switches were turned on

is someone still working on this? Just reinstalled a new 2b4 Set up. Copied the binding to /use/share/openhab2/addons but nothing happens… How does this work now?

I’m working on a quite new snapshot, and its working fine.
The main functionalites are given.

At installation time i had some problems, because the binding needed the systems serial number to work correcty.

I modified the binding a little bit, because the control channel did not accept the bluetooth comand correcty

Do you plan to create a PR for it?

Hello Kai,

so i’m quite (totally) new in binding development.
What does PR mean?

PR = Pull Request, i.e. contributing the code to the project.

Ok i see.

if i understand it the right way, a PR woul lead to an offical binding, if you (or maybe someone other) say it is OK.

So i have some problems with that.
As mentioned above i’m totally new in bindig development. i just adopt this a little bit for my needs.
The main code is from @marvkis, so i would say it is on him to create a PR

But on the other hand, this binding works fine, i do not know if @marvkis is still working on that, so it would be sad if this does not not become official