[RELEASE] BLE (Beacon) Gateway Manager

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!

1 Like

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

Have seen your comments and guide on this on multiple posts, I'm looking to make something similar but the fact that I have to have HA makes it less appealing, would there be any alternative? Looking to also automatically unlock my door with my beacon (beacon has a button press also).

great work btw.

I have tested many different "Presents Sensors" approaches.
In my specific case (apartment in relatively large apartment complex) neither
one except for the BLE Beacon have/had reasonably short and response.
At least now I don't know how to eliminate RPi in the middle.
ESPresense works very well with many different BLE Beacons but requires MQTT
broker. Unfortunately HE does not have one. So RPi was a solution for
bridging HE with ESPesense. After installing HA on RPI I figured out I can
get rid of cloud based control for my SwitchBot Curtains. This is another
very good point to keep RPi with HA because I really hate everything cloud-based.

1 Like

I haven't written a driver before but I wouldn't imagine a driver to report RSSI to hubitat would be that hard, its surprising how nobody has written one, is it because it's hard or nobody cares about BLE?