[RELEASE] BLE (Beacon) Gateway Manager

Release Notes

  • v1.3.0 (9/24/2022) - Added support for distance estimation for Eddystone-UID beacons. Added beacon type when listing beacons in app. Changed to log errors if cannot parse gateway data. Fixed to remove beacons that were detected but never added from app state. Now sets type on beacon device. Added debug logging statement to April Brother gateway.
  • v1.2.0 (9/23/2022) - Added support for AltBeacon and Eddystone-UID beacons. Added auto processing of beacon advertised data by the app (makes building gateway drivers even easier). Now rssi and power available on beacon device, and distance estimated in feet for enhancing home automation with beacons.
  • v1.1.0 - initial public release

Original Post

Hello Hubitat Community,

I created a new app and device driver that allows you to integrate BLE beacons with Hubitat using a BLE Gateway. I built this because I saw a handful of solutions out there, but I wanted something that would work with a commercially available product. The other solutions I saw required building devices with raspberry pis and writing code, and I figured that was too difficult for the non-developer Hubitat user. This app helps you add your beacons to your Hubitat Hub using Virtual Presence device drivers. From there, you can then build automations (e.g., using the Rule Machine) that trigger events to occur based upon the presence (or absence) of a beacon.

The app (with documentation) can be found here: GitHub - ajardolino3/hubitat-ble-gateway: BLE Gateway Manager App for Hubitat.

The current version of this app works with an April Brother BLE Gateway (v4), which runs around $40. The current version also supports iBeacons, only. However, I designed the app so the gateway itself is its own driver, with a specification so others can build other drivers that can be used with other gateways on the market. You can purchase the April Brother BLE Gateway here: AB BLE Gateway 4.0 – April Brother CO.,LTD

So far, this is working well. I have it to a point where its functional, so I made my repository public so I can share it with the community, and posting it here so people know it exists. My hope is that other developers will help me improve upon this, either by building support for additional gateways or other beacon types. I am open to suggestions and improvements, just let me know. I definitely want to make this work with the Hubitat package manager, so I hope to do that in the near future, but have provided documentation on how to install and configure as it is today in the README.md section of the repository.

As far as my use case, I wanted my garage doors to automatically open/close based upon the presence of our vehicles. Since we have separate garage doors for each vehicle, using the presence of our phone is not appropriate, since its the vehicle arriving or departing that should drive the opening and/or closing of the garage door, not the person. My plan is to put a USB RadBeacon (iBeacon) in each vehicle, and use that to detect the presence of each vehicle. I will install the gateway in the garage so that it can detect the beacons as the vehicles approach the garage doors. From there, I can then use the Rule Machine to automate the opening/closing of the garage doors. (I am using a Meross garage door automation device.)

Hope you enjoy. If you have any questions, comments, or suggestions, please let me know.

10 Likes

Any chance this could read a Tile?

3 Likes

Excellent stuff! Thanks for creating/sharing this w/the community. I'm not currently using beacons, but the availability of this makes me wish I was/think I should... :slight_smile:

Is the range at which the gateway will detect the iBeacons in the car configurable in any way? Or is it binary ("iBeacon detected/not detected") for the full range of the Gateway/iBeacon(s) in use? My issue is I wouldn't want this to open the garage door unless the car is part way up the driveway (within 10-15' of the garage). Don't want the doors opening if we've parked in front of the house for some reason.

1 Like

I played with that concept about a year ago. The gateway wasn't distance configurable but the BT device's transmit power was configurable which gives you an adjustable range of detection. I used one like this plugged into my car:

https://www.amazon.com/Blue-Charm-Beacons-Bluetooth-MultiBeacon/dp/B09FYNK94F/ref=sr_1_3?crid=1UFOR3I72R0XB&keywords=ble+usb+beacon&qid=1663511868&sprefix=ble+usb+beacon%2Caps%2C48&sr=8-3

1 Like

Thanks - I had seen that and also thought it looked like a good option, small and unobtrusive.

You said you played w/this concept - did you stick with it? Did the transmit power adjustment reliably control detection point?

I didn't stick with it. When on high power, it would usually work when 30-40ft from house with gateway was just inside house. There was a definite difference between lowest power and highest power but I wouldn't say you could fine tune it.

