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

I think I get what you mean now, try this yaml:

substitutions:
  name: esphome-web-70681c
  friendly_name: Sam Desk BLE

esphome:
  name: ${name}
  friendly_name: ${friendly_name}
  min_version: 2024.6.0
  name_add_mac_suffix: false
  project:
    name: esphome.web
    version: dev

esp32:
  board: esp32dev
  framework:
    type: esp-idf

# Enable logging
logger:

# Enable Home Assistant API
api:

# Allow Over-The-Air updates
ota:
- platform: esphome

# Allow provisioning Wi-Fi via serial
improv_serial:

wifi:
  ssid: *******
  password: *****

  # Optional manual IP
  manual_ip:
    static_ip: 192.168.**.**
    gateway: 192.168.0.1
    subnet: 255.255.255.0

# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:

dashboard_import:
  package_import_url: github://esphome/firmware/bluetooth-proxy/esp32-generic.yaml@main
  import_full_config: true

# Sets up Bluetooth LE (Only on ESP32) to allow the user
# to provision wifi credentials to the device.
esp32_improv:
  authorizer: none

# To have a "next url" for improv serial
web_server:

esp32_ble_tracker:
  scan_parameters:
    # We currently use the defaults to ensure Bluetooth
    # can co-exist with WiFi In the future we may be able to
    # enable the built-in coexistence logic in ESP-IDF
    active: true

bluetooth_proxy:
  active: true

What did I change?

  • Changed the framework type from arduino to esp-idf, this results in better performance
  • Changed the package_import_url into a valid url
  • Enabled bluetooth_proxy
  • Enabled esp32_ble_tracker

Amazing, thank you so much! I will copy this across and install. Do I need to add any other parts like this one that was suggested within the wiki for example, or this should suffice?

esp32_ble_tracker:
  scan_parameters:
    active: True # Whether to send scan-request packets to devices to gather more info (like devicename)
    interval: 320ms # suggested 211ms # default 320ms
    window:   300ms # suggested 120ms # default 30ms

I suggest starting with the example above, only start ‘tuning’ the interval and window if the resuls are still not satisfactory

Amazing, and where do I put that example? In my yaml? And last question I promise… Do you recommend putting this into my HA config file to prevent database growth and is this all that is needed?

recorder:
  exclude:
    # to completely exclude all Bermuda data from logs, add this domain section. Not
    # recommended, but might be good if you like *big* hammers.
    # domains:
    #   - bermuda
    entity_globs:
      # to filter specific sensors
      - sensor.*_distance_to_aska*
      - sensor.*_distance_to_back*
      # ...etc
      # or filter all the distance-to sensors
      - sensor.*_distance_to_*
      # The area sensors
      - sensor.*_area
      # The distance to closest area sensor
      - sensor.*_distance

Yes, just add the missing parts to your own yaml. Don’t forget to make a backup first!
I would advice against excluding Bermuda data from logs for now, but I think it’s ok to experiment with when everything is working as expected.

thank you for all your help :slight_smile:

1 Like

Interesting - intervals longer than 2s are unusual - on my android companion app the “Advertise Mode” only has three option, 1Hz, 3Hz or 10Hz (named Low Power, Balanced and Low Latency, respectively). Did you have an automation to turn the transmitter on and off at 30s intervals or something along those lines?

Same - and that’s why it’s a planned feature :slight_smile: But my position is that it’s a secondary signal - one that is entirely derived from the others, hence not a critical need for Bermuda when it can be provided by other means. But the difficulty of doing so makes it a worthwhile quality-of-life improvement to make it part of Bermuda.

Huh, well there’s a corner case I hadn’t considered! Is this with esphome devices or Shelly’s?

I don’t know if there’s a way that HA “knows” that a device is no longer a scanner, but if I can find a way to identify that I’ll find a way to remove it from Bermuda’s scanner list. I’ve raised a ticket for it at Account for removing Scanners that exist but are no longer Scanners · Issue #345 · agittins/bermuda · GitHub

Hi Nat, no idea re the watch, sorry, but one thing to check is to go into Bermuda and make sure your “Max Radius” is set to something high, like 70m. If it’s too low (and 10m is too low) then a weak signal from your watch will be ignored if it works out to more than 10m - which is not what you want.

Using IRK means that Bermuda can track based on any advertisement the phone sends, regardless of source. If the only thing your phone ever sends is HA companion app’s iBeacon, then yes, no extra benefit. My pixel 6pro doesn’t seem to send anything much otherwise, but it will depend on what you are running.

Note it’s not scanning or pairing, it’s advertising that we pick up.

