Revival of Official Bluetooth Binding

Presence detection won’t work for phones since they randomly generate their mac address and change it every couple of minutes or so.
Phones do this for security reasons so I can’t complain about it. Just turning on bluetooth won’t work for presence detection but I think there are apps you can download that make you phone act like a bluetooth beacon though.

don’t count on Paper UI for this type of testing… look at the logs duh

WiFi presence detection with ARP ping works pretty well, and might have better range in your house than Bluetooth.

Many of us don’t trust in a single device for presence detection, as it’s not 100% reliable. But it can be fine depending on your use case.

Good news, I just finished writing my first draft of the roaming bluetooth device feature which allows a device to be tracked across multiple bluetooth adapters and keep track of which adapter it is closest to.
I need volunteers to be guinea pigs for testing since I lack any bluetooth beacons to test with, and the outbreak has made it difficult to obtain them.

This feature should mimic the feature from the 3rd party bluetooth binding. The only difference is that you need to add a Roaming Bluetooth Adapter thing which will appear in the inbox in order to activate the feature. This new adapter will act as a virtual bridge for bluetooth devices. So when devices are discovered you need to pick the discovered device for the roaming adapter.

To test this feature you need to uninstall the official bluetooth binding and upload these jars to the addons directory:

Required:
https://github.com/cpmeister/openhab-addons/raw/blind-engine-snapshots/org.openhab.binding.bluetooth-2.5.4-SNAPSHOT.jar

For Bluez users:
https://github.com/cpmeister/openhab-addons/raw/blind-engine-snapshots/org.openhab.binding.bluetooth.bluez-2.5.4-SNAPSHOT.jar

For bluegiga users:
https://github.com/cpmeister/openhab-addons/raw/blind-engine-snapshots/org.openhab.binding.bluetooth.bluegiga-2.5.4-SNAPSHOT.jar

Happy testing!
If nothing works let me know, I probably goofed.

Sorry I wasn’t clear; I was looking at both the logs & PaperUI.

In researching, and personal testing, I found the random mac is an issue with iphones, not Android (I only have Android phones), so I’m hoping this will work for me.

I’m struggling to find an Android beacon app that works with this, can anyone make any recommendations?

However, I found that not using any phone beacon app, I can get 2 Android phones to report their rssi values several times (even after reboots, etc), but ONLY while the phone is in pair mode (making itself discoverable I believe). Is this expected? Restarting the phone and turning the bluetooth on and off does NOT trigger any rssi events to openhab (but again, putting the phone is pair mode then gets rssi events to show up in openhab for a couple minues). I’m not quite sure if this is a configuration issue on my end, my 2 phones, the Bluetooth Binding, or openhab itself (or a beacon app is required).

BTW I’m using openhab logs to troubleshoot this and determine the rssi events.

Would your latest fix address any of this by any chance?

My configs:

Things:
Bridge bluetooth:bluez:hci0 "BluetoothAdapter" [address="[MY_ADAPTER_MAC_ADDRESS]", discovery=false]
bluetooth:beacon:hci0:b1 "Kevin Phone" (bluetooth:bluez:hci0) [address="[MY_PHONE_MAC_ADDRESS]"]
Item:
Number openhab4_Kevin_RSSI "Kevin Phone Beacon [%.0f]" PubItems {channel="bluetooth:beacon:hci0:b1:rssi"}

Thanks again for what you’re doing!

To do the update, where do we put the jars (pi 4/raspbian/Debian)? And do we first need to uninstall anything?

I’ve been playing around with “Beacon Simulator” for Android. It allows you to create simulated advertising beacons such as ibeacon, eddystone, & altbeacon. I tried creating several but nothing is recognized in PaperUi via a search in the inbox. The are a lot of seeing for these beacons tho that I don’t understand. Is this expected or should these be showing up? I’m testing it this way because if this does show up & work with openhab then I could potentially use this as a beacon on my phone to do the presence detection. Thanks!

UPDATE: Just reporting that BlueZ version 5.43 & 5.50 works with this. (ie, sudo apt-get update & sudo apt-get upgrade will not break this if going to 5.50)

