Revival of Official Bluetooth Binding

Thank you. My current OH2 is a docker container in ubuntu. Wish me luck! :slight_smile:

Hi Connor,
hope you’re well…

May I ask you if you made some progress regarding the “received broadcast” stuff?

I’ve received another set of Bluetooth thermometers to be re-flashed with ATC firmware and uncertain if I should integrate them via a Python-to-MQTT-script approach or if could wait for getting it work with the Bluetooth binding (What I would prefer of course :wink: )

I’m still a ways off from getting the received broadcast feature implemented, but it is definitely something that I will tackle since I just bought some bluetooth devices that require listening in on their broadcasts. I think that such a feature is at least a month away from getting finished though.

For now my most pressing issue will be improving bluetooth discovery since it is annoying the crap out of me right now since I just finish setting up my new OH 3 system.


for those who have xiaomi bluetooth temp V1 (MJ_HT_V1). I’ve created an simple script to read gatt values from device and publish them to an MQTT thing on mosquitto server. (openhabian on raspberry). Hope the bluetooth binding is fixed soon, but meanwhile we can read values with this workaround.

sometimes the script gives an error (don’t know why) but most of times works great.

Just replace AA:BB:CC:DD:EE:FF with you mijia bluetooth ID device and schedule it on cron or on a periodic rule (by example: executeCommandLine("/etc/openhab/scripts/") )

bt=$(timeout 20 gatttool -b AA:BB:CC:DD:EE:FF --char-write-req --handle=‘0x10’ --value=“0100” --listen| grep “Notification handle” -m 2)
if [ -z “$bt” ]
echo “The reading failed”
echo “Got data”
echo $bt
temp=$(echo $bt | tail -1 | grep -oP ‘value: \K.’ | xxd -r -p | cut -f 1 -d" " | cut -f 2 -d"=")
humid=$(echo $bt | tail -1 | grep -oP 'value: \K.
’ | xxd -r -p | cut -f 2 -d" " | cut -f 2 -d"=" | tr -d ‘\0’)

mosquitto_pub -h -t “Temperature_device/Temperature” -m $temp
mosquitto_pub -h -t “Temperature_device/Humidity” -m $humid

echo $temp “-” $humid

1 Like


Any updates regarding connection modes?

There is already a PR for the connection modes that is just waiting for approval.

1 Like

Has anyone tested with Tile beacon? I’m using bluegiga dongle - tried with beacon-mode and when I add RSSI channel it shows offline

During scan with bluegiga I’m getting;

2021-03-01 23:42:33.874 [ERROR] [com.github.hypfvieh.DbusHelper ] - Critical error while reading DBUS response (maybe no bluetoothd daemon running?)
org.freedesktop.dbus.errors.ServiceUnknown: The name org.bluez was not provided by any .service files

Does bluez needed for bluegiga dongle?

Any ideas? Is it proper?

Does this also support airthings wave mini?

Hi all,
First time I’m trying to connect a Bluetooth device to my system and I’m having a bit trouble, I think I’m missing something.
I’m running OH 3.0.1 on RPi4 (with openhabian).

I have an iTAG device (on of those anti lost beacons) and from what I read it’s supposed to implement GATT protocol, so I tried adding it as the generic device that exposes GATT. The one described in this link:

First I defined a bridge thing, which is the BlueZ interface because I don’t have any BT stick at the moment.
For some reason I can’t find using the scan button so I tried adding it manually.
I can confirm that both the bridge is working properly because I successfully discovered and added my smartphone as a thing, and also that the iTAG is working because I successfully interacted with it through several BLE apps on my smartphone.

So I extracted its MAC from on of those BLE apps and entered in the thing configuration page. (MainUI).

After saving the thing status is OFFLINE with CONFIGURATION_ERROR saying it’s not associated with any bridge.
But the configuration page doesn’t have the field for selecting the bridge (see screenshot):

So my questions are:

  1. In case it’s a bug with the binding, where should I post it so it could be checked out?
  2. Is there a way to manually add the bridge configuration?
  3. Has anyone succeeded to work with those BLE tags on OH3 with the BT binding and can share about the process?

Thank you all for the time and effort.

1 Like


@cpmeister - any news with connection modes?


I have 2 different Bluetooth devices and a handful of them in use. One is the Xiaomi Mi Flower and the other is the LYWSD03MMC temperature and humidity sensor. The Mi Flower is recognised when scanning, but as a beacon and therefore without sensor values. If I integrate it manually, a connection is briefly established, which also enters the channels, but then there is an error message and the sensor values are also interpreted incorrectly (the values are the same for all devices, so it probably takes the wrong hex value). What could be the reason for this, or are the sensors simply not yet implemented?

I have installed the ATC variant for the LYWSD03MMC, but as far as I understand it, the interpretation of broadcast has not yet been implemented. What is the status here? Will the devices also be found in future via the search function (if auto search is enabled)? Or do they always have to be added manually.

Thanks for the effort

Greetings Sebastian

1 Like


