Bermuda - Bluetooth/BLE Room Presence and tracking [custom integration]

Thanks, nice addition!

I probably need some more fiddling, since it switches rooms every few seconds.

1 Like

I’ve just added a FAQ for that: FAQ - My device switches between areas every few seconds

In short, you might have better luck moving your proxies so that they are further apart (so that the differences in distance might better outweigh the differences caused by reflections or bodily absorption - wow, that sounds nastier than it should), or you could add more proxies to an area, which increases the chances that a proxy in the room you’re actually in will get the strongest signal.

Trilateration will improve this heaps, I expect, but it’s not quite here yet.

Feel free to post screenshots of what you’re seeing, I find that going to the history page from the left menu, then adding everything from the device with the +device button can be really helpful in seeing what’s going on.

1 Like

Thanks for some more information!

I got some Shelly devices in the wall so that is hard to relocate though :wink:
I already moved some proxies around, but quite some times it sees a device further away as the location.

An example I’m in my workroom now, got a Shelly 2 meters away from me in the wall, but it jumps to an esp32 4 meters away through a thin concrete wall or the shelly in the attic, a thick concrete ceiling.

Or when I sit downstairs, I got 4 meters in front of me my TV with a Shelly plug and 2,5 meters to the right an esp32, it just sometimes sees the Shelly from my workroom through quite a thick concrete ceiling with floor heating, which is I guess 4 meters away.

v0.6.7 - Fix for HA 2024.6.0 lockup adding devices

Significant change here is avoiding a race condition exposed by HA 2024.6.0 (from beta6). This was seen when adding a configured device to Bermuda, the dialog would hang spinning waiting for the config flow to apply, and the HA server would loop infinitely restarting Bermuda. Huge thanks to @andreasbrett for raising the issue before the HA release and submitting a comprehensive bug report - much appreciated!

This release also includes the current MAC address for any iBeacons being selected in the Configure Devices config flow. This should make it easier to find and identify devices while setting things up.

