3rd Party Bluetooth Binding. Beta testers needed

bluetooth
binding
Tags: #<Tag:0x00007f0147511a68> #<Tag:0x00007f0147511798>

(Stefan) #747

I see no difference with the new version. Same problem.

For now I put this on hold until I’ve moved to my new home and every room has its own BT adapter.


(haesslo) #748

Hi Vlad

I am excited by the binding. Works for me with MiFlora and with the beacon app on the phone!

Of course I am immediatly looking further.
For now I am using arduino like chips (ESP12, ESP32) for some of my sensors (like light, tempreature, motion…) using MQTT over Wifi, but it would be much nicer (integration, power consumption…) if I could use the esp32 (an arduino like chip with BLE) together with your binding.

So i played around and made the ESP32 advertise and being recognized by your binding:

I also get it to read an attribute in bluetoothctl:
Attempting to read /org/bluez/hci0/dev_30_AE_A4_26_3D_82/service0028/char0029
[CHG] Attribute /org/bluez/hci0/dev_30_AE_A4_26_3D_82/service0028/char0029 Value: 0x68
[CHG] Attribute /org/bluez/hci0/dev_30_AE_A4_26_3D_82/service0028/char0029 Value: 0x69
[CHG] Attribute /org/bluez/hci0/dev_30_AE_A4_26_3D_82/service0028/char0029 Value: 0x20
[CHG] Attribute /org/bluez/hci0/dev_30_AE_A4_26_3D_82/service0028/char0029 Value: 0x68
[CHG] Attribute /org/bluez/hci0/dev_30_AE_A4_26_3D_82/service0028/char0029 Value: 0x61
[CHG] Attribute /org/bluez/hci0/dev_30_AE_A4_26_3D_82/service0028/char0029 Value: 0x65
[CHG] Attribute /org/bluez/hci0/dev_30_AE_A4_26_3D_82/service0028/char0029 Value: 0x73
[CHG] Attribute /org/bluez/hci0/dev_30_AE_A4_26_3D_82/service0028/char0029 Value: 0x73
[CHG] Attribute /org/bluez/hci0/dev_30_AE_A4_26_3D_82/service0028/char0029 Value: 0x6c
[CHG] Attribute /org/bluez/hci0/dev_30_AE_A4_26_3D_82/service0028/char0029 Value: 0x6f
68 69 20 68 61 65 73 73 6c 6f hi haesslo

But now I am kind of stuck how your binding would read this attribute/link it to a channel in openhab ?

Any chance we could get this going … ?


(Vlad Kolotov) #749

Have a look here: https://github.com/sputnikdev/eclipse-smarthome-bluetooth-binding/blob/master/gatt-extensions.md

Happy to help you. Please create a ticket on github so we do not pollute this thread.


(Jan Linders) #750

Hi Vlad, Interesting developments you have done thusfar. Excellent job.
I’m currently testing BT Phone presence (i have access to both Android and Iphone).
No need for getting actual data or connect to them.
The OH binding works fine as long as the devices are set to discoverable.
Is there a way to get the presence detected without the devices being in discover mode.
The Bleuz tool : l2ping is able to do exactly this.
I have put a issue in Github for adding similar functionality in your bindings.
Let me know if I can help testing.


(Vlad Kolotov) #751

Hi @curlyel,

No, I don’t think so. I thought that the serial-over-ip binding creates a virtual port under /dev/ so that the binding would pick them up automatically… I’ll need to spend some time doing some experiments with the serial-over-ip binding.


(Vlad Kolotov) #752

Hi @Dibbler42, just wondering how it is going? Have you had any chance to look at what api your covfefe maker has?


(Thomas Bail) #753

Hi @vkolotov, tried it verry hard, but get nothing. Firt added a coffee machine thing, waitet, nothing, then switches on connection control, get connected, waited, nothing.

So it seems not so easy to find out things are working


(Curlyel) #754

Hi @vkolotov,
regarding:

Good news: It runs now for almost two weeks without any drop of a Bluegiga dongle on the non-virtualized test system . So the issue regarding the serial dongle drops seems to be VMWare-related. I probable should revert to the legacy ESXi-USB driver by doing…