I’m totally new to OH, my apologies if this isn’t the thread to ask this question.

I’ve successfully connected my pulse oximeter with the Bluetooth Binding and Generic Bluetooth Device extension, and I’m receiving data from it. However the data is in a hex format with extra info. I’ve been able to figure out which parts of the string I need.

How do I go about parsing the hex string in OpenHab or Bluetooth Binding, in order to display the correct parts of the string in decimal form on my dashboard?

Thanks, love the binding - implementing was pretty intuitive

1 Like

I think you can use javascript transformation on your item link via a link profile.
Doing so, you can use your (hex-) string input channel converted by javascript to some of your item’s data.

If you have to extract more than one value out of the provided hex string, you simply can create multiple item links to the same string channel with different transformation profiles.

Hope that helps :wink:

1 Like

@curlyel thank you! Exactly what I needed.

I’m new to openhab, and have found the bluetooth binding extremely useful for my needs.

I’m currently trying to connect a blood pressure device that requires me to write a hex string to a particular characteristic before I can acquire a data notification with the data I actually need.

It sounds like you have created write functionality in the bluetooth binding. I can’t seem to find it within the binding options.

My device is created as a generic bluetooth device in a thing file. I can connect to it and see a list of items.

I know I’m probably missing something and just want to reach out to see if you or anyone else can point me in the right direction.


anyone manage to hook up a Mi Kettle with this binding?It discovers my MiKettle as " A generic Bluetooth device in beacon-mode" with only a RSSI channel…Any ideas how to get status and temperature ?

Looks very interesting, but after installing the binding and adding the bridge I noticed performance issues with my Raspberry PI 3. Looked at inbox, there were 700+ inbox items :expressionless: Did not expect that. I removed the binding and will try to experiment with the node-red’s * node-red-contrib-generic-ble* for now. Maybe will give it another shot later. Thanks for the binding anyway!

I’m having some issues on stable 3.1 and 3.2.0M1. I’m using Windows and a Bluegiga BLE adapter. I would like to connect Airthings Wave Plus. But when I scan for devices they all show up as beacon devices. If I manually add Airthings Wave Plus by specifying the MAC address, it will show an error after a while saying it could not discover the services of the device. Anyone that knows a solution? What is the best way to troubleshoot this?

Here are the debug logs from bluetooth.bluegiga and bluetooth.airthings:

