Project: ESPHome Bluetooth proxies plus iBeacon room presence in Home Assistant

Discuss Bluetooth Devices and technology such as Beacons
Post Reply
User avatar
ZerOne
Site Admin
Posts: 216
Joined: Sun Dec 13, 2020 8:21 am

Goal

Build a few cheap ESP32 Bluetooth proxies to extend Home Assistant's BLE reach, then use an iBeacon tag for rough room-level presence. I have not run this exact build, so test as you go. Concepts are in my Bluetooth overview thread in this forum, and this is a modern alternative to the hand-written daemon approach in the beacon listener thread.

You need: Home Assistant with ESPHome, one ESP32 board per area (check ESPHome's docs for supported variants), and an iBeacon-compatible tag, or a phone beacon simulator app for testing.

Step 1: Flash a proxy

This is based on the "recommended configuration for a WiFi-connected Bluetooth proxy" in the ESPHome docs. Add your own API encryption key if you like.

Code: Select all

substitutions:
  name: my-bluetooth-proxy

esphome:
  name: ${name}
  name_add_mac_suffix: true

esp32:
  variant: esp32
  framework:
    type: esp-idf

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

logger:

api:

ota:
  platform: esphome

esp32_ble_tracker:

bluetooth_proxy:
  active: true
Keep Wi-Fi credentials in secrets.yaml. If your board is not a plain ESP32, change the variant or board to match.

Step 2: Place the proxies
  • One per area where you want coverage, close to the devices you care about.
  • Keep them at least 3 metres from routers and switches (EMI hurts reception, per the ESPHome docs).
  • Ethernet-based boards perform better than Wi-Fi ones, according to the docs.
Then in HA, go to Settings > Connectivity > Bluetooth to see each proxy listed as a scanner. You can select Show map to see which scanner each device is connecting through. Give each proxy an area.

Step 3: Add iBeacon Tracker
  1. Settings > Devices & services > Add Integration > iBeacon Tracker (needs the Bluetooth integration working).
  2. Set your tag's UUID, major and minor in its own app. The docs suggest one UUID for the house, a major per floor and a minor per room or tag.
  3. For the distance sensor, calibrate: place the tag 1 metre from the receiver in line of sight, read the signal strength (dBm), and set it in the tag's app.
  4. HA creates an Estimated Distance sensor. With several scanners, the one with the best signal reports it, so check the source attribute to see which proxy that is.
Step 4: A simple "not seen for a while" automation

This is the shape of the example in HA's docs. Entity name and numbers are placeholders.

Code: Select all

alias: "Tag has left"
triggers:
  - trigger: state
    entity_id: sensor.my_tag_estimated_distance
    to: "unavailable"
    for:
      minutes: 5
actions:
  - action: notify.notify
    data:
      message: "The tag has not been seen for 5 minutes"
Phones and Private BLE Device

Phones use randomised addresses, so you would need HA's Private BLE Device with an IRK. Follow HA's docs, and treat the IRK like a password. Don't paste it into a post.

Troubleshooting
  • Tag not appearing: iBeacons without stable major/minor values aren't supported by the integration, and beacons that don't broadcast a name aren't added automatically (the docs mention an options list for allowed UUIDs).
  • Distance bounces around: the docs say the estimate assumes perfect conditions. Use it as near/far, not as a measurement.
  • Proxy overheating or Wi-Fi flaky: keep scan settings at the defaults. The docs say aggressive values cause problems.
Keep it safe: don't use BLE presence as the only condition for unlocking doors or disarming alarms, since BLE proximity can be relayed.

Discussion: How many proxies did you need for your house, and how accurate was room-level presence for you?
Post Reply

Return to “Bluetooth Based Wireless Technology”