Presence detection with esp32

Hi,

I’m trying to build a device tracker with an esp32 module. The idea is that the esp32 will be at my home, and detect when certain mobile phones come within range of the bluetooth scanner. I have tried the following config using ESP Home, on a Wemos D1 Mini Esp32:

esp32_ble_tracker:
scan_interval: 300s

binary_sensor:

  • platform: esp32_ble_tracker
    mac_address:
    name: “Phone tracker 01”

When I run the esp32 I can see it scans a lot of mac addresses, but it doesn’t find the mac of the phone. And so the binary sensor is always “off”.

Any idea what I’m doing wrong?

I’m a bit of a noob, so bear with me.

1 Like

I think phones are not BLE discoverable untill you put it into this mode. Security restraint.

I’m currently doing this with: ESP32 based BLE tracking for mqtt_room. I’m using it with beacon simulator on our android phones to simulate iBeacons. It works really well so far, been running this setup for a few days. I was using beacon simulator with Happy Bubbles before, but those are no longer in production.

1 Like

See thr following links for BLE detection using Rpi. I realize you want to use an ESP32, but there is good experience there that you can lever. I use it and it works well.

https://www.google.com/url?sa=t&source=web&rct=j&url=https://community.home-assistant.io/t/monitor-reliable-multi-user-distributed-bluetooth-occupancy-presence-detection/68505%3Fpage%3D32&ved=2ahUKEwj64OPJ7cviAhW1Mn0KHXtlA1IQFjABegQIBBAB&usg=AOvVaw1U-Aef_ykLv2-aT_RTrsh5&cshid=1559514924689

and

https://www.google.com/url?sa=t&source=web&rct=j&url=https://community.home-assistant.io/t/monitor-reliable-multi-user-distributed-bluetooth-occupancy-presence-detection/68505&ved=2ahUKEwj64OPJ7cviAhW1Mn0KHXtlA1IQFjAAegQIAxAB&usg=AOvVaw1-OB2i86KX4jtNQtLvDvkq&cshid=1559514924689

Sounds really cool. I’ll check it out ASAP.

Hi @mayker, still using beacon simulator? If so, could You please share experiences? How about range, credibility, battery draining?

Very sorry for the late reply. Recent versions of Beacon Simulator don’t work very well. I’ve switched over to BeaconScope and find it much more reliable. Rarely, if ever, do I need to reopen the app. It does not reopen after restart or toggling bluetooth, like Beacon Simulator used to. Those features no longer work in beacon simulator anyhow. No noticeable drain on battery and have no issues with range (transmit power is configurable), though I live in a row house so I’m never that far from the ESPs.

I’m trying to get ESPHome ble detection set up using beacon scope, but I’m having trouble distinguishing which MAC address belongs to my beacon. Do you know a way to determine which MAC address I should be using other than removing all my electronics except the phone?

Are you talking about using the Bluetooth Low Energy Tracker Hub with ESPHome? I’m not familiar with ESPHome myself. This thread is mainly talking about using this method: ESP32 based BLE tracking for mqtt_room. Which is completely different.

After a quick look at the ESPHome page I linked above, it looks like they are using BLE scanning for devices (which isn’t the most reliable, depending on your device), but that also means that it wouldn’t require any software like Beacon Scope or anything else running on your phone. It’s not looking for beacons, it’s looking for the MAC address from the device itself.

That page even has a link to this page to help you find that information.

Hi, Jan!
i’m looking into the same solution, did you ever get it to work and if so, are u happy with it ?