ESP-32-BLE-Scanner a room presence detection solution

Hello everyone. Today I want to welcome you all to my first project for Home Assistant. This project is basicly a room presence detector for ESP32 devices. It reports the state of known BLE Beacon devices over MQTT to Home Assistant. See the project on github. I am using it to detect my phone and trigger automations based on my presence. All you need on your phone is the home assistant app. Check the install instructions on how to set everything up. There are still features missing, bugs will appear and things can be improved. Anyway I wanted to share it with you cause it is already useable.

There are other projects like this outside which are running on a raspberry pi or aren’t working anymore or lacking of features I would like to have so I decided to write my own and give a little bit back to the HA community.

Feel free to tell me your input about it. Features you would like to see etc. Please report errors in github so I can keep track :slight_smile: This is my first project. I am programming in my free time during my 9 to 5 job and I am not a professional programmer. I will try to support and fix errors as good and as fast as I can.


  • Web UI to set everything up
  • MQTT Client to report state to Home Assistant
  • BLE Beacon Scanner for 3 different devices (more to come in the future)
  • Works fine with Android Home Assistant App
  • Easy Integration into Home Assistant
  • Raw distance calculation


  • provide bin for making first flash easier via ESP flash tool
  • Improve MQTT
  • Make update via Web ui possible(binary upload)
  • better distance calculation
  • more network settings (fixed ip etc.)
  • add bluetooth scanner settings
  • add support for more bluetooth devices like smartwatches etc.
  • add support for more devices being saved

Project pictures:


Ability to configure BLE scan frequency dynamically? For example in the middle of the night, when everyone is sleeping, maybe a longer scan internal would still be fine.

Also is there any photo of your build?

BTW does this thing scans iPhone reliably? What do you need to do to make your phone a beacon? Is there any special app required on the phone, like room assistant would? Do we have to pair in advance? Would this track tiles?

Edit: typo time => night

Scanning frequency could be a thing for the future but why is this needed?

Pictures from the web interface are in the thread and on github.

I didn’t check it with Iphones since I dont have one for testing. I will get one for testing in the next weeks so this should be fine. For android you only need the official home assistant app. Thats all. Check the install instructions on github for that. :slight_smile: I will later provide a schematic on how everything works together.

I am trying to use esp32 with just ESPHome just to get started. Problem that I have is that HA app on Android is not sending UUID. I can see the device (Samsung), it’s random MAC address and RSSI. Nothing in the service UUID info

I dont know about ESPHome but check my install instructions on github for creating the UUID.

Hello again.

I created a bin file you can flash easy with ESP32 Download Tool. Check Github Install Instructions for more detailed install instruction.

I have an error message: “Error publishing MQTT Message”
And I can not see a change of the sensor in HA

I’m having trouble with the MQTT connection as well.
I have tested it with a MQTT client on my pc and it works fine, but it looks like the ESP can’t publish any MQTT message.

Hello, I was on holiday. Iam back now and I found a bug which prevents to connect to the MQTT server in some cases. Its already fixed with some other bugs and I will upload a new version in the next days. :grinning:Unfortunately no new features so far since I had to deal a lot with discovering and fixing them. :frowning:

Very interesting
Thanks a lot


I tried flashing my ESP32-Devkitv1 but i get an error.
From terminal i get:

DeserializeJson() failed:
Guru Meditation Error: Core 1 panic’ed (LoadProhibited). Exception was unhandled.

Some debugging lead me to the file main.cpp line 391.
I did not change anything to the settings.json.

Please advice in how to resolve.

hello everyone.

I ran into some WIFI and MQTT issues myself when using the software Matthias wrote. I decided to fork his repo and try to fix those issues while also refactoring his excellent work so I could better understand it. I think I succeeded in both :smiley:

My fork is by no means meant to take over his project, as I have no immediate needs/plans for further development. I just thought I’d share it here for someone who might be interested.

You can find it here ESP-32-BLE-Scanner Fork


Hello everyone.

I have an esp32 running with ESPHome but I am having trouble to make the connection to my iphone because apple devices changes MAC address every 30 min.

Any ideia how can I make presence detetion work with an iphone or apple watch?