Peering Xiaomi BLE Thermometer with ESP32 BLE proxy - no clue

Hi there,

I bought an ESP32 for use as Bluetooth proxy and some Xiaomi Mi Temperature/ Humdity Sensors LYWSD03MMC) . I flashed the ESP32 as Bluetooth proxy from this site: ESPHome Bluetooth Proxy. Thies seems to work because it is recognised:
image
Also recognised was (one of) the LYWSD03MMC, as it suddenly appeared in my Integrations. But when I attempt to configure it, I’m asked for the “bind key”. To get this key I used Telink Flasher v4.7. Therefore I had to peer the LYWSD03MMC with the Notebook. I could retrieve the bind key and token, … After that I disconnected the LYWSD03MMC from my notebook and even deactvated Bluetooth. I can also add the sensor with the Xiaomi integration:
image
When adding te device there is a message, that no beacon is receive, so that the integrationcan not dertermine, if a bind key is needed. And there is no communication with the Bluetooth proxy.
For mee it seems that the LYWSD03MMC is not peered /connected to the BLE proxy. How to troubleshoot this?

Hello, you are not on the right way.

Just delete or ignore the integration, its not from Bluetooth-proxy oben but from Xiaomi integration.

second : visit this webpage https://github.com/atc1441/ATC_MiThermometer

in fact you dont just need to pick the bind key but you MUST flash yours LYWSD03MMC with the custom firmware with Telink Flasher.

I used this one because i have no trouble even if atc1441 recomended to use the new version of somebody-else, it dont work for me.

After flashing, reconnect buetooth with your notebook to the LYWSD03MMC and make the seting that you want (interval time, batterie indicator, smiley, ect…) and then go to your node Bluetooth-proxy oben under EspHome and add

sensor:
  - platform: xiaomi_lywsd03mmc
    mac_address: "A4:C1:38:XX:XX:XX"
    bindkey: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    temperature:
      name: "Mi Bureau Temperature"
    humidity:
      name: "Mi Bureau Humidity"
    battery_level:
      name: "Mi Bureau Battery Level"

your LYWSD03MMC after flashing will have a name with ATC-XXXXXX, wher XXXXXX will be the last MAC ADRESS NUMBER you have to put in the EspHome config.

All LYWSD03MMC MAC ADRESS begin with A4:C1:38, you just need the 6 last digit and bind key.

Then OTA update your node (Bluetooth-proxy oben) under EspHome,

After a few seconds or minutes (depending of your interval setting, personnaly i put 10 minutes for battery life), you will see yours sensors temp, humidity and battery appear in the logs of your NODE under Esphome and you will have a new Device in HA for your fresh new LYWSD03MMC (named ATC-XXXXXX).

Enjoy.

Hello @Olivier974 , thanks. I’m totally new in this. If I understand you right, I can delete then Xiaomi BLE Integration. Then flash the custom firmware on the LYWSD03MMC (this I have done already).
Then you have written:

Blockquote
After flashing, reconnect buetooth with your notebook to the LYWSD03MMC and make the seting that you want (interval time, batterie indicator, smiley, ect…) and then go to your node Bluetooth-proxy oben under EspHome and add

sensor:
  - platform: xiaomi_lywsd03mmc
    mac_address: "A4:C1:38:XX:XX:XX"
    bindkey: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    temperature:
      name: "Mi Bureau Temperature"
    humidity:
      name: "Mi Bureau Humidity"
    battery_level:
      name: "Mi Bureau Battery Level"

Where exactly I have to put it? In my configuration.yaml under section sensor? Does this mean I have also to install theESPHome Add-on?

No Problem. Everyone of us was new to this one day :wink:

I dont understand why you ask

how did you install and flash your node “Bluetooth-proxy oben”???

you need EspHome Addon of course and you need to setup a node bluetooth of course. like this :

substitutions:
  name: bluethooth-proxy-bureau

