Status: UNINITIALIZED - HANDLER_INITIALIZING_ERROR BlueZ JNI connection cannot be established.
log error
2020-10-24 08:11:30.052 [hingStatusInfoChangedEvent] - 'bluetooth:bluez:27e2b1b0' changed from UNINITIALIZED to INITIALIZING
==> /var/log/openhab2/openhab.log <==
2020-10-24 08:11:30.078 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.initialize()' on 'org.openhab.binding.bluetooth.bluez.handler.BlueZBridgeHandler@16dbf15': 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.GeneratedMethodAccessor64.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_265]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_265]
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_265]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_265]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_265]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_265]
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) ~[?:?]
... 9 more
==> /var/log/openhab2/events.log <==
2020-10-24 08:11:30.116 [hingStatusInfoChangedEvent] - 'bluetooth:bluez:27e2b1b0' changed from INITIALIZING to UNINITIALIZED (HANDLER_INITIALIZING_ERROR): BlueZ JNI connection cannot be established.
==> /var/log/openhab2/openhab.log <==
2020-10-24 08:11:30.107 [ERROR] [core.thing.internal.ThingManagerImpl] - Exception occurred while initializing handler of thing 'bluetooth:bluez:27e2b1b0': 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.GeneratedMethodAccessor64.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_265]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_265]
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_265]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_265]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_265]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_265]
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) ~[?:?]
... 9 more
Looks like you havenāt setup the tinyb library properly yet. I donāt know if Iāve posted a link for the new dbus-bluez jar yet. So give me a couple of minutes while I compile and upload it.
I decided to replace the tinyb version that I uploaded with the dbus version. Just download this new version and replace the one in your addons directory.
restarted and finally i get Bluetooth Interface openhab at my inbox,add it as a thing and i get
2020-10-24 14:39:44.406 [hingStatusInfoChangedEvent] - 'bluetooth:bluez:hci0' changed from UNINITIALIZED to INITIALIZING
2020-10-24 14:39:44.444 [hingStatusInfoChangedEvent] - 'bluetooth:bluez:hci0' changed from INITIALIZING to UNKNOWN (CONFIGURATION_PENDING): Initializing
2020-10-24 14:39:49.068 [vent.ItemStateChangedEvent] - LGThinQDryer_LastSeen changed from 2020-10-24T14:38:48.491+0300 to 2020-10-24T14:39:49.033+0300
2020-10-24 14:39:49.536 [hingStatusInfoChangedEvent] - 'bluetooth:bluez:hci0' changed from UNKNOWN (CONFIGURATION_PENDING): Initializing to OFFLINE (COMMUNICATION_ERROR): Native adapter could not be found for address 'B8:27:EB:63:EF:FC'
huh, I donāt think I gave you the wrong address. It might be that the adapter wasnāt started yet.
If all else fails try running a manual bluetooth thing discovery from the inbox and see what adapter shows up. If no adapter shows up then confirm that the adapters are active through bluetoothctl.
my bluetooth and dbus services are active but no bluetooth adapter when i run sudo bluetoothctl.Then i saw that hciuart is down
[17:30:29] openhabian@openhab:~$ sudo systemctl start hciuart
Job for hciuart.service failed because the control process exited with error code.
See "systemctl status hciuart.service" and "journalctl -xe" for details.
I do have plans in the works for adding support for a mqtt bluetooth adapter, which would allow the bluetooth binding to interact with remote bluetooth devices over mqtt. But as right now the binding doesnāt have that capability. That feature is likely a couple of months down the road.
I just finished adding basic support for unknown characteristics. Unknown characteristics display their data as raw binary in hexadecimal. You can write data to those characteristics with hexadecimal as well.
This feature still requires a bit of polish and I donāt have any of the safeguards that should normally be present (e.g. limiting input length). Iāll continue work on this but at the very least users with unrecognized devices can begin play around a bit.
You can download these latest changes for the from the same links I posted prior:
With the latest bluetooth jar you should definitely be seeing other channelsā¦
Did you uninstall the official binding first?
If you are installing from the addons then you need to make sure that you also uninstall the official binding bundle in the openhab-cli.
Hi Connor, thanks for your work on the Bluetooth binding. When I install the Bluetooth binding from add-onās on paperui I get the ājni connection cannot be establishedā error for bluez.
With these installed however I didnāt see the extensions (like AM43, that I would like to use). Are these not included? I did get it to work eventually by installing the binding from paperui first. After uninstalling bluetooth and bluetooth.bluez in karaf I copied the jarās into the addon dir and ended up with your binding including extensions. Would be great to have the ārevivedā binding into openHAB stable including extensions and without dependency on tinyb.
The new bluetooth.bluez extension has already been merged into the latest OH3 snapshot and will be available in the milestone 2 release. Iām now in the process trying to get the ārevivedā binding merged as well. With luck it should get into M2 as well but Iām still waiting on some changes in the core to add support for all of the units that bluetooth uses. That way the binding will use UoM like other bindings. Iām going to put all my effort into developing the binding for OH3 so I donāt think Iāll do any more binding updates for OH 2.5.
First of all THANKS FOR WORK AND EFFORT YOU PUT!!! butā¦
It is bit of a mess with correct installation, why bluetooth binding canāt be uninstalled from paper ui and installed again with new work??? Why everything needs to be done through openhab-cli? Could you please write little note here on what and where needs to be done in order to get thing working.
P.S. I will try again to uninstall and install binding, but not sure it will work as already done this number of times.
Thanks for all the awesome work on this- Iām very excited to try out the unknown characteristics functionality.
I downloaded the latest versions of the binding & bluez jars from your links and also ran the command further up the thread to install the bluez-dbus-osgi bundle and then restarted openHAB (actually, I restarted the pi/openhabian this is running on).
However, after the restart my Bluetooth BlueZ Adapter shows up in the PaperUI with āOffline- Communication Errorā and I get a āNot Connectedā stack trace in the openhab.log:
The error message indicates to check that bluetoothd is running. It does appear to be:
I then wondered if the bluez-dbus-osgi module wasnāt installed properly but it seems to show up:
I do notice this in daemon.log but this doesnāt appear to be a new error but maybe something about my bluetooth dbus setup has been broken for a while and because the old version of the binding used tinyb it didnāt impact me?
Any ideas what else might lead to the stack trace above or any ideas how I can debug further? Have I missed a step somewhere in the process? Am I missing some permissions?