[RELEASE] BLE (Beacon) Gateway Manager

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?

First of all - HE does not have BLE Radio for supporting BLE directly.
The closets project is very nice and powerful Hubduino created by @ogiewon
But as of now Hubduino does not have a support for BLE Beacons.
Anyway, I am happy with my setup "as is" and RPi/HA in a middle.
Currently HA handles my SwitchBot Curtains (no clouds) and
BLE Beacons vis ESPresense.

1 Like

If you just need beacon detection then @brianwilson's [RELEASE] BTLE Presence Sensor (Tile Mate) will work for you. You will need to have some pi zero Ws (or zero 2 W) for this to work reliably over a sizable area as BLE range is fairly short.

Otherwise as @vitaliy_kh says HA with ESP32s are another possible route if you are thinking to extend your HE to use devices which it doesn't support. Instead of ESPresense I use standard ESPhome flashed boards and my initial testing is extremely positive. The benefit is that ESP32s are readily available and cheap compared to pi's.

I have a bunch of ESP32s laying around! How are you implementing ESPhome with Hubitat? Are you also using RPi/HA as a middle man?

So with the April Brother BLE gateway, I can easily obtain rssi and calculate distance to the beacon. The problem is that the distance calculation fluctuates because it’s measuring a radio signal strength. Determining the presence of a beacon is easy, and getting the rssi is easy, but calculating distance is much harder. The further away the beacon is, the less reliable the distance calculation. And the fact that the beacon may be moving doesn’t help. I read one article that says you’d have to sample rssi and use that with measured power for a period of 20 seconds and average together (throwing out super high or super low values) to get a more accurate distance e prediction (and that’s with the beacon not moving).

I am thinking of still setting the rssi and estimated distance calculation on the device when the beacon is detected. Then you could setup rules that are based not only on beacon presence, but also rssi and/or distance. I finally got my car back for service (which had my radbeacon in it), and I just got a blue charms beacon, so we’ll test both of those out with both cars soon and let you know the results. Will see how well it works with the rssi and distance calculations. The good news is that my app easily detected the new beacon and allowed me to create a new device for it.

Does anyone know off-hand if sending beacon data to hubitat every second would put too much strain on the device? Right now I have the gateway set to report every 5 seconds, which is great for detecting presence, but not so great for calculating distance (need more data and faster to predict distance better).

2 Likes

Thanks. I really wanted something that didn’t require me to build hardware. Curious, why does a HA (Hubitat App?) make this less appealing? Something needs to process the incoming data.

HE = Hubitat Elevation - your hub

HA = Home Assistant - Application running on separate hardware

1 Like

I added support for AltBeacon and EddyStone-UID beacons. I also added a power, rssi, and distance attribute to each beacon. Distance is calculated in feet and is an estimation.

2 Likes

So I did my first test today. Put a RadBeacon USB in one vehicle and a Blue Charms USB in the other. Set Hubitat rule to open the correct garage door when the vehicle arrives (not using distance setting). Started the car (in the garage) and door automatically opened within 5 seconds (good safety feature, normally I would open the door before starting the car, but just wanted to see what happened). Pulled out and closed door manually, then drove down the block and came back. As soon as I turned into the driveway and approached the door, the correct door opened. Tried with the other vehicle, worked exactly the same.

I did try closing the door automatically when leaving, but that got scary when the I pulled out and then the door closed immediately. Must have thought the beacon left and started to close the door. I guess I could put a delay on it, but I would NOT want the door to start closing when the car is still pulling out (or in). So I just set a rule to automatically close both doors if we are not home or at 10pm (if not home).

Just wanted to share. :slight_smile:

2 Likes

Excellent, congrats on your results! Can you remind me where you have your gateway mounted in the garage? Center front-to-back and side-to-side, or even closer to the font of the garage?

I don't like using automations for closing garage doors myself. I haven't and won't. Just too much concern about problems occurring, as I am involved in the process of setting them up. :slight_smile:

1 Like

Esphome works primarily with home assistant. ESPhome devices can also communicate via MQTT so you should be able to use it directly with HE using one of the community written MQTT apps.

I mounted it above one of my openers, near my Meross garage door home automation device. I’ve noticed the gateway will pickup lots of beacons. Honestly, I think as cars drive by my house (and that’s 90 feet from the street), it picks up their Bluetooth devices. This is why I recently made a change to clear out the beacon state for devices detected by the gateway, but weren’t added by the user and no longer present. It was building a huge list of beacon data and keeping them all in the app state (haha).

1 Like

I am selling a couple of the BLE gateways listed in the first message. I tried to get them working, but decided it was just too difficult using a MAC. Here is a link to the listing.

Thanks for posting. I only needed one for my use case, but perhaps others may want them. I found that one gateway can detect beacons with a pretty decent radius, esp. the USB ones.

1 Like

Yeah, I had hoped they would work for me. I noticed that I could never get DHCP working with them. They refuse to get the addresses I reserved for them. I even tried creating a reservation for the address they got, but they just pick another address. Weird.

1 Like

Replied on your for sale thread, I'll take one.

Blue Charm beacon also on order.

I'm all in.

Hey, @ajardolino3, thanks again for this integration.

Installed from HPM, and I have my hardware (April BLE gateway and Charm beacon) in hand and have things setup, but the HE Gateway app can't find my beacon.

Gateway is setup per your instructions, virtual BLE device added to devices and selected in the app. Charm is broadcasting (verified on my phone) but the app can't seem to find the charm beacon.

Pics, so we'll know it happened. :slight_smile:

image

App:

Device:

Gateway settings:

Blue Charm beacon showing broadcasting from my phone:

Gateway info:

The gateway is about 3' away from the blue charm beacon.

I've reloaded the app page, and restarted the gateway, restarted the hub, unplugged and plugged the beacon. No change. What did I miss? :slight_smile:

I noticed in the gateway yo have it set it filter ibeacon only. Try removing that to allow all beacons. Then turn on debugging in both the April brother device and Ble gateway app, and then look at the logs. Can you post what you see in there?

1 Like