The dream of every Home Assistant tinkerer is to be able to use low-cost Bluetooth/BLE capable ESP32 boards to track presence on a room by room basis. Just imagine if you could turn a ~US$3 board in to a node that tracks your smartwatch's or phone's location within a couple of meters and adjusts the environment accordingly. We now have a new project striving to achieve this goal: ESPresense. But can it fulfil its promise?
Besides using BLE and Bluetooth, there are many ways of detecting presence on a room level, but just about every option has its limitations:
- Motion sensors can't pick up subtle movements when you are sitting on the couch for longer periods. The same applies to microwave presence sensors.
- Door/window sensors require you to remember which doors to leave open.
- The Grid-EYE (AMG8833) and Omron D6T that room-assistant supports are costly.
- Tracking bathroom presence using humidity sensors will always have a delay.
Table of Contents
- What's new in ESPresense?
- What is needed to get started with ESPresense
- How to install ESPresense
- Tracking Android and iOS devices with ESPresense
- Limitations of BLE tracking with ESPresense
What's new in ESPresense?
In the title, I called ESPresense the successor to ESP32-mqtt-room. As a writer, I sometimes take liberties, and this was one of those occasions. As far as I know, ESP32-mqtt-room is still alive and (kind of) well, but it has been lacking updates in more recent times. The last feature update was released over a year ago, when it added support for the HTU21D sensor.
So, what is ESPresense? I would call it the spiritual successor to ESP32-mqtt-room, but in fact, it is a fork/rewrite of it. It adds some desperately needed features for those hoping to use ESP32 boards to track presence:
- ESPresense uses a fingerprint instead of a MAC addresses. This allows it to track devices that randomize their MAC address, such as the Apple Watch, iPhone, and iPad.
- It has built-in support for the popular Tile trackers.
- A three value media filter with a Kalman filter on top filters the RSSI (Received Signal Strength Indicator).
- ESPresense is fully multithreaded and uses constant BLE scanning.
- An additional AppDaemon app will post-process MQTT topics into IPS (Indoor Positioning System) topics (x, y, and z) and (latitude, longitude, and elevation).
- ESPresense supports OTA auto-updates. You are not required to manually update each node, saving you a lot of time.
What is needed to get started with ESPresense
You will only need two components to start tracking presence on a room level with ESPresense: A sender or beacon and a receiver. The receiver is always going to be an ESP32 board, which you can pick up for ~US$3 from AliExpress.
If you want something fancier, ESPresense can be installed on M5Sticks , which will show devices that are nearby on their screen. Another advantage the M5Stick has is that you don't need to 3D-print a case for it.
The second component you almost certainly already have on you. A beacon or sender is anything that will broadcast via BLE. Your iOS or Android device will fulfil that purpose, but you could also use a tracker such as those from Tile or Chipolo.
If you are seeking a cheap option, BLE trackers can also be bought from AliExpress, a quick search for iBeacon or Eddystone will present you with many options. Some, but not all, fitness trackers will also function in this way. The ESPresense website confirms that the Mi Band 2 does work, however, from personal experience, I can confirm that Garmin watches will not.
How to install ESPresense
ESPresense uses the ESP Web Tools to install itself on to an ESP32 board. All you need to install the firmware is a compatible browser (Chrome) and a USB cable. Once you have connected the ESP32 to your computer, open the installation page and press the installation button.
Tracking Android and iOS devices with ESPresense
The easiest way of tracking Android devices is by using the Home Assistant companion app. In the app's settings, under sensors, you can enable the BLE transmitter, which allows ESPresense to track it. Keep in mind that this option will consume some of your battery. ESPresense tracks iPhones and Apple Watches using their fingerprint.
The ESPresense details how to configure Home Assistant. As I currently don't have any spare ESP32 devices, I haven't been able to set it up myself and will refer you to that guide.
Limitations of BLE tracking with ESPresense
Unfortunately, and just like every other presence sensor, ESPresense isn't perfect. However, most of the limitations aren't its fault. For example, many Android vendors have very aggressive background limitations, which could stop your smartphone from broadcasting. The worst offenders are Samsung and OnePlus. As an owner of a OnePlus 6, I can confirm this behaviour.
The second limitation is one I already mentioned. Not all devices that use BLE will also broadcast. I have my Garmin sports watch on my wrist almost every day and night. It would be the best device for presence detection on a room level. Unfortunately, Garmin won't allow me to do this.