A screenshot from Home Assistant, showing two sensors: Humidity: 50.33% Temperature: 23.1°C

How to Zigbeeize a cheap Xiaomi Bluetooth thermometer/hygrometer

Warning: These instructions work for my exact type of thermometers I’ve got. You might have totally different result, including your thermometer getting bricked, so don’t hold me liable for that (damages estimated at 6 dollars USA).

is me making a post after all this time a recession indicator?

So, we all know these guys, right? Cute little thermometery guys making faces at us depending on the climate in our abodes.

A photo of a white, square thermometer with rounded corners, with a prominent monochrome non-backlit LCD screen. In big 7-segment digits it display a temperature of 21.6°C, on the bottom it displays an ASCII art sad face to the left and a relative humidity of 68% to the right.
Forgive it being slightly dirty, I yanked it from where it’s bravely working just to take this picture.

Cheap Xiaomi Bluetooth thermometers, that are decent because they’re cheap and decent. What if I told you that you can get them to report their readings over Zigbee instead?

What do you need

  1. A cheap Xiaomi thermometer, model number supposedly LYWSD03MMC, although they might have different innards
  2. A Bluetooth computer (or a smartphone) running a web Bluetooth-capable browser (so, Chrome or Chrome-adjacent)
  3. A Zigbee gateway that actually supports these (in my case, Home Assistant running ZHA through a ZBT-1 dongle)
  4. An Android/iOS device that can run Mi Home.
  5. Python 3 on your computer
  6. Potentially a way to unbrick a thermometer by taking it apart and hotwiring UART to it
  7. A little bit of time

The process

So, just to be safe, familiarize yourself with https://github.com/pvvx/ZigbeeTLc.

I assume that we’re starting with a brand-new, factory-reset thermometer, not bound to an account.

First, put the battery in your thermometer boy, then go to https://pvvx.github.io/ATC_MiThermometer/TelinkMiFlasher.html and click “Connect”. Select your thermometer from the list and let it pair.

A screenshot of the Chrome on Linux Bluetooth device list.
A list of Bluetooth devices in our neighborhood. LYWSD03MMC is our brave thermometer.

If the following is displayed, then we gotta pair the thermometer with the Mi Home app. Install it, then pair your thermometer. It doesn’t matter which room you add it to in the app. Close the web flasher first.

A screenshot from the web flasher. "Status: 'LYWSD03MMC HW:B1.4' connected, you can now Do the Activation to either get the Token or flash a new Firmware"

Temp: 24.54°C, Humi: 51%, Bat: 3013 mV
It’s pretty toasty up there, ain’t it so?

After the thermometer is paired in the app, we run the following to get our tokens: https://github.com/PiotrMachowski/Xiaomi-cloud-tokens-extractor. For Poland, the right server is de. Turn Bluetooth on your phone/tablet/smart fridge off.

A screenshot from the cloud token extractor tool.

NAME: Mi Temperature and Humidity Monitor 2 2
ID: blt.[REDACTED]
BLE KEY: 7f[REDACTED]
MAC: A4:[REDACTED]
TOKEN: 5e[REDACTED]
MODEL: miaomiaoce.sensor_ht.t2
Not enough people appreciate the light mode.

Now go back to the flasher. ID goes in the Device known id field, TOKEN goes in the Mi Token field, and where does BLE KEY go? That’s right, in the Mi Bind Key hole. Click “Login” when you’re done.

A screenshot from the web flasher.

16:49:59: Send Login, please wait...
16:50:00: Received device infos are correct
16:50:00: Login successful
Aaaaaaand we’re in.

We then have to reflash our thermometer with the official firmware, because there can be many firmware versions hiding under the same version number.

A screenshot from the flasher.

Select Firmware: [file picker]
Two buttons:
Custom Firmware: ATC_v57.bin
Original_OTA_Xiaomi_LYWSD03MMC_v2.1.1_0159c.bin
Two options to choose from, and pretty obvious which one is the right one.

After it’s done, we have to reconnect and flash ATC_v57.bin. You can now turn Bluetooth back on on your smart device.

A screenshot from the flasher.

[Start Flashing button] fw: 'bin/ATC_v57.bin'
It’s called ATC because a guy codenamed atc1441 made it.

Then we reconnect to it (under its ATC_ alias), and we’re presented with a dizzying list of options.

A screenshot from the flasher.
Select Firmware: [file picker]
Four buttons:
Custom Firmware: ATC_v57.bin
Zigbee Firmware: 1141-020a-01353001-Z03MMC.zigbee
ZB Firmware: 1141-020a-00143001-Z03MMC.zigbee
Original_OTA_Xiaomi_LYWSD03MMC_v1.0.0_0130.bin
It feels like defusing a bomb.

You’ve got two choices:

  1. If you only want Zigbee, flash the Zigbee firmware
  2. If you also need it to continue sending out temperature via Bluetooth LE, flash the ZB firmware.

We’re going with the Zigbee option.

A photo of a thermometer with "---" on the screen and a Bluetooth icon lit up.
It’s like one of those mirror selfies.

After flashing is done, you can open the pairing mode in your Zigbee gateway.

A screenshot from ZHA: Device found
Starting interview
An interview? But I’m wearing casual clothes, and my hair is a mess!

And that’s it.

If you’ve got any questions, comments, or whatever, then the comment section is for you. Bring your own fediverse account with you first, though.

Fediverse Reactions

Comments

3 responses to “How to Zigbeeize a cheap Xiaomi Bluetooth thermometer/hygrometer”

  1. @Cysio do you get all configuration entities in ZHA? I contributed a quirk to ZHA some time ago so devices with that firmware should be supported natively with all features. Would be nice to get some feedback

    1. Yep, a bunch of it with the comfort temperature and humidity ranges.

    2. @tr4nt0r since WordPress is a bit flaky when it comes to comment replies I'll share it from my main

      @Cysio