Replacing ESPresense with Bermuda for BLE tracking

I have played with ESPresense for a fair while, and I found it useful for determining approximately where (i.e. which area) an iBeacon or other device was.

I really like using ESPHome, and the setup of ESPresense is similar in some ways, but focused on BLE device tracking. I had been hoping that ESPresense would eventually be fully integrated into ESPHome, but that has obviously not happened, or is a bit hard.

Bermuda BLE Trilateration” is a new project that could possibly replace my ESPresense setup.

My use case for ESPresense or an alternative

If you haven’t used ESPresense, it takes simple ‘iBeacon’ (or other BLE device) sensing that plain Home Assistant can already do (with Bluetooth devices and Bluetooth Proxys – including ESPHome and Tasmota for example), and gives it the power to figure out some triangulation, by adding a small bit of maths between multiple devices to decide approximately where a device is in relation to multiple ESP32 sensors.

The ESPresense Map creator

Although I don’t use their full ‘triangulation on a map’ feature, they offer this and it could be useful to people to display on a Home Assistant display. ESPresense have a companion app that allows you to crudely draw your layout, place where ESP32 devices are and subsequently show beacons in their approximate location. Impressive, but I have worked with similar commercial projects since the mid 2000s and I know how hard (impossible) it is to accurately show where radio devices are, no matter how many sensor nodes you have. Radio reflects, gets interfered with and blocked by all manner of things and materials (especially, as stated eloquently in the Bermuda documents “hairy sacks of water ie humans etc”)

My main use case is not really trying to triangulate, but just knowing approximately how close an iBeacon is to one or two well placed sensors*. So although it has been useful, some minor drawbacks for me with using ESPresense.

*I’m currently using beacons for simple things like “are my rubbish bins beside the house… or on the road?”. And “which area is each of my vehicles parked? Or are they not home?” and “Is the pool robot in the pool?”

ESPresense drawbacks

  • ESPresense allows some additional sensors, but only a handful, and they are of fixed types. You can’t use an ESPresense node for other things (except for some sensors on their list).
  • It is set up inside the ESPresense web portal, not in YAML like ESPHome. So you must have the web service turned on (unlike ESPHome). This could be a benefit or drawback, but I prefer the text setup and upload of a config file.
  • With the YAML file of ESPHome, you have an easy backup in YAML. I’m not even sure how you backup ESPresense… well except for having the bin file. One of the main reasons I started looking at other ways of doing this was because one of my ESPresense devices died.
  • ESPHome can use MQTT or the HA API, or both. ESPresense only uses MQTT (but does do HA autodiscovery)
  • In ESPresense, you need to type Beacon IDs in a YAML file and/or web interface (could also be noted as a good feature however), but ESPresense does have a good way of detecting beacons visually and helping you determine their IDs.
  • I like the ‘compile as you go’ method that ESPHome uses as it just feels a lot more of an efficient use of a microcontroller. ESPresense is a fixed piece of code, running on a specific set of microcontrollers.
  • The last official release for ESpresense was Jan 2022… (although it still looks to be maintained)

Is Bermuda an adequate replacement?

Bermuda is a pretty new project (announced Oct 2023), so I was interested to see if it could replace ESPresense. Once I started looking into it, I realised that the ideas behind it are so much simpler and setup is so much easier/quicker. So there really is only 2 or 3 setup things I needed to do to get it working.

In their excellent wiki and other documentation, They make no secret of the fact that the project doesn’t do triangulation (or full 3D mapping), and maybe never will. They talk about ‘trilateration’ or more realistically giving distances (in 2D) for devices away from nodes. This is really all I want currently anyway. It is under active development however, and I expect uptake to be quick due to the simplicity of their design, and use of ESPHome devices.

Setting up the hardware

The great thing is that Bermuda can utilise the Bluetooth Proxy features of my existing ESPHome nodes (pretty sure you can use Shelly devices also if that’s your thing). That is all that is needed in the way of hardware. Just ensure that each ESPHome (ESP32) device has bluetooth_proxy: and esp32_ble_tracker: turned on as per the below code.

I don’t have to waste time building more ESP32 devices, just to support location tracking, or if I do build one, I can also add mmWave or other useful sensors.

Note that if you are having issues with your ESP32 booting, when running Bluetooth proxy as well as other components on the ESP32, see the warning on my mmWave ESP32 notes and the solution I used.

# Bluetooth
# Remember that this takes a LOT of processing. On the 
# ESP32, enable the  IDF framework, and disable the 
# Web server component.  Changing to the IDF framework 
# needs to be via cable not OTA to change the
# partition setup.
  active: true #Optionally enables proxying active connections. Defaults to false.

      active: True  #True is the default setting anyway

Lastly, ensure all your ESP32 nodes running Bluetooth have an Area assigned to them. It is this Area that becomes the location when Bluetooth devices are closest to them.

Installing the Bermuda Integration to Home Assistant

Everything else happens in Home Assistant, and you just need to install Bermuda using HACS and a custom repository. Don’t do this if you are scared of using HACS as opposed to official add-ons, but it has never really worried me. Once installed, there are only really a couple of things left to do.

The settings display for the integration (under Home Assistant Settings/Integrations menu). Only two options available, which are Global Settings and Select Devices. “ADD DEVICE” is not something you want to click.

Checking the global settings (optional)

Click the ‘CONFIGURE’ in the settings and choose ‘Global Options’. Familiarise yourselves with these if you like, and change them if you feel the need to. There was little I felt the need to alter, although I did change the default ‘time before a device is reported as away’ and made it a bit shorter, which was per my ESPresense setup.

Adding Devices

By devices, we just mean iBeacons or other BLE things. Bermuda already knows about all the Bluetooth Proxies you have, and therefore the Areas.

BeaconScope Beacon Tracker on Android

Choosing ‘Select Devices’ might be a bit overwhelming if you have a bunch of devices around you. It will show you a drop-down list of every BLE ID it can see. So if you definitely already know the ID of a device you want to use, start tying the MAC and it will appear for you to select. Some devices will have multiple entries, presumably as they broadcast in a couple of different beacon modes (so just choose one, eg ibeacon:)

This is where ESPresense has an advantage, as you can use the web interface to differentiate between different beacons (by moving them close to a node).

But the easier way for me is to use an Android app to get the beacon data. I use the excellent BeaconScope and if I bring a tag near my phone it tells me all the beacon fields needed. Once I know the tag MAC, I can search for it in the Bermuda drop-down list, and it will appear as a Home Assistant Device (with a bunch of useful entities).

You can apparently add iPhones and other apple devices, and the docs will show you how to do this. You can do this with ESPresense too (I I hadn’t needed to). Find the section in the Bermuda docs on using HA and “IRK (resolvable keys) via the Private BLE Device core component

What Next?

So what does it give me? The entities of each iBeacon device tell you the area that it is calculated to be in, and the distance. There is also a home/away (device_tracker entity). These are currently all I need to create my automations.

There are also some pretty history graphs showing you distances and averages over time.

If you look at the hidden entities, it gives you an insight into how it is calculating, with distances from multiple ESP32 nodes, and some raw values. This is pretty much all I need. If they do end up doing some mapping, I may use it, but it won’t be a high priority.

It is literally that simple to set up, and will be great to see what improvements or additions they come up with in future.

Leave a Reply

Your email address will not be published. Required fields are marked *

Post comment