Hello,
I’ve read through all of the posts on this forum thread but i’m still a bit confused on what the latest procedure is to get Bluetooth working on openhabian 2.5.10.
I started by installing the Bluetooth binding from paper UI. Afterwards I installed bluez on my raspberry pi 4 with the following commands:
sudo apt-get install -y bluez python-bluez python-dev libbluetooth-dev raspberrypi-sys-mods
sudo apt-get install -y pi-bluetooth
sudo apt-get install libcap2-bin
At this point, I was able to scan for Bluetooth devices with my PI using hcitool lescan
[14:28:55] openhabian@openHABianDevice:~$ bluetoothctl
Agent registered
[bluetooth]# scan on
Discovery started
[CHG] Controller DC:A6:32:E1:0F:05 Discovering: yes
[NEW] Device F5:1E:F8:91:63:F3 Kontakt
[NEW] Device 52:19:C6:0E:83:F7 52-19-C6-0E-83-F7
[NEW] Device 53:08:EA:44:41:E8 53-08-EA-44-41-E8
[NEW] Device 75:8C:34:B1:48:8C 75-8C-34-B1-48-8C
[NEW] Device F0:18:98:2A:98:53 F0-18-98-2A-98-53
[NEW] Device EA:E4:EC:C2:0C:18 Kontakt
[NEW] Device 59:15:47:6D:B6:24 59-15-47-6D-B6-24
[NEW] Device 4E:AA:21:69:40:AC 4E-AA-21-69-40-AC
[NEW] Device 53:88:04:47:1B:C8 53-88-04-47-1B-C8
[NEW] Device 75:E9:02:A2:6D:93 75-E9-02-A2-6D-93
When I search for Bluetooth devices on Paper UI it cannot find any things. My Bluetooth service seems to be running fine however:
[14:44:19] openhabian@openHABianDevice:~$ sudo systemctl status bluetooth
[sudo] password for openhabian:
● bluetooth.service - Bluetooth service
Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2020-12-07 14:26:56 AEST; 17min ago
Docs: man:bluetoothd(8)
Main PID: 602 (bluetoothd)
Status: “Running”
Tasks: 1 (limit: 4915)
CGroup: /system.slice/bluetooth.service
└─602 /usr/lib/bluetooth/bluetoothd
Dec 07 14:26:56 openHABianDevice systemd[1]: Starting Bluetooth service…
Dec 07 14:26:56 openHABianDevice bluetoothd[602]: Bluetooth daemon 5.50
Dec 07 14:26:56 openHABianDevice systemd[1]: Started Bluetooth service.
Dec 07 14:26:56 openHABianDevice bluetoothd[602]: Starting SDP server
Dec 07 14:26:56 openHABianDevice bluetoothd[602]: Bluetooth management interface 1.14 initialized
Dec 07 14:26:56 openHABianDevice bluetoothd[602]: Sap driver initialization failed.
Dec 07 14:26:56 openHABianDevice bluetoothd[602]: sap-server: Operation not permitted (1)
Dec 07 14:26:57 openHABianDevice bluetoothd[602]: Failed to set privacy: Rejected (0x0b)
I am running bluez on version 5.5. I understand that the doc says that it needs to be an older version but I saw that @Constantinos_Contis was able to get his working with the same version
I also installed the same jar as him by running the following:
bundle:install -s https://repo1.maven.org/maven2/com/github/hypfvieh/bluez-dbus-osgi/0.1.3/bluez-dbus-osgi-0.1.3.jar
After a restart I manually added the controller to the paper ui which gave me this error in the logs
2020-12-07 14:31:22.740 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method ‘ThingHandler.initialize()’ on ‘org.openhab.binding.bluetooth.bluez.handler.BlueZBridgeHandler@18eefb1’: BlueZ JNI connection cannot be established.
java.lang.IllegalStateException: BlueZ JNI connection cannot be established.
at org.openhab.binding.bluetooth.bluez.handler.BlueZBridgeHandler.initialize(BlueZBridgeHandler.java:73) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_272]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_272]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_272]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_272]
at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:152) [bundleFile:?]
at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_272]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_272]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_272]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_272]
Caused by: java.lang.UnsatisfiedLinkError: tinyb.BluetoothManager.getNativeAPIVersion()Ljava/lang/String;
at tinyb.BluetoothManager.getNativeAPIVersion(Native Method) ~[?:?]
at tinyb.BluetoothManager.getBluetoothManager(BluetoothManager.java:304) ~[?:?]
at org.openhab.binding.bluetooth.bluez.handler.BlueZBridgeHandler.initialize(BlueZBridgeHandler.java:68) ~[?:?]
… 10 more
2020-12-07 14:31:22.752 [ERROR] [core.thing.internal.ThingManagerImpl] - Exception occurred while initializing handler of thing ‘bluetooth:bluez:5ae775d0’: BlueZ JNI connection cannot be established.
java.lang.IllegalStateException: BlueZ JNI connection cannot be established.
at org.openhab.binding.bluetooth.bluez.handler.BlueZBridgeHandler.initialize(BlueZBridgeHandler.java:73) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_272]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_272]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_272]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_272]
at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:152) [bundleFile:?]
at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_272]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_272]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_272]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_272]
Caused by: java.lang.UnsatisfiedLinkError: tinyb.BluetoothManager.getNativeAPIVersion()Ljava/lang/String;
at tinyb.BluetoothManager.getNativeAPIVersion(Native Method) ~[?:?]
at tinyb.BluetoothManager.getBluetoothManager(BluetoothManager.java:304) ~[?:?]
at org.openhab.binding.bluetooth.bluez.handler.BlueZBridgeHandler.initialize(BlueZBridgeHandler.java:68) ~[?:?]
I checked my HCIUART and that also seems to be running fine when I use:
sudo systemctl start hciuart
I’m kind of out of ideas on how to fix this.