3rd Party Bluetooth Binding. Beta testers needed

I had a few crashes today, I think my wifi adapter is acting up. Contemplating really hard to move my openhab instance to a raspberry pi as I am now running it on a ubuntu 16.04 on a HP desktop and it has been causing me loads of issues.

You also may try to disable DEBUG log level for the binding as it is very chatty:

log:set INFO org.sputnikdev.bluetooth.manager.transport.tinyb
log:set INFO org.sputnikdev.bluetooth.manager.impl
1 Like

Hey @Pim_Verschueren, looks like I’ve caught your issue. I’ve created a ticket for this: https://github.com/eclipse/smarthome/issues/5232

I’m not sure what causes this behaviour, e.g. whether it is a PaperUI, REST API or the binding bug… Let’s see what people think.

A temporary fix for the issue is to “unlink” all unused channels, e.g. “Last Updated” channel etc… This will make PaperUI to refresh the page (data on the page) less frequent.

I still got the previous version on my different openhab instance and I can see the temperature fine for the Mikettle. What is the frame counter?

Good. Could you please take a screen of your kettle?

Re frame counter, I’ve decompiled their app and fully understood the protocol they use (and all the wording) for advertised data. So this one is just a “message number”. It can be potentially used to determine if a message got lost. But for this sort of devices we use it does not really matter. Apart from that channel, there are some other, e.g.: Protocol version, MAC address and some other suff I don’t really understand what that is (like “Capability” flag).

Here’s the screenshot for my MiKettle

Thank you @Pim_Verschueren, did you try to match the “Status” field with what your Kettle does? :slight_smile:

not yet…just moved over my openhab instance to a mini pc but it’s been challenging so I didn’t had the time to do anything else.

Hi!
I’ve installed the openHAB with bluetooth binding on my Raspberry Pi 3 with latest version of OSMC.
And I’m receiving the following errors:

2018-03-15 21:30:58.836 [WARN ] [th.manager.impl.BluetoothManagerImpl] - Adapter discovery job error
java.lang.RuntimeException: Error getting object manager client: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 2 matched rules; type="method_call", sender=":1.3034" (uid=112 pid=296 comm="/usr/bin/java -Dopenhab.home=/usr/share/openhab2 -") interface="org.freedesktop.DBus.ObjectManager" member="GetManagedObjects" error name="(unset)" requested_reply="0" destination=":1.11" (uid=0 pid=505 comm="/usr/libexec/bluetooth/bluetoothd ")
	at tinyb.BluetoothManager.getNativeAPIVersion(Native Method) ~[229:org.sputnikdev.org.eclipse.smarthome.binding.bluetooth.transport.tinyb:1.1.1]
	at tinyb.BluetoothManager.getBluetoothManager(BluetoothManager.java:304) [229:org.sputnikdev.org.eclipse.smarthome.binding.bluetooth.transport.tinyb:1.1.1]
	at org.sputnikdev.bluetooth.manager.transport.tinyb.TinyBFactory.getDiscoveredAdapters(TinyBFactory.java:153) [229:org.sputnikdev.org.eclipse.smarthome.binding.bluetooth.transport.tinyb:1.1.1]
	at org.sputnikdev.bluetooth.manager.impl.BluetoothManagerImpl$AdapterDiscoveryJob.discoverAdapters(BluetoothManagerImpl.java:762) [230:org.sputnikdev.org.eclipse.smarthome.binding.bluetooth:1.1.4]
	at org.sputnikdev.bluetooth.manager.impl.BluetoothManagerImpl$AdapterDiscoveryJob.run(BluetoothManagerImpl.java:755) [230:org.sputnikdev.org.eclipse.smarthome.binding.bluetooth:1.1.4]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:?]
	at java.lang.Thread.run(Thread.java:748) [?:?]
2018-03-15 21:30:58.846 [WARN ] [th.manager.impl.BluetoothManagerImpl] - Device discovery job error
java.lang.RuntimeException: Error getting object manager client: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 2 matched rules; type="method_call", sender=":1.3035" (uid=112 pid=296 comm="/usr/bin/java -Dopenhab.home=/usr/share/openhab2 -") interface="org.freedesktop.DBus.ObjectManager" member="GetManagedObjects" error name="(unset)" requested_reply="0" destination=":1.11" (uid=0 pid=505 comm="/usr/libexec/bluetooth/bluetoothd ")
	at tinyb.BluetoothManager.getNativeAPIVersion(Native Method) ~[229:org.sputnikdev.org.eclipse.smarthome.binding.bluetooth.transport.tinyb:1.1.1]
	at tinyb.BluetoothManager.getBluetoothManager(BluetoothManager.java:304) [229:org.sputnikdev.org.eclipse.smarthome.binding.bluetooth.transport.tinyb:1.1.1]
	at org.sputnikdev.bluetooth.manager.transport.tinyb.TinyBFactory.getDiscoveredDevices(TinyBFactory.java:166) [229:org.sputnikdev.org.eclipse.smarthome.binding.bluetooth.transport.tinyb:1.1.1]
	at org.sputnikdev.bluetooth.manager.impl.BluetoothManagerImpl$DeviceDiscoveryJob.discoverDevices(BluetoothManagerImpl.java:668) [230:org.sputnikdev.org.eclipse.smarthome.binding.bluetooth:1.1.4]
	at org.sputnikdev.bluetooth.manager.impl.BluetoothManagerImpl$DeviceDiscoveryJob.run(BluetoothManagerImpl.java:661) [230:org.sputnikdev.org.eclipse.smarthome.binding.bluetooth:1.1.4]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:?]
	at java.lang.Thread.run(Thread.java:748) [?:?]