Ah, good to know. That means that something must change in how HA presents them, I just have to find out what :slight_smile:

Hmmm that is interesting! I had my doubts, but I might check it out at some point, thanks.

Negative. I had not changed the settings on the companion sensor at all.

Ah I probably misunderstood your comment - i thought you meant you’d configured a 30 second interval, but are you saying you only received the ads at 30s intervals in Bermuda? Or have I got it backwards in multiple ways? :sweat_smile:

1 Like

I only see a ping out of a default config companion on android every 30 seconds.

So I bump the timer on Bermuda to keep the area for 2x that. So it gets the op to ping twice before it drops out of the zone.

Yes it means a 30 second lag before it drops but it keeps the attribute from flapping

ESPHome device that was originally configured for digital input/output functions. I added the BLE config, then reconsidered and removed it. The original functions stayed the same.
All my other ESPHome devices used by Bermuda are dedicated to Bermuda, but this one is not.

1 Like

Hey! So thank you to Rembock for helping me yesterday finalising the config for my ble esp32 proxies. I now have everything setup and its working! I have read through the docs and this forum, its been so helpful! I have 7 proxies scattered around my house and they’re tracking two apple watches and two iphones.

I have also installed the beta version for possible further configuration but before I do I wanted to ask those who will undoubtedly know better, how I should go about this. My only problem is that I notice the phones and watched jumping from sensor to sensor and that is most likely due to them being in relatively close proximity. I’ve seen others comment here on this issue too so I will relook at where they are located first and try to distance them as much as possible. There is one in the lounge area, which is probably about 3 metres from the guest bedroom (seperated by a wall and a house level).

Any further suggestions on how to calibrate the proxies to limit they’re range or what else to do if proxies are say 2-5 metres in seperation?

For reference - here is my current esp32 ble config for each sensor -

substitutions:
  name: esphome-web-704f20
  friendly_name: Bedroom BLE

esphome:
  name: ${name}
  friendly_name: ${friendly_name}
  min_version: 2024.6.0
  name_add_mac_suffix: false
  project:
    name: esphome.web
    version: dev

esp32:
  board: esp32dev
  framework:
    type: esp-idf

# Enable logging
logger:

# Enable Home Assistant API
api:

# Allow Over-The-Air updates
ota:
- platform: esphome

# Allow provisioning Wi-Fi via serial
improv_serial:

wifi:
  ssid: ***
  password: ****

  # Optional manual IP
  manual_ip:
    static_ip: 192.168.50.***
    gateway: 192.168.0.1
    subnet: 255.255.255.0

# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:

dashboard_import:
  package_import_url: github://esphome/firmware/bluetooth-proxy/esp32-generic.yaml@main
  import_full_config: true

# Sets up Bluetooth LE (Only on ESP32) to allow the user
# to provision wifi credentials to the device.
esp32_improv:
  authorizer: none

# To have a "next url" for improv serial
web_server:

esp32_ble_tracker:
  scan_parameters:
    # We currently use the defaults to ensure Bluetooth
    # can co-exist with WiFi In the future we may be able to
    # enable the built-in coexistence logic in ESP-IDF
    active: true

bluetooth_proxy:
  active: true

And I have left all other settings at their recommended default so far within the configuration part of Bermuda.

Hi Guys!

Im trying this out now.

Have a few questions:

1 - Whats the difference between these two sensors?
image
Its quite a huge difference on the measure.

2 - I have a tag wich I dont understand, the variation is very high, sometimes shows 10m and then 1-2m, I dont know if the problem is the tag or the signal, do you also experience this as well?
If not, can you recommend a more precise tag so I can try it.
Thanks!!

I definitely recommend using the window and interval settings that i put in the wiki. The defaults only “listen” for 10% of the time, which is fine for usual Bluetooth stuff but not for Bermuda.

Hi Alexandre, we might need a bit more info to be able to help. The “distance to” sensors are mostly intended for troubleshooting, and may be more variable than the final “distance” sensor. The best way to see what’s going on is probably too use the “history” tool in HA, so you can set it to show a specific time period so we can see how the different sensors react over time.
In “history”, use “+ add device” so you get all the sensors on the same graph.

Also some sensors might come from other integrations like “private ble device” or ibeacon - a screenshot of the whole device page rather than just the sensors would help to know what’s being shown here.

Hopefully with a bit more info we can help you work out what’s going on.

Thanks Ashley! I have done that now. Do you have any recommendations on whether to individually configure the ble proxies settings if I am getting my phone switching to different proxies too frequently due to their physical proximity around the house?

I thought I’d also have a look at this but don’t see where these values are in the Wiki.

1 Like