Getting rid of ESPresence

Having ESPhome with all the bonus modules (Bluetooth proxy, Improv, BLE scanner) is great. But it’s incompatible with HA’s component MQTT_ROOM. There’s a way to get it there.

I have this whole thing mapped out, but I don’t know C++ so maybe someone is interested in helping me make it into a proper module.

The general idea is the following:

  1. Avoid static data.

  2. Every time a phone with HA-mobile-app installed connects to HA, we need to get BLE transmitter’s current UUID and push it to all ESPhome devices.

  3. Every time a ESPhome device connects to HA, it needs to get UUIDs from all available phones. It also needs to get MQTT settings, since MQTT_ROOM is unfortunately MQTT-only, there is no native API (so far? I’m not holding my breath).

  4. When there’s a BLE transmission,

2.1. which has both UUID,

2.2. and RSSI (not always the case),

  1. ESPhome scans the local database of UUIDS, and,

2.4 if it’s a known device,

2.5. converts RSSI into something (not bothering with distance calculation, 0-35-RSSI works just fine)

2.6. sends the data structure to MQTT_ROOM

I have two half-baked prototypes, one has some form of array management (which I don’t understand), the other one has UUID as constants, compiled in.

Anyone interested in making this into a drop-in ESPhome module? (HA part is separate, obviously)

1 Like

Ya… Have fun with that. People have been making attempts to make a good BT presense system with esp boards for YEARS. You ever wonder why multiple BT presense projects were made and dont use Esphome or no one has attempted it on any serious level? The Esphome BT integrations aren’t all that great and need improvements.

What was the problem with Espresense that you think someone needs to reinvent the wheel? Instead of starting from scratch, why not build off off Espresense or one of the many other BT options available on Git?

Ideally you want your BT base stations to be only that. BT tasks are resource intensive on the esp32 and you really shouldn’t be making them into “projects” with a bunch of extra components and it kind of defeats any argument for an esphome BT presense integration.

The bonus would be to add Proxy, Improv, and BLE scanner?
It already does BT scanning. Improv? why? You need to configure the wifi over BT? It already has an access point that serves the same purpose and you can access it from the same devices that you would use to connect via BT Improv so, i’m not sure how that one is a bonus. Lastly, BT Proxy is the only half-way bonus I guess. Esp32’s are cheap. Put the proxy on a different esp32, problem solved.

First off, it works perfectly in my home. I have 8 radars (ld2420) driven by M5stack-atom-lite boxes, so there’s already an ESP32 in (almost) every room. They all serve as BT proxies, obviously. Why not use them for BLE presence as well?

So - what reliability issues are referring to? HA knows perfectly well in which room my phone is. It’s been battle-tested for many weeks, absolutely no issues.

The only drawback of my current solution is that I had to hard-code UUIDs, and I don’t like the idea. Ideally, I’d like to rotate UUIDs and that’s a no-go with hard-coded strings.

1 Like

OK? I’m not sure what ld2420’s have to do with anything but, cool. Congrats! “They all serve as BT Proxies, obviously”? Obviously? Why is that obvious? A proxie is just one of many things you can use an esp32 for so no, it wasn’t obvious to me.

8 proxies? one in each room? You didn’t bother to do any testing first did you? Unless you have a 20,000sq/ft home with metal walls you dont need one in each room. There’s a good case to make that you’re causing so much RF interference, you’re BT network is worse with 8 than it would be with 4.

You know you don’t need to make every single esp32 a BT proxie and good reasons not to do it too.

I really don’t have any reliability issues with Espresense but, I do have irritations with the configurations sometimes. I tweak the max dist. and absorption so I don’t have huge gaps in each room zone but, also not overlapping to much where a BT beacon constantly bounces back and forth. The BT zones seem to still pick up devices from the next room or not at all. It’s considerably better than any other BT presense i’ve tried though. It’s what made me scratch my head about your post. It’s not perfect but, its by far the best i’ve used.

This is another one i’ve been playing with. It’s a BT iBeacon tracker that you can use with esphome. I havn’t tried and cant verify if or how well they work with any phones. I was only using this one because I couldnt request battery level or any sensor data from BT beacons in Espresense but, I can with this.


Exactly what interference with passive BT proxies are you referring to? All they do is listen. I don’t have BT devices that need to be talked to.

Also, I do not need distance info, at all. It’s crap anyway. Comparing RSSI to each other works fine. All I need to know is that a given phone is closest to this ESP32 device. That’s what my current method does perfectly well.

P.S. Also, I wasn’t looking for advice how to fix ESPresence. I have what I need. I was just looking for a way to make it more accessible to others.

oh, well good thing you have 8 proxies lol. Let me guess… you’ve got those goofy BT temp/humidity sensors all over? So, you’ve made what? RSSI sensors? like the example ones in the docs?

I wasn’t giving advice on how to fix espresense, obviously. I said why don’t you use espresense or any of the other Open Source BT presense software already available and change it to suit your needs, rather than reinventing the wheel and starting from scratch. Try to pay attention.

You have what you need and are just doing charity work and going around sharing it? Sounded like you were soliciting someone to write some code for you and your “half baked prototypes you dont understand” You don’t have to lie to me bud. I was just trying to help you from doing a bunch of extra work writing code that’s already available to the public.

Might want to check out this project. Your ideas is very similar, you might be able to help out.

1 Like

This is just what the doctor ordered! Thank you very much!