esphome:
  name: ${name}
  name_add_mac_suffix: true
  project:
    name: esphome.bluetooth-proxy
    version: "1.0"

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "HxniBcCzu/BgZ/vZYz37c5r1RxKPakgX0wWW/hMYRx8="

ota:
  password: "73d249445d658be8c65fb1ce7188ee64"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_pwd
  manual_ip:
    static_ip: 192.168.1.XX
    gateway: 192.168.1.1
    subnet: 255.255.255.0
    dns1: 192.168.1.1
  fast_connect: on

dashboard_import:
  package_import_url: github://esphome/bluetooth-proxies/esp32-generic.yaml@main

esp32_ble_tracker:
  scan_parameters:
    interval: 1100ms
    window: 1100ms
    active: true

bluetooth_proxy:

button:
- platform: safe_mode
  name: Safe Mode Boot
  entity_category: diagnostic

change the name of the node and his IP adress! according to your IP Plan at home (ex: 10.0.0.xx or 192.168.1.xx)

after flash it to your esp32 and a new node : with Chrome : Install > plug in to your computer > download file > install > erase begin and copy begin.

After you will have a new bluethooth node create, just copy and paste this, changing IP again and names (sensors, name of the node) :

substitutions:

  name: bluethooth-proxy-bureau-122ae0

packages:

  esphome.bluetooth-proxy: github://esphome/bluetooth-proxies/esp32-generic.yaml@main

esphome:

  name: ${name}

  name_add_mac_suffix: false

# Enable logging

logger:

# Enable Home Assistant API

api:

  encryption:

    key: "HxniBcCzu/BgZ/vZYz37c5r1RxKPakgX0wWW/hMYRx8="

ota:

  password: "73d249445d658be8c65fb1ce7188ee64"

wifi:

  ssid: !secret wifi_ssid

  password: !secret wifi_pwd

  manual_ip:

    static_ip: 192.168.1.XX

    gateway: 192.168.1.1

    subnet: 255.255.255.0

    dns1: 192.168.1.1

  fast_connect: on

dashboard_import:

  package_import_url: github://esphome/bluetooth-proxies/esp32-generic.yaml@main

esp32_ble_tracker:

  scan_parameters:

    interval: 1100ms

    window: 1100ms

    active: true

bluetooth_proxy:

button:

- platform: safe_mode

  name: Safe Mode Boot

  entity_category: diagnostic

sensor:

  - platform: xiaomi_lywsd03mmc

    mac_address: "A4:C1:38:XX:XX:XX"

    bindkey: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

    temperature:

      name: "Mi Bureau Temperature"

    humidity:

      name: "Mi Bureau Humidity"

    battery_level:

      name: "Mi Bureau Battery Level"

And flash again.

