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

Wow, those dogs are well-trained. Nice work on the HA system and also the dogs! :dog2: :dog:

1 Like

I am totally stoked to hear how it’s useful to you, that’s awesome! I also love the cards you have set up, they look amazing!

Release v0.6.5

This release fixes the nasty bug from v0.6.4 detailed in #185

Big thanks to @sdholden28, @terryhonn and @tbrasser for their contributions in narrowing down the fault, and again to @skrashevich for some more safety checks :+1:t3:

Changes

  • :warning: fix: Resolve infinite loop on config reload in 2024.5 @agittins (#189)
  • :safety_pin: fix(bermuda): Improved condition checks and handling of MAC addresses @skrashevich (#186)
  • :books: chore (docs): Refactoring docs over to wiki @agittins (#187)
  • :books: chore (docs): Fix link to FAQ from readme @agittins (#188)

Update via HACS recommended, full release info here

1 Like

Hello can you tell me exactly which model of Blue Charm Beacons you have?

I have the “BC04P-MultiBeacon”, one for each dog. I used rivets to attach them to their collar. One dog is 90 lbs, one 10lbs. For the small dog, i thought the physical size was maybe too big when I put it on, but she doesn’t mind. They’ve been wearing them since 1st of April now. I bought them on Amazon.

Blue Charm Beacons - Long Range Phy (300m) Water-Resistant BLE iBeacon (BC04P-MultiBeacon) - w/Adjustable Motion Sensor https://a.co/d/0y1T2ek

1 Like

perfect thanks for the information.

Do you also have the problem that if you restart HA and the dogs are not at home at that moment, the status in Bermuda is set to unknown? And then as soon as the trackers are back in range the status is not updated, but the Bermuda integration has to be restarted first?

I haven’t seen that particular behavior. I have a large back yard and if the dogs are outside and far enough from the house, distance and “last seen proxy” go unknown, as expected, and the device_tracker for each dog goes to away. As soon as they are back in range of a scanner then all values are updated and their location changes. I don’t have to restart Bermuda or anything like that.

Did you see my reply to you the other day at
Bermuda - Bluetooth/BLE Room Presence and tracking [custom integration] - #94 by agittins ?

If you’re able to provide some more info we’ll be able to work out what’s going on, because it doesn’t seem to be the way it normally works (but does sound like a known issue with the built-in iBeacon integration).

Here is my running config.
I use 3 G-tags these are marked in red below. On the pictures you can see the normal state, they are recognized and state is set to present.

As soon as I am out of range, the state changes to away, which is also correct.

However, if I restart Home assistant while I am away, the status changes to not aviable and when I am back in range the state remains not aviable until I manually restart Bermude integration again

1 Like

I haven’t seen that, but I probably haven’t restarted HA while sensors were unknown. It sounds like in your case, Bermuda, and/or your bluetooth proxies, whatever they are, isn’t/aren’t loading properly when home assistant is restarted. You should be able to find integration startup errors in home assistant logs on reboot. That might shed some light on what you’re experiencing and where its coming from.

I am looking into BLE tracking, have 10 esp32c3 to deply. I am wondering whether espresense is a better option or this project.

Being the creator of Bermuda, I am obviously biased, but some of the main reasons I created it was that I didn’t want to dedicate esp32 units to just espresense, I wanted them to be full esphome nodes that can do whatever stuff esphome can do, PLUS act as a bluetooth location sensor. That way I get proxying for bluetooth connections, temp/humidity sensors, motion sensor etc support, all native to HA, not requiring support outside of esphome or needing mqtt gateways etc (I know espresense can do some of that, but not all, and not HA-native). It also means we can use things like shelly devices as well.

Having the proxies send advertising data directly back to HA also means all calculations can be done centrally, and updates to the algo only requires updating the integration, not re-flashing the nodes (I don’t know how centralised espresense is, it’s quite possible all its tracking stuff is centralised, too).

I think espresence is more advanced currently with its room-based detection, in that it doesn’t need a proxy in each room, and you can define room boundaries that are not just a radius around a proxy. This is “trilateration” and it’s something that Bermuda should have “quite soon” :tm: but does not yet. If that’s an important criteria from day-one then you will find espresense more capable at least on that front, as far as I know (I have actually never used it, so my assessment is only from initial investigations), and for now.

I know some other folk here have tried both and I would encourage them to give their honest assessments, hopefully they can help you make a choice. I think Bermuda is probably a smoother integration with HA, but espresense might still have the edge in being able to define areas beyond “which receiver is it closest to”, which is where Bermuda is currently at.

You can check the progress of Bermuda’s full trilateration support at Implement trilateration of devices · Issue #21 · agittins/bermuda · GitHub

Edit to add: I think the c3 variants of esp32 are a little different, in having only a single cpu core. I know that people have had success doing bluetooth proxy on them, but you might need to find the right settings to make them work. You’ll also need to check that espresense also works on the c3, I haven’t looked into that.
Digiblur config for esp32-c3 bluetooth proxy
Workaround for c3 boards that lose wifi when bluetooth enabled (this might be handy for other boards too, actually - it just disables the BLE scanning while the device reconnects to wifi and/or HA).

2 Likes

You do not give enough emphasis to the fact that Bermuda is compatible with any BLE Proxy by design. For those who have Shelly everywhere (even if we cannot chose the position of the Device) combined with esp32, Bermuda is working great.
I totally buy your approach, and I think it will be the winning one for a core integration.

2 Likes

That’s a good point, and something I didn’t expect was how many people who had already deployed Shelly switches etc essentially got bluetooth location tracking ~for free~ just by enabling it on their switches and deploying Bermuda on to their HA instance!

2 Likes

I love this integration :slight_smile: Before I switched to Home assistant, I was using iobroker, which had a similar integration called Radar

1 Like

Trying to test this out on a XIAO/SEEDSTUDIO ESP32-C3. Cant seem to get it to work reliably. Device (Ibeacon on my android) goes unknown while its sitting next to the ESP.

Tried the ESP guide on the wiki AND the wifi workaround.

Anyone using a seedstudio esp32-c3 ?

ESPHOME does not loose the tracker

INFO ESPHome 2024.3.1
INFO Reading configuration /config/esphome/esphome-web-8589ec.yaml…
INFO Starting log output from 192.168.1.49 using esphome API
INFO Successfully connected to esp32c3-husnainoffice @ 192.168.1.49 in 0.145s
INFO Successful handshake with esp32c3-husnainoffice @ 192.168.1.49 in 0.101s
[16:55:56][I][app:102]: ESPHome version 2024.3.1 compiled on May 16 2024, 15:39:13
[16:55:56][C][wifi:580]: WiFi:
[16:55:56][C][wifi:408]: Local MAC: 64:E8:33:85:89:EC
[16:55:56][C][wifi:413]: SSID: [redacted]
[16:55:56][C][wifi:416]: IP Address: 192.168.1.49
[16:55:56][C][wifi:420]: BSSID: [redacted]
[16:55:56][C][wifi:421]: Hostname: ‘esp32c3-husnainoffice’
[16:55:56][C][wifi:423]: Signal strength: -49 dB ▂▄▆█
[16:55:56][C][wifi:427]: Channel: 9
[16:55:56][C][wifi:428]: Subnet: 255.255.252.0
[16:55:56][C][wifi:429]: Gateway: 192.168.1.1
[16:55:56][C][wifi:430]: DNS1: 202.142.142.142
[16:55:56][C][wifi:431]: DNS2: 202.142.142.242
[16:55:56][C][logger:166]: Logger:
[16:55:56][C][logger:167]: Level: DEBUG
[16:55:56][C][logger:169]: Log Baud Rate: 115200
[16:55:56][C][logger:170]: Hardware UART: USB_SERIAL_JTAG
[16:55:56][C][safe_mode.button:022]: Safe Mode Button ‘esp32c3-husnainoffice (Safe Mode)’
[16:55:56][C][safe_mode.button:022]: Icon: ‘mdi:restart-alert’
[16:55:56][C][bluetooth_proxy:088]: Bluetooth Proxy:
[16:55:56][C][bluetooth_proxy:089]: Active: YES
[16:55:56][C][esp32_ble:374]: ESP32 BLE:
[16:55:56][C][esp32_ble:376]: MAC address: 64:E8:33:85:89:EE
[16:55:56][C][esp32_ble:377]: IO Capability: none
[16:55:56][C][esp32_ble_tracker:645]: BLE Tracker:
[16:55:56][C][esp32_ble_tracker:646]: Scan Duration: 300 s
[16:55:56][C][esp32_ble_tracker:647]: Scan Interval: 320.0 ms
[16:55:56][C][esp32_ble_tracker:648]: Scan Window: 30.0 ms
[16:55:56][C][esp32_ble_tracker:649]: Scan Type: ACTIVE
[16:55:56][C][esp32_ble_tracker:650]: Continuous Scanning: True
[16:55:56][C][mdns:115]: mDNS:
[16:55:56][C][mdns:116]: Hostname: esp32c3-husnainoffice
[16:55:57][C][ota:096]: Over-The-Air Updates:
[16:55:57][C][ota:097]: Address: esp32c3-husnainoffice.local:3232
[16:55:57][C][ota:100]: Using Password.
[16:55:57][C][ota:103]: OTA version: 2.
[16:55:57][C][api:139]: API Server:
[16:55:57][C][api:140]: Address: esp32c3-husnainoffice.local:6053
[16:55:57][C][api:142]: Using noise encryption: YES

Just to add, Have a shelly PM Plus upstairs which is working just fine. Its this ESP32C3 that is being buggy. Have 10 of these to use potentially.

PS they work fine with espresense so not broken

Good to know the shelly is working, that helps narrow things down.

Can you share the yaml you’re flashing the c3 with?

When your ibeacon shows as unavailable, does it stay that way, or does it come back again after a time?

(by the way, I am starting to set up the wiki on Bermuda with setup instructions etc, the wiki and workaround instructions are now included at ESPHome Configurations · agittins/bermuda Wiki · GitHub )

v0.6.6 - Better device selection and Fewer crashes!

This release features:

  • :rotating_light: Hopefully fewer crashes :-/ Since 2024.5 we’ve seen a lot more thread/async related issues like all of HA bogging down or locking up. This has been tricky to fault-find because it only shows up on some systems, and seemingly rarely on mine. This release includes two fixes that will hopefully eliminate (or at least reduce) these instances.
  • Device selection in configuration now uses Bermuda’s own full list of devices, instead of just the recent devices from the bluetooth backend. Hopefully this will solve some issues people have had finding their devices, or maybe it won’t. Note that PrivateBLE devices are not chosen per se, they will always be configured. The list now also indicates if a device is using a so-called “Random MAC” as a warning that tracking that particular MAC address may be futile. The list is also sorted with iBecons first, then static addresses, then random addresses.
  • Config flow (more accurately the options flow, via the configure button(!)) is now set up with sub-menus, because soon we will have too many options to fit on one page :slight_smile:

Changes

Full release notes at Release v0.6.6 - Better device selection and Fewer crashes! · agittins/bermuda · GitHub, update via HACS is recommended.

1 Like

OK, let’s start with what I need … then what I have done … then what is next?

I have a very large property. My dogs sometimes wander 1/2+ mile from the home/winery to the gate. This is especially true if they cannot find us (greatest presence detection ever). The home/winery has a Home Assistant installation (HA Core on Linux), Nabu Casa, connects to internet via Starlink.

The gate is 1/2+ away as i said, down the mountain. It also has a home assistant installation (HA Green) and another Naba Casa account for it. It is connected to internet via 4g/5g as that or DSL is the only choice.

Now, I bought some nice ESP Amazon boards with bluetooth and flashed one through ESPHOME website for bluetooth_proxy. Because the gate is remote, I just have it plugged in here at the house for now.

All is well.

I have several iTAG cheap bluetooth disks that can be attached to the dog collar.
I did the Bermuda install and can see the iTAGs and added them: One is like this:

image

Now what do I want. I will put in the ESPHOME at the gate, the dogs always take the driveway down. So I assume that if they enter and are picked up by the tracker at the gate, I can use a change in state to trigger messages to phones. (I know how to do that). What will the state change to in this instance (sans testing, I can do it but …)

Would it go from Home (at house/winery) to unknown while they wander … then go to Home (at gate) if they come to the gate? If so I can work with that. Or better said, they would be either these three …

Winery → Unknown
Gate → Home
*** They are at the gate ***

Winery → Home
Gate → Unknown
*** They are at the winery***

WInery → Unknown
Gate → Unknown
*** They are wandering around and possibly in between ***

Winery → Home
Gate → Home
*** Call the police, they cut the dog tag in half! ***

Ideas? Thoughts?