What did I do wrong?

Hi @Balaganov, most likely there is something wrong with DBus permissions (openhab user does not have permissions to access Bluez). Have you done these steps? https://github.com/sputnikdev/bluetooth-manager-tinyb#prerequisites

Im getting this now with the new update. Whats wrong? RPI3

2018-03-15 19:49:18.475 [ERROR] [ager.impl.CombinedDeviceGovernorImpl] - Execution error of a service resolved listener

java.lang.NullPointerException: null

	at org.sputnikdev.esh.binding.bluetooth.internal.CharacteristicChannelTypeProvider.buildChannelType(CharacteristicChannelTypeProvider.java:89) ~[?:?]

	at org.sputnikdev.esh.binding.bluetooth.internal.CharacteristicChannelTypeProvider.lambda$getChannelType$0(CharacteristicChannelTypeProvider.java:63) ~[?:?]

	at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660) ~[?:?]

	at org.sputnikdev.esh.binding.bluetooth.internal.CharacteristicChannelTypeProvider.getChannelType(CharacteristicChannelTypeProvider.java:62) ~[?:?]

	at org.eclipse.smarthome.core.thing.type.ChannelTypeRegistry.getChannelType(ChannelTypeRegistry.java:86) ~[?:?]

	at org.eclipse.smarthome.core.thing.type.ChannelTypeRegistry.getChannelType(ChannelTypeRegistry.java:71) ~[?:?]

	at org.eclipse.smarthome.core.thing.internal.profiles.SystemProfileFactory.getSuggestedProfileTypeUID(SystemProfileFactory.java:117) ~[?:?]

	at org.eclipse.smarthome.core.thing.internal.CommunicationManager.determineProfileTypeUID(CommunicationManager.java:176) ~[?:?]

	at org.eclipse.smarthome.core.thing.internal.CommunicationManager.getProfile(CommunicationManager.java:140) ~[?:?]

	at org.eclipse.smarthome.core.thing.internal.CommunicationManager.lambda$11(CommunicationManager.java:332) ~[?:?]

	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) ~[?:?]

	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) ~[?:?]

	at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) ~[?:?]

	at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580) ~[?:?]

	at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:270) ~[?:?]

	at java.util.concurrent.ConcurrentHashMap$ValueSpliterator.forEachRemaining(ConcurrentHashMap.java:3566) ~[?:?]

	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[?:?]

	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[?:?]

	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) ~[?:?]

	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) ~[?:?]

	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]

	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) ~[?:?]

	at org.eclipse.smarthome.core.thing.internal.CommunicationManager.stateUpdated(CommunicationManager.java:329) ~[?:?]

	at org.eclipse.smarthome.core.thing.internal.ThingManager$1.stateUpdated(ThingManager.java:139) ~[?:?]

	at org.eclipse.smarthome.core.thing.binding.BaseThingHandler.updateState(BaseThingHandler.java:338) ~[?:?]

	at org.sputnikdev.esh.binding.bluetooth.handler.BluetoothHandler.updateState(BluetoothHandler.java:108) ~[?:?]

	at org.sputnikdev.esh.binding.bluetooth.handler.GattChannelHandler.updateState(GattChannelHandler.java:177) ~[?:?]

	at org.sputnikdev.esh.binding.bluetooth.handler.GattChannelHandler.lambda$dataChanged$0(GattChannelHandler.java:117) ~[?:?]

	at java.util.LinkedHashMap$LinkedValues.forEach(LinkedHashMap.java:608) ~[?:?]

	at org.sputnikdev.esh.binding.bluetooth.handler.GattChannelHandler.dataChanged(GattChannelHandler.java:114) ~[?:?]

	at org.sputnikdev.esh.binding.bluetooth.handler.BluetoothDeviceHandler.buildServiceHandler(BluetoothDeviceHandler.java:205) ~[?:?]

	at org.sputnikdev.esh.binding.bluetooth.handler.BluetoothDeviceHandler.lambda$serviceDataChanged$7(BluetoothDeviceHandler.java:155) ~[?:?]

	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) ~[?:?]

	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) ~[?:?]

	at java.util.HashMap$EntrySpliterator.forEachRemaining(HashMap.java:1696) ~[?:?]

	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[?:?]

	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[?:?]

	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) ~[?:?]

	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) ~[?:?]

	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]

	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) ~[?:?]

	at org.sputnikdev.esh.binding.bluetooth.handler.BluetoothDeviceHandler.serviceDataChanged(BluetoothDeviceHandler.java:154) ~[?:?]

	at org.sputnikdev.bluetooth.manager.impl.BluetoothManagerUtils.lambda$forEachSilently$3(BluetoothManagerUtils.java:82) ~[?:?]

	at java.util.concurrent.CopyOnWriteArrayList.forEach(CopyOnWriteArrayList.java:891) ~[?:?]

	at org.sputnikdev.bluetooth.manager.impl.BluetoothManagerUtils.forEachSilently(BluetoothManagerUtils.java:80) ~[?:?]

	at org.sputnikdev.bluetooth.manager.impl.BluetoothManagerUtils.forEachSilently(BluetoothManagerUtils.java:63) ~[?:?]

	at org.sputnikdev.bluetooth.manager.impl.CombinedDeviceGovernorImpl$DeviceGovernorHandler.serviceDataChanged(CombinedDeviceGovernorImpl.java:763) ~[?:?]

	at org.sputnikdev.bluetooth.manager.impl.DeviceGovernorImpl$ServiceDataNotification.lambda$notify$0(DeviceGovernorImpl.java:787) ~[?:?]

	at org.sputnikdev.bluetooth.manager.impl.BluetoothManagerUtils.lambda$forEachSilently$2(BluetoothManagerUtils.java:71) ~[?:?]

	at java.util.concurrent.CopyOnWriteArrayList.forEach(CopyOnWriteArrayList.java:891) ~[?:?]

	at org.sputnikdev.bluetooth.manager.impl.BluetoothManagerUtils.forEachSilently(BluetoothManagerUtils.java:69) ~[?:?]

	at org.sputnikdev.bluetooth.manager.impl.BluetoothManagerUtils.forEachSilently(BluetoothManagerUtils.java:56) ~[?:?]

	at org.sputnikdev.bluetooth.manager.impl.DeviceGovernorImpl$ServiceDataNotification.notify(DeviceGovernorImpl.java:786) ~[?:?]

	at org.sputnikdev.bluetooth.manager.impl.DeviceGovernorImpl$ServiceDataNotification.notify(DeviceGovernorImpl.java:781) ~[?:?]

	at org.sputnikdev.bluetooth.manager.transport.tinyb.TinyBDevice.lambda$null$9(TinyBDevice.java:245) ~[?:?]

	at org.sputnikdev.bluetooth.manager.transport.tinyb.TinyBFactory.lambda$notifySafely$0(TinyBFactory.java:228) ~[?:?]

	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]

	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]

	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]

	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]

	at java.lang.Thread.run(Thread.java:748) [?:?]