2021-08-26 21:07:57.939 [DEBUG] [gs.internal.AbstractAirthingsHandler] - Initialize
2021-08-26 21:07:57.939 [DEBUG] [gs.internal.AbstractAirthingsHandler] - Using configuration: [address=E4:E1:12:29:D6:84, refreshInterval=300]
2021-08-26 21:07:57.939 [DEBUG] [gs.internal.AbstractAirthingsHandler] - Start scheduled task to read device in every 300 seconds
2021-08-26 21:08:07.949 [DEBUG] [gs.internal.AbstractAirthingsHandler] - Device E4:E1:12:29:D6:84 state is DISCONNECTED, serviceState NOT_RESOLVED, readState IDLE
2021-08-26 21:08:07.949 [DEBUG] [gs.internal.AbstractAirthingsHandler] - Time since last update: 310 sec
2021-08-26 21:08:07.949 [DEBUG] [gs.internal.AbstractAirthingsHandler] - Connect to device E4:E1:12:29:D6:84...
2021-08-26 21:08:07.949 [DEBUG] [uegiga.handler.BlueGigaBridgeHandler] - BlueGiga Connect: address E4:E1:12:29:D6:84.
2021-08-26 21:08:07.949 [DEBUG] [.internal.BlueGigaTransactionManager] - Send frame #24: BlueGigaConnectDirectCommand [address=E4:E1:12:29:D6:84, addrType=GAP_ADDRESS_TYPE_PUBLIC, connIntervalMin=80, connIntervalMax=800, timeout=1000, latency=3]
2021-08-26 21:08:07.949 [DEBUG] [.internal.BlueGigaTransactionManager] - Received frame #24: BlueGigaConnectDirectResponse [result=SUCCESS, connectionHandle=0]
2021-08-26 21:08:07.949 [DEBUG] [gs.internal.AbstractAirthingsHandler] - Connected to device E4:E1:12:29:D6:84
2021-08-26 21:08:08.262 [DEBUG] [gs.internal.AbstractAirthingsHandler] - Connection State Change Event is CONNECTED
2021-08-26 21:08:08.262 [DEBUG] [gs.internal.AbstractAirthingsHandler] - Device E4:E1:12:29:D6:84 state is CONNECTED, serviceState NOT_RESOLVED, readState IDLE
2021-08-26 21:08:08.262 [DEBUG] [gs.internal.AbstractAirthingsHandler] - Discover services on device E4:E1:12:29:D6:84
2021-08-26 21:08:08.262 [DEBUG] [gs.internal.AbstractAirthingsHandler] - Discover services for device E4:E1:12:29:D6:84
2021-08-26 21:08:08.262 [DEBUG] [uegiga.handler.BlueGigaBridgeHandler] - BlueGiga FindPrimary: connection 0
2021-08-26 21:08:08.262 [DEBUG] [.internal.BlueGigaTransactionManager] - Send frame #25: BlueGigaReadByGroupTypeCommand [connection=0, start=1, end=65535, uuid=00002800-0000-1000-8000-00805f9b34fb]
2021-08-26 21:08:08.262 [DEBUG] [.internal.BlueGigaTransactionManager] - Received frame #25: BlueGigaReadByGroupTypeResponse [connection=0, result=SUCCESS]
2021-08-26 21:08:09.219 [DEBUG] [oth.bluegiga.BlueGigaBluetoothDevice] - BlueGiga procedure completed but procedure is null with connection 0, address E4:E1:12:29:D6:84
2021-08-26 21:08:13.293 [DEBUG] [uegiga.handler.BlueGigaBridgeHandler] - Activate passive scan
2021-08-26 21:08:13.293 [DEBUG] [.internal.BlueGigaTransactionManager] - Send frame #26: BlueGigaEndProcedureCommand []
2021-08-26 21:08:13.293 [DEBUG] [.internal.BlueGigaTransactionManager] - Received frame #26: BlueGigaEndProcedureResponse [result=WRONG_STATE]
2021-08-26 21:08:13.293 [DEBUG] [.internal.BlueGigaTransactionManager] - Send frame #27: BlueGigaSetScanParametersCommand [scanInterval=6400, scanWindow=6400, activeScanning=false]
2021-08-26 21:08:13.293 [DEBUG] [.internal.BlueGigaTransactionManager] - Received frame #27: BlueGigaSetScanParametersResponse [result=SUCCESS]
2021-08-26 21:08:13.293 [DEBUG] [.internal.BlueGigaTransactionManager] - Send frame #28: BlueGigaDiscoverCommand [mode=GAP_DISCOVER_OBSERVATION]
2021-08-26 21:08:13.293 [DEBUG] [.internal.BlueGigaTransactionManager] - Received frame #28: BlueGigaDiscoverResponse [result=SUCCESS]
2021-08-26 21:08:13.293 [DEBUG] [uegiga.handler.BlueGigaBridgeHandler] - Passive scanning succesfully started.
2021-08-26 21:08:17.965 [DEBUG] [gs.internal.AbstractAirthingsHandler] - Device E4:E1:12:29:D6:84 state is CONNECTED, serviceState RESOLVING, readState IDLE
2021-08-26 21:08:17.970 [DEBUG] [gs.internal.AbstractAirthingsHandler] - Unhandled serviceState RESOLVING on device E4:E1:12:29:D6:84
2021-08-26 21:08:27.981 [DEBUG] [gs.internal.AbstractAirthingsHandler] - Device E4:E1:12:29:D6:84 state is CONNECTED, serviceState RESOLVING, readState IDLE
2021-08-26 21:08:27.981 [DEBUG] [gs.internal.AbstractAirthingsHandler] - Unhandled serviceState RESOLVING on device E4:E1:12:29:D6:84
2021-08-26 21:08:37.996 [DEBUG] [gs.internal.AbstractAirthingsHandler] - Device E4:E1:12:29:D6:84 state is CONNECTED, serviceState RESOLVING, readState IDLE
2021-08-26 21:08:37.996 [DEBUG] [gs.internal.AbstractAirthingsHandler] - Unhandled serviceState RESOLVING on device E4:E1:12:29:D6:84
2021-08-26 21:08:48.004 [DEBUG] [gs.internal.AbstractAirthingsHandler] - Device E4:E1:12:29:D6:84 state is CONNECTED, serviceState RESOLVING, readState IDLE
2021-08-26 21:08:48.004 [DEBUG] [gs.internal.AbstractAirthingsHandler] - Unhandled serviceState RESOLVING on device E4:E1:12:29:D6:84
2021-08-26 21:08:58.012 [DEBUG] [gs.internal.AbstractAirthingsHandler] - Device E4:E1:12:29:D6:84 state is CONNECTED, serviceState RESOLVING, readState IDLE
2021-08-26 21:08:58.012 [DEBUG] [gs.internal.AbstractAirthingsHandler] - Unhandled serviceState RESOLVING on device E4:E1:12:29:D6:84
2021-08-26 21:09:08.027 [DEBUG] [gs.internal.AbstractAirthingsHandler] - Device E4:E1:12:29:D6:84 state is CONNECTED, serviceState RESOLVING, readState IDLE
2021-08-26 21:09:08.027 [DEBUG] [gs.internal.AbstractAirthingsHandler] - ERROR:  Controller reset needed.  Unhandled serviceState RESOLVING on device E4:E1:12:29:D6:84
2021-08-26 21:09:08.293 [DEBUG] [oth.bluegiga.BlueGigaBluetoothDevice] - Procedure GET_SERVICES timeout for device E4:E1:12:29:D6:84

Anyone that knows the binding and have an idea whats going wrong?