I purchased a Xiaomi BLE Temperature & Humidity sensor from AliExpress (the small square one with the LCD display) and I am struggling to connect it with Home Assistant.
I installed Hass.io on a Raspberry Pi 3 B+ and also connected the sensor to the Mi Home app on my phone. I used the mitemp_bt installation to connect the sensor to HA (here).
# Xiaomi temperature & humidity sensor
sensor:
- platform: mitemp_bt
mac: 'A4:C1:38:CA:xx:xx'
name: Home Temp Sensor
force_update: true
monitored_conditions:
- temperature
- humidity
- battery
When I run the bluetoothctl command in Home Assistant and perform a scan, I see that the sensor sometimes pops up but immediately disappears again. It seems like it can’t stay connected? See screenshot below (I’ve removed non-relevant information from the picture).
You could also try the custom component via hacs. This works in a different way (passive). This could help if you have connection errors. Also check the faq of this component for help with connection issues.
Maybe this method doesn’t work anymore? And even if I don’t have the bind key, I’m guessing I should still see the device in my Home Assistant, but without data?
Which method did you try? The first is successful for most people (TelinkFlasher method). It sometimes helps to connect the sensor first to the xiaomi app.
Note that the standard mitemp_bt component will not work, as it doesn’t support encrypted devices, like yours. So you have two choises, the custom component or esphome. Both need the bind key.
I tried option 1 with TelinkFlasher but I can’t get it to the “connected” state. Also tried option 2 by first removing the sensor from my Mi Home app and then reconnecting it.
I followed the exact steps but when I open the ATC Thermometer web tool to connect to the sensor and get the bind key, it just keeps saying “Searching for devices” in the log. I also don’t get the pop-up that the guy from the video has, where you need to select the device. I’ve tried multiple browsers and also different phones (iOS and Android). I noticed that the bluetooth icon on the sensor doesn’t always show, could this sensor be broken?
Currently I have no idea. yet. sorry.
I have orderd 4 of these and a couple of wemo D1 mini’s. SO I hope I can give you the answer in a couple of weeks.
But, maybe others can help you in the mean time.
Ok so I finally got it to work. Turns out the ATC Thermometer web tool to connect to my sensor worked fine if I used it on my laptop, contrary to all the tutorials saying you should open it on your phone. I flashed the custom firmware and got it to connect to my HA. Thanks for all the help everyone!
To inform others, I have followed the guide I proposed above in this thread. It takes some time, but it works…
I have a ESP32 D1 Mini. Its a version with wifi + Bluetooth BLE
first time flash to the chip, you need to select ESP32 generic instead of the specific ESP8266 D1 mini (which sounds/looks the first choice). the ESP8266 will not allow you to set esp32_ble_tracker.
After flashing the Xiaomi with new .bin file, it does not report the temperature on the web-page on your phone anymore. It does work, just dont forget to disconnect your phone (bluetooth) from the Xiaomi thermometer so the ESP can pick it up after 1 or 2 minutes. You can tell in the log of ESPhome if it connects right away.