The whole process wasn't consistent enough. There were times when I was pulled up to garage door waiting for it to open. I found it was more consistent to just have Tasker open a dashboard on my phone with a button to open door.

I would imagine so. Right now, my gateway is detecting over 30 different devices, so still trying to understand the incoming data and how to interpret it. I believe Tile is a BLE beacon, so theoretically it should pick it up, but I don't have any Tiles to try it with.

1 Like

There is an RSSI value which is detected by the gateway, which to my understanding is an approximation of distance between the beacon and the gateway. Right now, I'm not doing anything with this value, but I could store it as an attribute on the device, and then you could use this value to approximate distance. According to the Apple iBeacon protocol, you should ignore the highest 10% RSSI values and the lowest 20%, and then average the rest together to determine a measured power value to estimate range accuracy (distance). So if the gateway did this by interpreting the incoming RSSI values, it could store this as an attribute on the device. Keep in mind, this would only be an approximation, and your gateway would probably have to be placed in your garage so that the distance between the gateway and the beacon could be used to open/close the door.

1 Like

That sounds like that could be very useful.

This would be something I would try in my own car for a while first before offering it to my wife. So I have plenty of time to test it out and see how consistent and reliable it seems to be.

Very cool. Thanks!

I have one RadBeacon, but waiting for my second one to arrive. I will let you know how well it works once I get both beacons in both vehicles.

I am experimenting with ESPresence in Home Assistant for room presence. The MQTT generated supplies a distance but I have no idea how it is calculated.

I haven't used this integration, but I wrote something very similar for personal use.

I use Tile beacons with mine. But there are some caveats.


They broadcast iBeacons before they are paired, but they seem to be a bit less frequent with their broadcasts and the broadcast period is not configurable like some generic beacons I use. I assume this is to save battery life. So, I had to tweak the length of time required of observing it not showing up in scans before my code interpreted it as not present.

Also, once you pair it the broadcast stops (which means this integration would no longer see them even if they are physically present). So you can't pair them with your phone or the Tile app if you want to use them this way.


Despite these issues, I still use Tile devices as beacons because I like the form factor and replaceable batteries. But it can be frustrating to set them up and get them working well with an integration like this.
2 Likes

I have similar setup and it works very well.
My application is to automatically unlock and open my apartment door.

I only care which D1 Mini running ESPresence my phone was closest to and didn't really care about the distance that was being output. The two D1s are 40+ feet apart. However, due to this thread, I took a closer look and definitely question the accuracy. However, for my use case, it's accurate enough. I would be curious if this integration could come up with something more accurate.

1 Like

I could be imagining it, but I suspect mine are still broadcasting even though it is paired, but definitely not as frequent as I would like. What time period do you have configured? I' not actively using mine yet.... Still trying to get it all setup, including trying to convert the script to Python 3.

It was sort of inconsistent -- sometimes I would get a bunch of beacons every ~5 seconds, and then it would back off and show up only once every 20s-30s. I ended up configuring my logic to wait for up to 60s of scans without seeing it before marking it as not present.

As for yours showing up even though it is paired, that is entirely possible. I just never saw that with my Tile Pro device.

1 Like

Yesterday I read this article: Find Distance Between Two Bluetooth Devices Formula | BeingCoders and found it very interesting. I'm going to try it out with my beacons and see how well it works. If it works, I'll incorporate a "distance" attribute on each beacon device, which can then be used to further control home automation.

I'm using RadBeacons for my vehicles because they are USB powered and consistently broadcast. Radius Networks does make battery-powered beacons similar to Tile. I also just purchased a Blue Charms Beacon (USB) and going to try that one out, too.

I believe Tile devices, once paired, stop broadcasting for a reason. A traditional beacon device consistently broadcasts, if that's true about the pairing, then it may not be the best device to use as a beacon.

1 Like

I agree. I also have some RadBeacons as well as a few no-name ones that I have had mixed results with.

RadBeacons are really the best performance- and configurability-wise, but they take a while to ship and IMHO didn't have great battery-power options. The no-name ones are unpredictable but cheap. I like the form factor of Tile devices, even if they have some of the unique behaviors I mentioned above.

The gateway you based this on is a really cool device that I hadn't seen before. Thanks for sharing.

1 Like

I now have this working with the Hubitat Package Manager. :slight_smile:

1 Like

Download the Hubitat app