esxcli system module set -m=vmkusb -e=FALSE

… once I go back to the VM.

I’ll keep you posted :wink:


(Anders Alfredsson) #755

First of all, thanks you for all your hard work!

I just bought a cheap christmas led strip, that can be controlled using bluetooth. I have deconstructed some of the protocol it uses, and found that to turn it on i need to send the value 0x01010101 (hex) to a certain characteristic (is that the right term?) and 0x01010100 to turn it off. I can do this through the nRF android app successfully.
I have created a thing, and can see the custom gatt-characteristic, and read its value (seems to always be 0x3333 by default) which is presented in the item as [33, 33]. But what should I do to send a hex value? I’ve tried to input [01, 01, 01, 00] (just using paperui for testing), but nothing happens.

Also, my bluetooth service seems to crash frequently:

● bluetooth.service - Bluetooth service
   Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
   Active: failed (Result: signal) since Wed 2018-12-05 16:47:59 CET; 14min ago
     Docs: man:bluetoothd(8)
  Process: 15993 ExecStart=/usr/lib/bluetooth/bluetoothd (code=killed, signal=SEGV)
 Main PID: 15993 (code=killed, signal=SEGV)
   Status: "Running"

Dec 05 16:45:10 Hemmet bluetoothd[15993]: Starting SDP server
Dec 05 16:45:10 Hemmet bluetoothd[15993]: Bluetooth management interface 1.14 initialized
Dec 05 16:45:10 Hemmet bluetoothd[15993]: Failed to obtain handles for "Service Changed" characteristic
Dec 05 16:45:10 Hemmet bluetoothd[15993]: Sap driver initialization failed.
Dec 05 16:45:10 Hemmet bluetoothd[15993]: sap-server: Operation not permitted (1)
Dec 05 16:45:10 Hemmet bluetoothd[15993]: Failed to set privacy: Rejected (0x0b)
Dec 05 16:45:49 Hemmet bluetoothd[15993]: Error reading PNP_ID value: Unexpected error code
Dec 05 16:47:59 Hemmet systemd[1]: bluetooth.service: Main process exited, code=killed, status=11/SEGV
Dec 05 16:47:59 Hemmet systemd[1]: bluetooth.service: Unit entered failed state.
Dec 05 16:47:59 Hemmet systemd[1]: bluetooth.service: Failed with result 'signal'.

Would be happy for any pointers!

Running openhab 2.4 M7 on raspbian stretch, rpi 3. BlueZ version 5.43


(Vlad Kolotov) #756

Hi @pacive, you should be able to control your LED once you’ve fixed your Bluez.

Can you please double check what version you are running?

pi@raspberrypi:~ $ /usr/lib/bluetooth/bluetoothd --version
5.47

Anyway, you should fix segfault error, otherwise it wont’ work basically :slight_smile:

Check syslog for more detailed errors.


(Anders Alfredsson) #757

I have version 5.43, but that should be compatible with the binding right? The segfault seems to happen randomly, even when the binding is just in discovery mode. Here’s a longer extract from syslog, from start to failiure (the java process is openhab)