Changes

  • Fix!: race condition in 2024.6.0b6 @agittins (#211)
  • feat: Add MAC address to iBeacon listings in configure
  • fix: Don’t restore scanner options from saved device
    • We store the options struct along with the cached scanner entries in entry.data. Prevent restoring it, since it overwrites
      newer options set by config. Only affects display of data in the dump_devices service, but might become important if we
      operate using those values later.
  • fix: Ignore disabled PrivateBLE devices

Full details at Github Releases, upgrade by HACS highly recommended.
Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.

1 Like

That’s What I Found! I give a star to this project on git. thank u very much :slight_smile:

1 Like

Does anyone have recommended ibeacons? I bought a nutale beacon thinking that would work, but I have not had much luck it doesn’t show up as an ibeacon and it keeps disappearing from my scans. Phone tracking has worked wonderful though. thank you so much.

I’ve had great success with Blue Charm Beacons. Bluecharmbeacons.com

I have purchased a few of these for about $9 each and they work well. Do show up as ibeacons, at least in ESPresence.
https://www.amazon.com/gp/product/B0CM37R18Z/

You might need to configure the beacon itself, perhaps? Their FAQ states they support the iBeacon protocol, so it should:tm: work.

What might help is to take a look at what exactly the device is broadcasting. The app NRFConnect (at least on Android) is super handy for that. Feel free to post a screenshot of what you see in there if it might be helpful for us to work out what’s going on.

Also it’s worth bearing in mind that Bermuda doesn’t need them to be actual iBeacons - it is able to track any device that is sending BLE advertisements - so it may not show up as an iBeacon but it can still track it.

Oh another thing - if you have an app that connects to the device, that might be the problem. Most devices stop advertising once they are engaged in an active connection. You might find that once you disconnect from it you’ll start seeing the adverts again in Bermuda. My watch, for example (a Pinetime, running InfiniTime) does this, so I don’t have the companion app connected to it, since I want it to continue advertising at all times for tracking.

I recognize this is designed for use with ESPHome. Is there any way to configure it so a Raspberry Pi Zero 2 W could also be used as a base station in Bermuda? I’m planning to build a Wyoming voice satellite off that hardware, and I’d love to use the same device for room presence sensing if at all possible.

I know Room Assistant exists, but I’m anticipating using ESP32s in other parts of the house, and would love to keep it all together under one one integration if possible.

Bermuda should work with a Raspberry Pi as long as bluetooth is configured on it. My Home Assistant RPi4 is reporting into Bermuda as well along with my ESPHome devices.

I don’t know of anything “off the shelf” that would make that work for you, but it would certainly be possible if someone decided to implement it.

You’d need something running on the Pi that captured the BLE advertisements, and sent it to “something” on your HA server.

On the HA server, you’d need an integration that received that data, and inserted it into HA like it was a bluetooth scanner (the shelly and esphome components have async_connect_scanner methods that might lend insight if trying to implement this).

That said, an esp32 board will cost a lot less than the effort required to implement a solution for a PiZeroW, depending on how (or if) you value your time. The discovery can be its own reward though, of course!

Another caveat is that you’d want to ensure you get timely updates on advertisements. For example the BlueZ stack that HA uses for local bluetooth adaptors does not give timestamps on the most recent adverts, so it can be less useful for Bermuda’s calculations since we don’t always know how stale the data is.

@tykeal I think Spencer is talking about using the Pi Zero 2 W (a much smaller device than say a Pi 4) as a remote proxy, not about running HA on it, which I think might be where you’re coming from.

I was thinking the blutooth proxy module. I honestly haven’t used a Pi Zero myself, but I thought they could work as a blutooth proxy.

I was thinking the blutooth proxy module. I honestly haven’t used a Pi Zero myself, but I thought they could work as a blutooth proxy.

What’s the bluetooth proxy module? Are you referring to the bluetooth_proxy component in esphome? I don’t know if esphome can be run on a pi z2w, perhaps the “Host” platform would work but that’s a lot of maybe’s. I might be missing what you’re referring to.

I’m probably not thinking about the correct things right now. I was thinking of the bluetooth_proxy I thought there was something similar for the Pi Zero

Do we have a good config for ESP32 C3 yet ?

I have several switchbot mini plugs that are c3. I am using configs from SwitchBot 15Amp W1901400 ESP32 Plug | digiblurDIY i imagine you could just steal the esp32, api, esp32_ble_tracker and bluetooth_proxy sections and you will be golden.

Awesome Integration - Thank you! I did not have the time to read the whole thread. I guess the question was already raised before.

How can i easily try to identify the BLE Mac from a Tag? It is a cheap one but it is also connected to Apple FindMy App so i hope it is possible to use the Tag as tracker

I’m trying to use BT/BLE, I started recently and would like some help.
I put the configuration below on 3 esp32 boards, 1 for testing and the others where I use other sensors:

bluetooth_proxy:
  active: True

esp32_ble_tracker:
  scan_parameters:
    interval: 1100ms
    window: 1100ms

While I wait for some BLE devices to arrive, I enabled the Monitor Beacon (I don’t think it’s necessary) and BLE Transmitter sensors in the companion app on my android.

I installed and configured Bermudas and added the BLE Transmitter UUID.

The problem is that sometimes all Bermudas sensors become unavailable, I believe this is happening after restarting the HA so I have to reload the integration manually.

Before reload the integration:

[10:38:47][D][esp32.preferences:114]: Saving 1 preferences to flash...
[10:38:47][D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[10:42:48][D][esp32_ble_tracker:270]: Starting scan...
[10:47:48][D][esp32_ble_tracker:270]: Starting scan...
[10:48:59][W][component:237]: Component esp32_ble_tracker took a long time for an operation (53 ms).
[10:48:59][W][component:238]: Components should block for at most 30 ms.
[10:52:48][D][esp32_ble_tracker:270]: Starting scan...
[10:57:48][D][esp32_ble_tracker:270]: Starting scan...

After reload the integration:

What am I doing wrong?

Your interval and window settings are wrong, unless your esp32 has an ethernet connection.

This is causing the esp32 to crash or lose wifi connection, as it doesn’t leave any time for the radio to service other tasks.

Good settings are documented in the wiki, that should get you up and running: ESPHome Configurations · agittins/bermuda Wiki · GitHub