Bluetooth devices always online

Hi.

Using openHAB 2.3.0 Release Build in Raspberry pi 3.

I installed the Bluetooth binding, and all the smartphones started to appear in the inbox.

In the Things folder, I see all the devices, but they are always “online”, even I turn off bluetooth on the smartphone.

Also, it’s not clear to me if we have to pair OH2 with the smartphone.

Any help on this?

Thanks.

Hi @xgon,

what Bluetooth binding are you using? Official or 3rd party?

Hi @vkolotov

what Bluetooth binding are you using? Official or 3rd party?

Official

Once the smartphones were detected, the things page stayed like this:

Any hints?

Thanks.

Sorry mate, I’m not supporting the official binding. @kai might help you.

@xgon, or you may jump into this channel: 3rd Party Bluetooth Binding. Beta testers needed

@xgon These devices are treated as beacons, so you should see their RSSI channel being updated and indicating you the range.

The ONLINE/OFFLINE information of the Thing is instead rather meant as a mechanism to hint at problems - if a Thing goes OFFLINE, it means that it doesn’t work as expected anymore, because there is some problem. For beacons, this is not the case as it is a completely normal and expected situation that they are out of range. You should thus use the RSSI channel for your logic.

@Kai, Thanks for the info. What I have to do is monitor the RSSI values… I’ll try that.

To be sure:
a) Do I have to pair anything on the smartphone?
b) Do I need to perform any action on the smartphone at all?

Thanks.

have a look at the example here. You need the item on channel RSSI

Hi,

After a reboot the bluetooth binding cannot be initialized, and I see this on the logs:

2018-08-23 20:38:56.116 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.initialize()' on 'org.eclipse.smarthome.binding.bluetooth.bluez.handler.BlueZBridgeHandler@1070e03': Cannot access BlueZ layer.
java.lang.IllegalStateException: Cannot access BlueZ layer.
        at org.eclipse.smarthome.binding.bluetooth.bluez.handler.BlueZBridgeHandler.initialize(BlueZBridgeHandler.java:96) [216:org.eclipse.smarthome.binding.bluetooth.bluez:0.10.0.oh230]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
        at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [101:org.eclipse.smarthome.core:0.10.0.oh230]
        at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [101:org.eclipse.smarthome.core:0.10.0.oh230]
        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) [?:?]
Caused by: java.lang.RuntimeException: Error getting object manager client: Error calling StartServiceByName for org.bluez: Timeout was reached
        at tinyb.BluetoothManager.getNativeAPIVersion(Native Method) ~[?:?]
        at tinyb.BluetoothManager.getBluetoothManager(BluetoothManager.java:304) ~[?:?]
        at org.eclipse.smarthome.binding.bluetooth.bluez.handler.BlueZBridgeHandler.initialize(BlueZBridgeHandler.java:87) ~[?:?]
        ... 10 more
2018-08-23 20:38:56.155 [ERROR] [ome.core.thing.internal.ThingManager] - Exception occurred while initializing handler of thing 'bluetooth:bluez:hci0': Cannot access BlueZ layer.
java.lang.IllegalStateException: Cannot access BlueZ layer.
        at org.eclipse.smarthome.binding.bluetooth.bluez.handler.BlueZBridgeHandler.initialize(BlueZBridgeHandler.java:96) [216:org.eclipse.smarthome.binding.bluetooth.bluez:0.10.0.oh230]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
        at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [101:org.eclipse.smarthome.core:0.10.0.oh230]
        at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [101:org.eclipse.smarthome.core:0.10.0.oh230]
        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) [?:?]
Caused by: java.lang.RuntimeException: Error getting object manager client: Error calling StartServiceByName for org.bluez: Timeout was reached
        at tinyb.BluetoothManager.getNativeAPIVersion(Native Method) ~[?:?]
        at tinyb.BluetoothManager.getBluetoothManager(BluetoothManager.java:304) ~[?:?]
        at org.eclipse.smarthome.binding.bluetooth.bluez.handler.BlueZBridgeHandler.initialize(BlueZBridgeHandler.java:87) ~[?:?]
        ... 10 more
2018-08-23 20:39:21.130 [ERROR] [rnal.discovery.BlueZDiscoveryService] - Failed to scan for Bluetooth devices: Error getting object manager client: Error calling StartServiceByName for org.bluez: Timeout was reached

And on the webgui:

image

It seems that bluez is not running… The service status says it’s dead:

sudo service  bluetooth status
● bluetooth.service - Bluetooth service
   Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:bluetoothd(8)

What can I do?

Thanks,

@xgon are you still having an issue with bluetooth service status as dead?

@H102

The service status is now ok. I re-installed the related packeges, and it was good.

The problem is that I don’t see nay variation in the RSSI values of the devices (linked to an item).

Seems a bit odd if working before, anything in the logs pointing to an error, or just the RSSI not reporting? I have a device or two that won’t show the RSSI but seem to work fine otherwise. Maybe a bug??

After a device being configured as a Thing, I was expecting to see RSSI changes when that device moves away and near of the openhab host (where the BT is installed).

The RSSI values don’t change.

I think I have the same issue. I live in a crowded apartment complex with lots of bluetooth devices in range. My inbox accumulates things and doesn’t delete them filling the inbox to 800+ devices and counting. A few new devices are discovered every minute.

That issue is resolved in the new version of 3rd party binding, you may disable background discovery to stop adding bt devices into your inbox while still adapters in discovery mode.

Where I found this parameter ?

I’m boring to hide device bluetooth every day :slight_smile:
Thx

Here:

“Enable background discovery”

Strange I don’t have the same interface :frowning:

I discover OH sorry my noob question

I try now with things
Bridge bluetooth:bluez:bd909c61 [ address=“B8:27:EB:2E:”, discovery=false ]

This means that you are running an old version of the binding. Uninstall and install again.