Dec  5 19:53:01 Hemmet systemd[1]: Starting Bluetooth service...
Dec  5 19:53:01 Hemmet bluetoothd[28369]: Bluetooth daemon 5.43
Dec  5 19:53:01 Hemmet systemd[1]: Started Bluetooth service.
Dec  5 19:53:01 Hemmet bluetoothd[28369]: Starting SDP serverDec  5 19:53:01 Hemmet dbus[313]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service'
Dec  5 19:53:01 Hemmet bluetoothd[28369]: Bluetooth management interface 1.14 initialized
Dec  5 19:53:01 Hemmet bluetoothd[28369]: Failed to obtain handles for "Service Changed" characteristic
Dec  5 19:53:01 Hemmet bluetoothd[28369]: Sap driver initialization failed.
Dec  5 19:53:01 Hemmet bluetoothd[28369]: sap-server: Operation not permitted (1)
Dec  5 19:53:01 Hemmet bluetoothd[28369]: Failed to set privacy: Rejected (0x0b)
Dec  5 19:53:01 Hemmet systemd[1]: Starting Hostname Service...
Dec  5 19:53:01 Hemmet java[22516]: g_dbus_interface_get_info: assertion 'G_IS_DBUS_INTERFACE (interface_)' failed
Dec  5 19:53:01 Hemmet java[22516]: g_dbus_interface_get_info: assertion 'G_IS_DBUS_INTERFACE (interface_)' failed
Dec  5 19:53:01 Hemmet java[22516]: g_dbus_interface_get_info: assertion 'G_IS_DBUS_INTERFACE (interface_)' failed
Dec  5 19:53:01 Hemmet java[22516]: g_dbus_interface_get_info: assertion 'G_IS_DBUS_INTERFACE (interface_)' failed
Dec  5 19:53:01 Hemmet java[22516]: g_dbus_interface_get_info: assertion 'G_IS_DBUS_INTERFACE (interface_)' failed
Dec  5 19:53:01 Hemmet java[22516]: g_dbus_interface_get_info: assertion 'G_IS_DBUS_INTERFACE (interface_)' failed
Dec  5 19:53:01 Hemmet java[22516]: g_dbus_interface_get_info: assertion 'G_IS_DBUS_INTERFACE (interface_)' failed
Dec  5 19:53:01 Hemmet java[22516]: g_dbus_interface_get_info: assertion 'G_IS_DBUS_INTERFACE (interface_)' failed
Dec  5 19:53:01 Hemmet java[22516]: g_dbus_interface_get_info: assertion 'G_IS_DBUS_INTERFACE (interface_)' failed
Dec  5 19:53:01 Hemmet java[22516]: g_dbus_interface_get_info: assertion 'G_IS_DBUS_INTERFACE (interface_)' failed
Dec  5 19:53:01 Hemmet java[22516]: g_dbus_interface_get_info: assertion 'G_IS_DBUS_INTERFACE (interface_)' failed
Dec  5 19:53:01 Hemmet java[22516]: g_dbus_interface_get_info: assertion 'G_IS_DBUS_INTERFACE (interface_)' failed
Dec  5 19:53:01 Hemmet java[22516]: g_dbus_interface_get_info: assertion 'G_IS_DBUS_INTERFACE (interface_)' failed
Dec  5 19:53:01 Hemmet dbus[313]: [system] Successfully activated service 'org.freedesktop.hostname1'
Dec  5 19:53:01 Hemmet systemd[1]: Started Hostname Service.
Dec  5 19:54:17 Hemmet systemd[1]: bluetooth.service: Main process exited, code=killed, status=11/SEGV
Dec  5 19:54:17 Hemmet systemd[1]: bluetooth.service: Unit entered failed state.
Dec  5 19:54:17 Hemmet systemd[1]: bluetooth.service: Failed with result 'signal'.

Do you want a debug log from the binding as well?


(Vlad Kolotov) #758

How did you install Bluez? Can you please double check if you are running correct version by running this?

pi@raspberrypi:~ $ /usr/lib/bluetooth/bluetoothd --version

Sometimes it does not get installed correctly so that you might run an old version of Bluez.

Update: from your logs I see you are running 5.43. It is good. Still the question how you installed it remains.


(Anders Alfredsson) #759
[20:27:39] openhabian@Hemmet:~$ /usr/lib/bluetooth/bluetoothd --version
5.43

I’m running openhabian, and haven’t installed it manually, so I think it would have come preinstalled.


(Vlad Kolotov) #760

Not sure what to say here, never seen this error so far. I’d suggest you to try to rebuild/reinstall Bluez as per this: https://github.com/sputnikdev/bluetooth-manager-tinyb#building-bluez-from-sources


(Anders Alfredsson) #761

Will try that and report back, thanks!


(Anders Alfredsson) #762

Updated now, but still the same… Remembered though that I hadn’t checked the openhab log, and there was a bunch of errors as well:

