You may have purchases some Xiaomi temperature and humidity sensors after reading my blog post from a while back.

Since then, Nabu Casa (the organisation behind Home Assistant) has somewhat taken over the ESPHome project and have been doing their best to incorporate the best of both worlds. One feature that’s of particular relevance is this story, is the native support for Bluetooth LE devices within HA and the addition of the Bluetooth Proxy component to ESPHome.

So from now on, you no longer need to add keys etc. for your Xiaomi BLE sensors to your ESPHome config. You can connect directly from your Home Assistant system, provided it has a bluetooth chip, or sprinkle some ESP32 (configured as BLE proxy) around.

The ESPHome method

If you already have some ESP32 around the house, maybe because you were using the method of my old blog post, this is by far the easiest solution.

In your ESP32 you probably had a section looking like this:


    # LYWSD03MMC - Advertising Type: Mi Like
    - platform: xiaomi_lywsd03mmc
      mac_address: "XX:XX:XX:XX:XX:XX" # Replace with MAC Address of sensor
      bindkey: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # Replace with bind key, use a dummy value when flashed with custom firmware
        name: "${sensor_name_lywsd03} - Temperature"
        name: "${sensor_name_lywsd03} - Humidity"
        name: "${sensor_name_lywsd03} - Battery Level"

All of this can be removed from the ESPHome config and be replaced by:


  active: false # Default

Bluetooth devices will now appear as new integrations in Home Assistant. You may need to enter the bindkey from your old ESPHome config when adding the devices to HA, so Home Assistant can decrypt the bluetooth packages.

The built-in Bluetooth method

This method is useful for when the system you’re running Home Assistant on has a built-in Bluetooth chip or you’re using a Bluetooth USB dongle. If you want to use a Bluetooth dongle, make sure you check the Bluetooth Integration documentation for the list of known-working adapters.

To then get Home Assistant to recognize your Bluetooth chip/adapter, follow these steps:

  1. Install DBus-broker package sudo apt install dbus-broker
  2. Enable system service sudo systemctl enable dbus-broker.service
  3. Install BlueZ package sudo apt install bluez
  4. Forward the Dbus socket to HA container by mapping it as a volume in your docker-compose.yaml.
      - /opt/homeassistant/config:/config
      - /etc/localtime:/etc/localtime:ro
      - /run/dbus:/run/dbus:ro # <-- Bluetooth adapter
  5. Rebuild your Home Assistant container by running docker-compose up -d homeassistant.

Once Home Assistant has rebooted, it’ll show a new integration for your Bluetooth adapter. After adding that integration, it’ll start discovering BLE devices and showing them as discovered integrations.

New Bluetooth integration available
New Bluetooth integration available

This update to ESPHome and Home Assistant has made it even easier to work with Bluetooth sensors.


Once final tip:

Ideally, you’d also flash the sensors so they would communicate/advertise using the BTHome open standard.

BTHome is an open standard for broadcasting sensor data and button presses over Bluetooth LE

Home Assistant supports it out of the box, and the process for flashing your Xiaomi sensors is the same but it uses an updated Telink Flasher.