Hi @Fredrik_Andersson, most likely this is due to some incompatibility between the current and previous version. Looks like your “thing” was added to OH with the old version, and the new version of the binding complains about it. Could you please remove your thing and add it back again and see if this resolves the issue? Please let me know how it goes, thanks.

This was the issue, thanks. I removed every item, including the adapter. Now I can add them again and the problem wont show…

Hi @vkolotov, yes i done these steps except step 9. I have no bluetooth group in my OSMC.

Just add it, or you could specify “openhab” user in the /etc/dbus-1/system.d/bluetooth.conf:

<busconfig>
  <policy user="root">
    ...
  </policy>
  <policy user="openhab">
    <allow send_destination="org.bluez"/>
  </policy>
  ...
</busconfig>

Please try and let me know how it goes.

I have this lines in bluetoth.conf:

<policy group="lp">
    <allow send_destination="org.bluez"/>
  </policy>

And I added “openhab” user to the “lp” group. And now it works.
So I think your solution is working too.
Thanks!

For Redmond kettle you can use that script without any bindings.
But it need some changes.
Now I can turn my kettle on/off, get current temperature. But can’t keep warm.
It wiil be nice if @vkolotov will add Redmond.

any chance to get the new Yeelight Candela working? Its using BLE, and i can find it using bluez.

https://www.kickstarter.com/projects/1726969603/yeelight-candela-the-smart-mood-candlelight

noobie here,i installed from the market the Bluetooth Binding and the Bluetooth Binding TinyB Transport ,i added the “openhabian” bluetooth adapter (i am using a raspberry3/openhabian) and after that a lot of devices appeared in my inbox,BLE and Generic.I want to use my phone (nexus6) for presence detection so when i come home detect my phone and unlock the front door.I added my phone as a thing ,link all the channels and i noticed that it only come “online” only when its at bluetooth discovery mode.If i exit discovery mode or turn off my screen the phone goes offline at paperui.What am i missing?Do i need to pair somehow the adapter with my phone?

Another Question: I am running Openhab on a Synology NAS. I managed to install bluez 5 using entware-ng and opkg. The generic adapter is there, i can use hcitool, but the binding is not working. I think there must be something wrong with the bluez, I am getting a “Device discovery job error” in opehab.log

The command “bluez-simple-agent” does not work as well, “command not found”.