Hi Connor,

Curious to hear, if you made some progress on that gatt parsing feature?

I actually just started working on this the other day. But since I’m also juggling quite a few other bluetooth features that will be added in the next release I’m only making a few hours of progress here and there.

But the newest features likely to be included in the next release:

  • a new bluez binding that doesn’t require tinyb.
  • roaming device support which would allow a device to report the adapter nearest to it.
  • another bluetooth device binding for the daikin madoka thermostat.
  • a binding that allows bluetooth devices exposed over mqtt to be handled by the bluetooth binding framework (which would allow existing bluetooth bindings to handle devices over mqtt)

@hairdresser has been doing a fantastic job in implementing some of these features. He is responsible for creating the new bluez binding, the daikin binding, and the mqtt adapter support.

I’ll try to get the gatt feature done for next release but I can’t guarantee that it will be completed in time since it is a feature that requires significant testing. It also doesn’t help that I don’t have very many devices to test with.

2 Likes

Thanks @cpmeister !

To pursue on this - I can say that I am using those binding for several weeks now, and I’m delighted with stability and performances. Nothing comparable with the previous TinyB that I was never satisfied with.

2 Likes

Happy to hear that :+1:

The least what I can offer is testing with these:

image

  1. Xiaomi MiFlora plant sensor

  2. Xiaomi Mijia Bluetooth Thermometer (LYWSDCGQ/01ZM)

  3. Xiaomi Mijia Bluetooth Thermometer 2 (LYWSD03MMC)

  4. Generic Bluetooth tracking tags (Dehyaton, Elistooop)

  5. Jumper blood oximeter

Pos. 1, 2 and 4 were well working with the “3rd Party Bluetooth Binding”.
Let me know :wink:

1 Like

For BLE devices testing, I suggest you use Bleno, a Node framework to emulate a BLE device. It is a bit tricky to make it work the first time, but if you need any help, and a dummy device to test (my Daikin Madoka emulator), I’m happy to help.

On the iPhone, there is also the LightBlue app which I used as well to emulate a device.

1 Like

@curlyel
Thanks! I’ll most definitely reach out for your help once my gatt feature is ready for testing.

@hairdresser
Looks useful, I’ll look into it.

1 Like

I’m also thinking of a new feature for the Bluetooth binding through DBUS: a custom agent to allow the pairing directly from the binding. I’ve checked the tech details - I just need some time to implement this.

1 Like

Hello.I am tested this.
I get data from a temperature and humidity sensor using the third-party C ++ + Bluez program on my OrangePi PC + usb dongle bluetooth 4.0. I removed the standard bluetooth binding and installed (in addons folder) first org.openhab.binding.bluetooth.bluez-2.5.4-SNAPSHOT.jar but I did not get the Bluetooth Roaming Controller.
Next, I removed this and downloaded org.openhab.binding.bluetooth-2.5.4-SNAPSHOT.jar and the Bluetooth Roaming Controller showed up in Inbox and was added. But my Xiaomi temperature sensor was never found in Inbox.
Previous topic with my questions (no solved): Xiaomi Mija Sensor Tempetature, Bluetooth (console data)

Any progress with testing this? :slight_smile:

Mmmh. I’ve offered testing it once the GATT stuff has been implemented, that’s true :wink:
But: I’m not sure, if this has happened yet :thinking:

@cpmeister Is it done already?

Let me know…

I would also by happy to support testing. Is there any progress on this?

Hi,

I’m still not able to cover presence functionality with official binding - anyone has it?
@cpmeister - if you have ability to cover this functionality, you would be able probably to become new maintainer of project: 3rd Party Bluetooth Binding. Beta testers needed
@vkolotov had to stop it and is lookinf for someone to replace. It’s a great bindig with a lot of functionalities in comparison to official one. A lot of beacons already covered and many adapters can be used. Now, it’s not adapted to new openhab version and has some issues with connection - desperately needs new maintainer :slight_smile:

Hi, guys any update? I have managed to update bluez to the latest 5.5 version and managed to get bluez bridge online, discovered sensor, but got only RSSI data, no humidity, no temperature data. How to add those channels?