Revision [7911]
This is an old revision of MiBluetoothTempESPHome made by ZorrUno on 2022-05-26 02:11:37.
Cheap Mi Xiaomi BLE LCD Thermometers into Home Assistant
LCD Sensor Product
https://www.aliexpress.com/item/4001110925366.html"XIAOMI Mijia Bluetooth Thermometer 2 Wireless Smart"
Sensors are around NZ$8.50 incl GST when I bought 4 of them.
Goal
Use esphome in an ESP32 dev board to pull the values of these temp sensors and integrate them into home assistant.Howto
I followed this youtube howto from a year or so back. It is mostly correct.Part 1 https://www.youtube.com/watch?v=Be5zWukjV9I&t;
Part 2 https://www.youtube.com/watch?v=l5ea7lQWpMk
Summary - configuring the devices
--Turn the units on (do this one at a time if you have multiple)--Go to the TELink Flasher page https://pvvx.github.io/ATC_MiThermometer/TelinkMiFlasher.html. I suggest doing this on your phone as it needs to be a device with bluetooth.
--Use the tool to connect to the device, and grab the Mi Keys. Note them down. You won't need them if flashing the custom ATC firmware (this is a better way), but keep for future if ever needed. it is possible though to do this with the stock Xiaomi firmware.
--Flash the latest custom ATC firmware (it is already loaded in the web page)
--Check the website below if you want to know what the settings do (eg you can change to Fahrenheit, remove the little comfort smiley face, and extend the battery life with less reporting)
https://github.com/atc1441/ATC_MiThermometer
--For Advertising type, choose "MIJIA (Mi Home)". Previous notes (including the howto youtube video) said "Mi" or "Mi Like", but this works for me.
--Take note of the new name of the device, it will be something like ATC_91E1BB (which is the end of the MAC address)
Summary - ESPHome
-- Use ESPHome to flash the ESP32 (instructions elsewhere)-- An example (my file) is below. You need the esp32_ble_tracker: line and one config for each sensor.
-- Note that the Bindkey is a dummy key (with the ATC firmware you need the dummy key)
-- Put the MAC address for the device(s) and label the Temp/Humidity/Battery for each of the devices with unique names. The MACS all appear to start with A4:C1:38 (and then the rest is contained in the name). You can find the full MAC with the TELink page if needed.
Notes
-- Remember the devices will only connect to one host at a time, so if it is connected to the ESP32 you can't change parameters with the TELink app.Jaycar Specific Duinotech ESP32 Notes
-- I couldn't wait for some Dev boards from China and Jaycar had some half price ESP32 boards so I grabbed a couple to play withhttps://www.jaycar.co.nz/duinotech-wearable-esp32-development-board/p/XC3810
-- These were a problem (I had a couple of esphome based projects I wanted to play with) as when I connected them, the logs showed they wouldn't connect to wifi. Logs showed this:
"[W][wifi_esp32:495]: Event: Disconnected ssid='myaccesspoint' bssid=[redacted] reason='Auth Expired'"
I tried with multiple wifi settings and a couple of access points.
I was about to send them back and wait for the chinese boards, but found this:
https://github.com/espressif/arduino-esp32/issues/2144
There is a bit of a jumble of information in there, but I found that if I pulled the 0 pin to ground via a resistor (they suggested 330 Ohm, but currently I have about 480Ohm) it seems to boot and connect to wifi stably. Time will tell. Also pulling 0 low was often easier to flash the firmware when needed.