2018-12-05 21:12:49.035 [ome.event.ItemCommandEvent] - Item 'LED40200000000_0000fff100001000800000805f9b34fb' received command [01, 01, 01, 00]
2018-12-05 21:12:49.043 [nt.ItemStatePredictedEvent] - LED40200000000_0000fff100001000800000805f9b34fb predicted to become [33, 33]
==> /var/log/openhab2/openhab.log <==
2018-12-05 21:12:49.062 [WARN ] [impl.AbstractBluetoothObjectGovernor] - Error occurred while interacting (read) with native object: /B8:27:EB:C4:1C:32/24:35:CC:0C:DC:11/0000fff0-0000-1000-8000-00805f9b34fb/0000fff5-0000-1000-8000-00805f9b34fb : GDBus.Error:org.bluez.Error.NotPermitted: Not paired
2018-12-05 21:12:56.203 [WARN ] [anager.impl.CompletableFutureService] - Bluetooth error happened while competing a future: /XX:XX:XX:XX:XX:XX/24:35:CC:0C:DC:11/0000fff0-0000-1000-8000-00805f9b34fb/0000fff5-0000-1000-8000-00805f9b34fb : Error occurred while interacting (read) with native object: /B8:27:EB:C4:1C:32/24:35:CC:0C:DC:11/0000fff0-0000-1000-8000-00805f9b34fb/0000fff5-0000-1000-8000-00805f9b34fb : GDBus.Error:org.bluez.Error.NotPermitted: Not paired
2018-12-05 21:12:56.204 [WARN ] [bluetooth.handler.GattChannelHandler] - Attribute value is empty: /XX:XX:XX:XX:XX:XX/24:35:CC:0C:DC:11/0000180a-0000-1000-8000-00805f9b34fb/00002a25-0000-1000-8000-00805f9b34fb
2018-12-05 21:12:56.206 [WARN ] [anager.impl.CompletableFutureService] - Error occurred while completing (silently) futures: Error occurred while interacting (read) with native object: /B8:27:EB:C4:1C:32/24:35:CC:0C:DC:11/0000fff0-0000-1000-8000-00805f9b34fb/0000fff5-0000-1000-8000-00805f9b34fb : GDBus.Error:org.bluez.Error.NotPermitted: Not paired
2018-12-05 21:12:56.212 [WARN ] [bluetooth.handler.GattChannelHandler] - Attribute value is empty: /XX:XX:XX:XX:XX:XX/24:35:CC:0C:DC:11/0000180a-0000-1000-8000-00805f9b34fb/00002a50-0000-1000-8000-00805f9b34fb
2018-12-05 21:12:56.217 [WARN ] [bluetooth.handler.GattChannelHandler] - Attribute value is empty: /XX:XX:XX:XX:XX:XX/24:35:CC:0C:DC:11/0000180a-0000-1000-8000-00805f9b34fb/00002a27-0000-1000-8000-00805f9b34fb
2018-12-05 21:12:56.204 [WARN ] [bluetooth.handler.GattChannelHandler] - Attribute value is empty: /XX:XX:XX:XX:XX:XX/24:35:CC:0C:DC:11/0000180a-0000-1000-8000-00805f9b34fb/00002a29-0000-1000-8000-00805f9b34fb
2018-12-05 21:12:56.215 [WARN ] [bluetooth.handler.GattChannelHandler] - Attribute value is empty: /XX:XX:XX:XX:XX:XX/24:35:CC:0C:DC:11/0000180a-0000-1000-8000-00805f9b34fb/00002a23-0000-1000-8000-00805f9b34fb
==> /var/log/openhab2/events.log <==
2018-12-05 21:12:56.229 [vent.ItemStateChangedEvent] - LED40200000000_0000fff100001000800000805f9b34fb changed from [33, 33] to []
==> /var/log/openhab2/openhab.log <==
2018-12-05 21:12:56.211 [WARN ] [bluetooth.handler.GattChannelHandler] - Attribute value is empty: /XX:XX:XX:XX:XX:XX/24:35:CC:0C:DC:11/0000180a-0000-1000-8000-00805f9b34fb/00002a2a-0000-1000-8000-00805f9b34fb
2018-12-05 21:12:56.207 [WARN ] [bluetooth.handler.GattChannelHandler] - Attribute value is empty: /XX:XX:XX:XX:XX:XX/24:35:CC:0C:DC:11/0000180a-0000-1000-8000-00805f9b34fb/00002a24-0000-1000-8000-00805f9b34fb
2018-12-05 21:12:56.241 [WARN ] [impl.AbstractBluetoothObjectGovernor] - Error occurred while interacting (read) with native object: /B8:27:EB:C4:1C:32/24:35:CC:0C:DC:11/0000180a-0000-1000-8000-00805f9b34fb/00002a28-0000-1000-8000-00805f9b34fb : GDBus.Error:org.bluez.Error.Failed: Not connected
2018-12-05 21:12:56.243 [WARN ] [impl.AbstractBluetoothObjectGovernor] - Error occurred while interacting (read) with native object: /B8:27:EB:C4:1C:32/24:35:CC:0C:DC:11/0000180a-0000-1000-8000-00805f9b34fb/00002a26-0000-1000-8000-00805f9b34fb : GDBus.Error:org.bluez.Error.Failed: Not connected
2018-12-05 21:12:56.317 [WARN ] [impl.AbstractBluetoothObjectGovernor] - Error occurred while updating governor: /B8:27:EB:C4:1C:32/24:35:CC:0C:DC:11 / cd53e : GDBus.Error:org.bluez.Error.Failed: Cancelled
2018-12-05 21:12:56.320 [WARN ] [anager.impl.CompletableFutureService] - Bluetooth error happened while competing a future: /XX:XX:XX:XX:XX:XX/24:35:CC:0C:DC:11/0000180a-0000-1000-8000-00805f9b34fb/00002a26-0000-1000-8000-00805f9b34fb : Error occurred while interacting (read) with native object: /B8:27:EB:C4:1C:32/24:35:CC:0C:DC:11/0000180a-0000-1000-8000-00805f9b34fb/00002a26-0000-1000-8000-00805f9b34fb : GDBus.Error:org.bluez.Error.Failed: Not connected
2018-12-05 21:12:56.321 [WARN ] [anager.impl.CompletableFutureService] - Bluetooth error happened while competing a future: /XX:XX:XX:XX:XX:XX/24:35:CC:0C:DC:11/0000180a-0000-1000-8000-00805f9b34fb/00002a28-0000-1000-8000-00805f9b34fb : Error occurred while interacting (read) with native object: /B8:27:EB:C4:1C:32/24:35:CC:0C:DC:11/0000180a-0000-1000-8000-00805f9b34fb/00002a28-0000-1000-8000-00805f9b34fb : GDBus.Error:org.bluez.Error.Failed: Not connected
2018-12-05 21:12:56.323 [WARN ] [anager.impl.CompletableFutureService] - Error occurred while completing (silently) futures: Error occurred while interacting (read) with native object: /B8:27:EB:C4:1C:32/24:35:CC:0C:DC:11/0000180a-0000-1000-8000-00805f9b34fb/00002a26-0000-1000-8000-00805f9b34fb : GDBus.Error:org.bluez.Error.Failed: Not connected
2018-12-05 21:12:56.324 [WARN ] [anager.impl.CompletableFutureService] - Error occurred while completing (silently) futures: Error occurred while interacting (read) with native object: /B8:27:EB:C4:1C:32/24:35:CC:0C:DC:11/0000180a-0000-1000-8000-00805f9b34fb/00002a28-0000-1000-8000-00805f9b34fb : GDBus.Error:org.bluez.Error.Failed: Not connected

The connection between my pi and the device isn’t the best, could this be causing issues?


(Vlad Kolotov) #763

Hmm… it complains that it is not paired. The binding does not support pairing yet. But I guess you could try to pair it via bluetoothctl utility.

on our pi:

sudo -u openhab bluetoothctl
[bluetooth]# pair <device MAC>

Let me know how it goes


(Anders Alfredsson) #764

Had tried to pair it before using bluetoothctl, but now I got promoted for a passcode (just a default 000000). Perhaps the upgraded bluez solved that. Not getting any more errors now, but the lightstrip still doesn’t react to my commands.

I can control it directly using bluetoothctl, so the connection should be sufficient. Is [01, 01, 01, 00] the right format to send four bytes of data?


(Vlad Kolotov) #765

Yep, it should be. Is your “thing” online and connected (Have you enabled “Connection control” channel)?


(Anders Alfredsson) #766

It comes and goes, will try some other day to move my pi closer and see if that helps. Thanks for all your help!