You will have now a node named ```
bluethooth-proxy-xxxxxx

you can add maximum 3 sensors BLE for LYWSD03MMC. If more, you need another ESP32.

Switch to esp-idf to save ~50k of ram and use esphome 2022.12.0b2 or later

1 Like

@Olivier974:

Blockquote
how did you install and flash your node “Bluetooth-proxy oben”???
I used
ESPHome Bluetooth Proxy
to flash the ESP32. After that it was autodetecetd, and the integation asked for the IP Address, an that’s it.
But becaues it was autodetected, There is no section regarding EspHome (or whatever) in my config.yaml. So I don’t know where to put the sensor entries you mentioned. I also have no clue what to use as “- platform: ” for the entry?

and inside the node you put the config for your

LYWSD03MMC

thanks, i try right now

EDIT : works great with

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

thanks

EspHome is needed to add the

LYWSD03MMC

you flash before.

Just install the AddOn and the ESP32 for your Bluetooth proxy will be found.

After that you can modify and make OTA Update to this ESP32 directly from HA in EspHome Dashboard.

Here is my complete config: DONT COPY AND PASTE, adapt to your needs (IP Adress, names, bindKey…)

substitutions:
  name: bluethooth-proxy-bureau-122ae0
packages:
  esphome.bluetooth-proxy: github://esphome/bluetooth-proxies/esp32-generic.yaml@main
esphome:
  name: ${name}
  name_add_mac_suffix: false

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

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

ota:
  password: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_pwd
  manual_ip:
    static_ip: 192.168.1.xx
    gateway: 192.168.1.1
    subnet: 255.255.255.0
    dns1: 192.168.1.1
  fast_connect: on

dashboard_import:
  package_import_url: github://esphome/bluetooth-proxies/esp32-generic.yaml@main

esp32_ble_tracker:
  scan_parameters:
    interval: 1100ms
    window: 1100ms
    active: true

bluetooth_proxy:

button:
- platform: safe_mode
  name: Safe Mode Boot
  entity_category: diagnostic

sensor:
  - platform: xiaomi_lywsd03mmc
    mac_address: "A4:C1:38:xxxxxx"
    bindkey: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    temperature:
      name: "Mi Bureau Temperature"
    humidity:
      name: "Mi Bureau Humidity"
    battery_level:
      name: "Mi Bureau Battery Level"

  - platform: xiaomi_lywsd03mmc
    mac_address: "A4:C1:38:xxxxxx"
    bindkey: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    temperature:
      name: "Mi Salon Temperature"
    humidity:
      name: "Mi Salon Humidity"
    battery_level:
      name: "Mi Salon Battery Level"

  - platform: xiaomi_lywsd03mmc
    mac_address: "A4:C1:38:xxxxxxx"
    bindkey: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    temperature:
      name: "Mi Garage Temperature"
    humidity:
      name: "Mi Garage Humidity"
    battery_level:
      name: "Mi Garage Battery Level"

as you can see i have 3

LYWSD03MMC

in my config (down the code)

Thanks to all who were willing to help. Nevertheless, all the answers are misleading. Please do not follow.
My goal was to implement Bluetooth proxy and read Xiaomi thermometer and hygrometer in different rooms through it. If you have enough patience, everything works as expected. This is how I did it:

  1. flash an ESP32 with the BT proxy firmware. You don’t need the ESPHome integration, you can use the bluetooth proxy installer instead. That was what I used.
    If you want to use the Xiaomi BLE integration, you need the “bind key”. You can get this with:
  2. call Telink Flasher, connect thermometer via Bluetooth, then run “Do Activation”. This step is necessary to display the “Mi Bindkey”. You will need this later to complete the configuration.
    The thermometer may have been automatically detected in the meantime. If not,
  3. call up the Xiaomi BLE integration. If nothing is displayed, try again until it appears. The integration will now wait 1 minute for a signal from the thermometer, and then ask if you want to create the device anyway. Confirm this.
    4- WAIT (an eternity) As soon as the first value is sent from the thermometer, HA will report that a reconfiguration of the device is required. If this is started, HA will ask for the bindkey. Enter here the value extracted in point 2. with Telink Flasher. This completes the configuration, and a sensor for temperature or humidity should now also have been created. The still missing sensor will be created when a value for it arrives.
    Done!
    With the Telink Flasher you can also apply alternative firmware. There are 2 variants offered. I was offered 3 versions: Custom Firmware v3.8, beta firmware v3.9 and stock firmware. I tried the custom firmware, but it was not recognized by the Xiaom BLE integration. The beta firmware v3.9 I have not tried, but it could be that this works with the BTHome integration.
1 Like

Quick Update on the proxies:

If you flashed your ESPHome proxy before 7:00AM UTC on Tuesday, December 13, 2022, please flash again as it should improve the connection times.

Please use the web flash tool below or ESPHome addon 2022.12.0b5 or later as the main line ESPHome addon does not yet have the connection time improvements or aarch64 flashing fix:
https://esphome.github.io/bluetooth-proxies/

If you use the ESPHome addon you MUST connect the device via serial to flash it or you will not see the performance improvements with active connections.