Convert Xiaomi LYWSD03MMC From Bluetooth to Zigbee


UPDATE 08.01.2024: I added a guide for flashing the LYWSD03MMC using pvvx’s forked firmware, which is a bit easier and doesn’t require flashing transitional firmware files. As of now, this is the recommended method.
UPDATE 20.12.2023: I documented flashing the Qingping CGDK2 via OTA and UART connection, using pvvx custom firmware.
UPDATE 13.11.2023: The Qingping Temp & RH Monitor LITE CGDK2 [AliExpress] and the MiaoMiaoCe Temp & RH Monitor MHO-C122 [Webstore] have received Zigbee support! Follow the OTA pvvx guide bellow to flash.

As some of you know, I’ve been testing and reviewing Zigbee temperature and humidity devices for a while now, recently culminating in a summary article comparing 10 of these climate sensors with a display. This was an effort towards finding out which ones are worth our money and which are not.

Even though I’ve accumulated more than 15 different models, I never actually used Zigbee-based temperature sensors in my home. I’ve always relied on Xiaomi BLE devices (Especially the LYWSD02 and CGG1), whose packets I capture with ESP32 boards.

Convert Xiaomi LYWSD03MMC BLE to Zigbee: Featured Image

In this article, I’m going through the process of flashing a Xiaomi Sensor (LYWSD03MMC) with Zigbee firmware and integrating the device with Zigbee2MQTT and ZHA in Home Assistant.

About the LYWSD03MMC

The LYWSD03MMC is a BLE (Bluetooth Low Energy Sensor) manufactured by Xiaomi, which relies on the Telink TLSR8258 [Datasheet] MCU. It’s a square model with a small LCD display, powered by a single button cell CR2032 battery.

The Telink chips used in these devices can be flashed with custom firmware which unlocks several customization options, better battery life, better accuracy of measurements and LCD display information looping.

With it’s default firmware, it publishes it’s readings via BLE once every 10 minutes. By using the custom firmware, the interval can be changed to report more frequently. Currently the pvvx custom firmware supports the following models:

  • Xiaomi LYWSD03MMC [Zigbee, BLE]
  • Xiaomi MJWSD05MMC [BLE]
  • Qingping CGG1 [BLE]
  • Qingping CGDK2 [Zigbee, BLE]
  • Xiaomi MiaoMiaoCe MHO-C401 [Zigbee, BLE]
  • Xiaomi MiaMiaoCe MHO-C122 [Zigbee, BLE]

The Zigbee custom firmware for this device was initially developed by Ivan Belokobylskiy (devbis) and can be flashed OTA (Over-the-Air) or with an USB-to-TTL adapter. In this article, I’m going over the OTA method as it’s easier and doesn’t require dismantling the device and soldering wires. Since the firmware was forked by Victor [pvvx], I also included a guide for flashing the Zigbee firmware using his method.

Convert LYWSD03MMC to Zigbee (OTA, devbis)

First, you need to #enable-experimental-web-platform-features in Chrome, Opera or Edge. This is necessary in order to get the MAC Address of the device. Copy the following links for the browser you use and paste it into the address bar:

  • Chrome: chrome://flags/#enable-experimental-web-platform-features
  • Opera: opera://flags/#enable-experimental-web-platform-features
  • Edge: edge://flags/#enable-experimental-web-platform-features
Enable Experimental Web platform features on Chrome

Restart your browser. To flash the LYWSD03MMC, carefully follow the procedure bellow.

  1. In your browser, navigate to https://pvvx.github.io/ATC_MiThermometer/TelinkMiFlasher.html
  2. Check Get Advertising MAC and click Connect
  3. Select the LYWSD03MMC from the list of Bluetooth devices and click Pair

    Convert Xiaomi LYWSD03MMC BLE to Zigbee: Step 1 - First Connection
  4. Wait for the connection to be established
  5. Press the Do Activation button and wait
  6. Download the transitional firmware file ATC_ota_40000.bin
  7. Select the file by clicking Choose File

    Convert Xiaomi LYWSD03MMC BLE to Zigbee: Step 2 - Activation and Flashing Transitional Firmware
  8. Press Start Flashing and wait for the process to finish.

WARNING: Flash the transitional firmware even if you are already on custom firmware! Failure to do so make brick your device and you will need to use USB/UART to re-flash it.

Once the transitional firmware if flashed, take out the battery of the Xiaomi LYWSD03MMC and wait 15-20 seconds. Reinstall the battery and wait for the device to boot up again.

  1. Navigate to the Zigbee version of the Telink flasher
  2. Press Connect again only this time the device name will be different (e.g. ATC_XXXXXX)

    Convert Xiaomi LYWSD03MMC BLE to Zigbee: Step 3 - Reconnection
  3. Press Pair
  4. Download the latest z03mmc.bin Zigbee Firmware file:
  5. Click Choose File and select the z03mmc.bin
  6. Press Start Flashing and wait for the process to finish

    Convert Xiaomi LYWSD03MMC BLE to Zigbee: Step 4- Final Flashing

The process can take somewhere between 4-5 minutes and it will log Update done after XXX seconds in the console. Done!

Convert LYWSD03MMC to Zigbee (OTA, pvvx)

Since my release of the flashing guide, pvvx forked the original devbis Zigbee firmware and shared a simpler method of converting the LYWSD03MMC without flashing a transitional firmware. The procedure is more or less the same, with slight differences and fewer steps.

There is no need to download additional files or transitional firmware, however, you may have to flash the Custom Firmware ver 4.6 if you are running stock firmware. This is dependent on your LYWSD03MMC hardware revision version, since Xiaomi firmware versions do not allow flashing files larger than 128kb.

If you are running stock firmware, I suggest you flash the Custom Firmware ver 4.6 in any case, to avoid potential issues and confusion. There is no need to download any files to your PC with this method, the flasher handles everything automatically. Here’s how to do it step by step:

  1. In your browser, navigate to https://pvvx.github.io/ATC_MiThermometer/TelinkMiFlasher.html
  2. Check Get Advertising MAC and click Connect
  3. Select the LYWSD03MMC from the list of Bluetooth devices and click Pair
  4. Wait for the connection to be established
  5. If you are running stock firmware:
    • Press Do Activation and wait for it to finish
    • Press Custom Firmware ver 4.6
    • Press Start Flashing
    • Reconnect to ATC_FXXXX
    • Press Zigbee Firmware: Z03MMC_v0118.bin (latest)
    • Press Start Flashing
  6. If you are running custom firmware
    • Press Zigbee Firmware: Z03MMC_v0118.bin (latest) directly
    • Press Start Flashing
    • Convert Xiaomi LYWSD03MMC BLE to Zigbee: PVVX Firmware
  7. Done, continue to pair the LYWSD03MMC to your Zigbee coordinator

Convert LYWSD03MMC to Zigbee (UART)

Wires are always better than wireless, so if you encounter issues while flashing you can always use UART to flash the Xiaomi LYWSD03MMC Sensor. However, the process is a bit more involved and requires soldering. Follow the guide I shared in the CGDK2 flashing guide to covert the LYWSD03MMC via USB to UART.

Pairing the LYWSD03MMC to Zigbee2MQTT

The Xiaomi LYWSD03MMC was added to Zigbee2MQTT with version 1.33.2, so if you do not want to use an external converter make sure you update. Here’s how to use the external converter in case the device is unrecognized:

  1. Create a new file in zigbee2mqtt folder (next to configuration.yaml)
  2. Name it lywsd03mmc.js (make sure it ends with .js)
  3. Open the file and copy the contents from bellow:
const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const ota = require('zigbee-herdsman-converters/lib/ota');
const e = exposes.presets;

const definition = {
    zigbeeModel: ['LYWSD03MMC'],
    model: 'LYWSD03MMC',
    vendor: 'Xiaomi',
    description: 'Temperature & humidity sensor',
    fromZigbee: [fz.temperature, fz.humidity, fz.battery],
    toZigbee: [],
    configure: async (device, coordinatorEndpoint, logger) => {
        const endpoint = device.getEndpoint(1);
        const bindClusters = ['msTemperatureMeasurement', 'msRelativeHumidity', 'genPowerCfg'];
        await reporting.bind(endpoint, coordinatorEndpoint, bindClusters);
        await reporting.temperature(endpoint, {min: 10, max: 300, change: 10});
        await reporting.humidity(endpoint, {min: 10, max: 300, change: 50});
        await reporting.batteryVoltage(endpoint);
        await reporting.batteryPercentageRemaining(endpoint);
    },
    exposes: [e.temperature(), e.humidity(), e.battery()],
    ota: ota.zigbeeOTA,
};

module.exports = definition;
Code language: YAML (yaml)
  1. Save the File
  2. Open Zigbee2MQTT’s configuration.yaml file (NOT Home Assistant’s)
    • Location of the file is zigbee2mqtt/configuration.yaml
  3. Enable the external converter by adding the following lines:
  4. Restart Zigbee2MQTT and pair the LYWSD03MMC
external_converters:
  - lywsd03mmc.js
Code language: YAML (yaml)

Once the LYWSD03MMC is powered up initially, it will automatically enter pairing mode. If not, you can use a short piece of wire of something metal to short the RESET and GND contacts for 3 seconds.

Convert Xiaomi LYWSD03MMC BLE to Zigbee: Pairing Mode

Once the device gets discovered and paired in Zigbee2MQTT, it will be identified as an EndDevice by manufacturer Xiaomi and model LYWSD03MMC.

Convert Xiaomi LYWSD03MMC BLE to Zigbee: Zigbee2MQTT

It exposes the following entities in Home Assistant through Zigbee2MQTT:

Convert Xiaomi LYWSD03MMC BLE to Zigbee: Zigbee2MQTT Entities

Pairing the LYWSD03MMC to ZHA

Once flashed, the device works with ZHA in Home Assistant without the need of any custom quirks. Remember to short the RESET and GND contacts for 3 seconds to enable pairing mode. Once paired, it identified as LYWSD03MMC by Xiaomi as an EndDevice.

Convert Xiaomi LYWSD03MMC BLE to Zigbee: Added to ZHA

About Battery Life

Since most people are wondering how battery life is affected on the Zigbee firmware compared to the original BLE firmware, developer pvvx wrote a short paragraph explaining his findings:

“The final average consumption of LYWSD03MC B1.4 when measured from a 3.3V source is from 14 to 26 µA, depending on the dynamics of changes in temperature and humidity. For comparison, the BLE version consumes 14 µA with default settings and constant transmission of all measured values ​​every 10 seconds.”

It’s safe to say that even though battery consumption is higher on the Zigbee firmware, in reality it will be affected very little compared to the default setting of the BLE version.

Final Thoughts

UPDATE 08.01.2024: I added a guide for flashing the LYWSD03MMC using pvvx’s forked firmware, which is a bit easier and doesn’t require flashing transitional firmware files. As of now, this is the recommended method.
UPDATE 20.12.2023: I documented flashing the Qingping CGDK2 via OTA and UART connection, using pvvx custom firmware.
UPDATE 13.11.2023: The Qingping Temp & RH Monitor LITE CGDK2 [AliExpress] and the MiaoMiaoCe Temp & RH Monitor MHO-C122 [Webstore] have received Zigbee support! Follow the OTA pvvx guide to flash.

Converting the Xiaomi LYWSD03MMC is useful for people who want to use Zigbee devices exclusively in their smart home. Props to Victor (pvvx) for forking and developing the original ATC Thermometer firmware and Ivan Belokobylskiy (devbis) for developing the Zigbee custom firmware.

The device reports every 5 minutes in Zigbee2MQTT and ZHA, pushing the temperature and humidity reading with a precision of two decimal places. You can create an offset in Zigbee2MQTT if needed and calibrate the measurements.

Remember, you will not be able to reconnect to the device with the Telink flashed since there is no Bluetooth firmware installed anymore. You can use Zigbee2MQTT’s OTA update feature to flash and update the LYWSD03MMC again if you need to.

Fahrenheit support is not yet available with the custom firmware, the dev added a PR on the official repo so it should be coming soon.

For those of you wondering whether this will be possible for other Xiaomi sensors based on the Telink MCU: Yes, in theory it is, although there is no development at the moment.

You can get the Xiaomi LYWSD03MMC on AliExpress and Amazon.

SmartHomeScene.com is a participant in the Amazon Services LLC Associates Program & AliExpress Portals Affiliate Program.
We may earn a small commission on qualifying purchases from these websites, which incurs no additional cost to you.
SmartHomeScene © 2023 All rights reserved
Ko-Fi SmartHomeScene.com

163 thoughts on “Convert Xiaomi LYWSD03MMC From Bluetooth to Zigbee”

  1. Wow, what a great way to improve the usability of these cheap sensors! The guide worked perfectly, although I did have to create the external converter (even on Zigbee2MQTT 1.33.1), since it first reported as unsupported.

    Also, it seems the “interview was not completed”, but I still get temperature and humidity data. To be fair however, I use a very basic CC2531 Zigbee sniffer (using router firmware) and have 46 Zigbee devices, which may be stretching its capabilities quite a bit…

  2. I have 3 of these devices but I cannot connect them even to the first page. It sees my MAC Address, i pair with the browse on that page and it tries do connect 5 times and then i get a message “connection Error” and then “Something went wrong, to many reconnects”. I have enable the experimental-web-platform on Chrome. All of them are on custom firmware. I don’t know what i’m doing wrong. But great step by step info. Thanks

      1. I tried this updated, but I guess I fried the device. Screen is dead. I guess recovery is not possible.

  3. Worked like a charm.
    Thanks for the detailed description.
    Also had to create the external converter but after that it was smooth sailing.
    Do you have any idea about battery life ?
    Nice tutorial
    Thank you

    1. Still early to tell, but going by my experience with Zigbee and BLE Sensors, I would guess about 20-25% lower battery life on the Zigbee firmware.
      The custom firmware does bring some battery optimization though

  4. If you live in densely populated areas, I recommend flashing while in the basement/cellar or even going to a park or in the woods.
    For me, flashing these thermometers with ATC firmware worked much, much better while in the cellar.
    Personally, the only advantage I see for ZigBee is the relaying of the network (my Pi4 could be better hidden away). Otherwise, if the reports are every 5 minutes, irrelevant if the values change, it would make my bathroom fan automation almost useless.

  5. Hi!
    Flashing goes well. but when goes my zigbee2mqtt > there shows those are unsupported and can´t see temperature etc

    Device type
    EndDevice
    Zigbee model
    LYWSD03MMC
    Support status
    Unsupported
    Made that:
    Create a new file in zigbee2mqtt folder (next to configuration.yaml)
    Name it lywsd03mmc.js (make sure it ends with .js)
    Open the file and copy the contents from bellow:
    And configuration.yaml too.

    any thoughts?

    1. Make sure you stop Zigbee2MQTT
      Open the Zigbee2MQTT folder
      You will see configuration.yaml file inside (NOT Home Assistants’s configuration.yaml file)
      Add the code. Restart Zigbee2MQTT

  6. I flashed one to Zigbee and it is added to Z2M with the error “interview was not completed”. What can I do?

  7. Tried with two of mine. Flashing seemed to be completed fine. Ended up with 3 dashes and the little bluetooth icon on the sensor, but seemed stuck. After getting the battery out and in, nothing happens anymore 🙁

  8. So.. i manage to brick my sensor. After the flashing was finished ( step 14.) the sensor turned off and it won’t turn on.. Any suggestions how to bring it to life?

    1. Went as smooth as possible for me.
      Can you try a fresh battery?
      Did you get the Update done after XXX seconds in the console?

      1. Battery is not a problem ( connected to external DC power supply).
        And i did get the “Update done after XXX seconds”..

        1. I got the same problem, I’m using a fresh duracell battery, so it can’t be any issue there. All seemed to go fine, then I got “Update done after 185 seconds”, but the sensor went blank and won’t respond. Maybe latest firmware has issues?

        2. Quite sure now that this is because I had the wrong ‘transition’ firmware in place. I had a more recent version that the version indicated by the documentation, https://github.com/devbis/z03mmc/blob/master/assets/ATC_ota_40000.bin.
          I tried again on another device and it worked this time, also it took much longer to flash the zigbee firmware than the first time.
          Fantastic work making these brilliant cheap devices even more integrated into my smart home!!

  9. Merci vous êtes un génie bravo cela marche parfaitement
    Thank you you are a genius well done it works perfectly

  10. Very nice tutorial! Amazing and straightforward.

    Just a little issue at the beginning, because I used ‘Save Link As…’ directly from the link above and downloaded a 352KB binary file, which turned out to be the GitHub HTML saved as a .bin file. I realized there was an issue with the file when the firmware upload tool displayed a popup message saying, ‘Size firmware is more than 131,072 bytes.’ I finally downloaded the file directly from the GitHub repo, and it was 80.6KB, which was correct.

    Currently, I have configured one out of my 12 devices for testing this new Zigbee implementation. I’ve placed this test device next to an identical Bluetooth device for comparison. Additionally, I have replaced the batteries in both devices with batteries from the same brand and pack (100% capacity) at the same time to compare the difference in terms of battery consumption over the long run. I will also compare the value reporting to see if they look similar.

    1. I am also benchmarking the battery. Please report back once you have a conclusive result (I would say 10-15 days)

      Thanks

      1. Already, after just 3 days, I’ve noticed a significant difference. While my Bluetooth thermometer has dropped to 94% of its battery life, my Zigbee device remains at 100%, which is a bit surprising. Now, the question arises: could there be a difference in the percentage calculation between the Zigbee and Bluetooth implementations? A 6% decrease in 3 days seems quite significant, and I would have expected Zigbee to consume more energy which is the total opposite.

        1. Hey Vincent,

          Battery reporting is wildly inaccurate in these types of sensors, no matter the firmware.
          It is calculated on voltage and is actually an approximation, it’s not an exact percentage.

          Zigbee should and will consume more battery, so just give some time to stabilize.
          My estimate suggest around 15-20% shorter battery life on the Zigbee firmware with a 5 minute reporting rate.
          Which should still make it last 8+ months on a good battery.

          Cheers

  11. I flashed one sensor for testing, work like a charm with zigbee2mqtt.
    I’ll compare the measurements with other one in bluetooth.
    Thanks for this article !

  12. i have installed the firmware on mine, this went ok. But know i can not connect it to zigbee2mqtt. I have created the external converter.

    I tried to short it with an copper wire, but it does not like to do anyhting.
    What can i try?

    1. 1. Take out the battery for 10-15 seconds
      2. Click Permit Join in Z2M
      3. Put the battery in place
      4. Wait for it to pair, if not short the GND and RESET for 3 seconds

      1. Same problem here. First device works like a charm after flashing. Second one device flashed without problems also, but it cannot enter pairing mode. Removing battery and GND + RESET is not working.

          1. You might have to use UART, seems like OTA flashing soft bricked it.
            Possibly due to low battery.
            You can use USB-UART and flash it without problems

  13. Hi, Thanks for the detailed steps. Unfortunately, I get the following when trying to flash the transitional firmware – any suggestions?

    4:33:30 pm: Get Advertising MAC (Web Experimental Features!)
    4:33:30 pm: Connecting to: ATC_AB84E5
    4:33:53 pm: MAC: A4C138AB84E5, Bat: 72%, Vbat: 2709 mV , Temp: 26.31°C, Humi: 65.85%, Count: 15, Flg: 5
    4:34:00 pm: Hardware Revision String: B1.6
    4:34:00 pm: Software Revision String: V3.9
    4:34:00 pm: Firmware Revision String: github.com/pvvx
    4:34:00 pm: Detected custom Firmware
    4:34:00 pm: Hardware Version: LYWSD03MMC B1.6, Software Version: 3.9, Sensor: SHT4x
    4:34:00 pm: Custom config HEX string: 55856000002804a97c3104b4000000
    4:34:03 pm: Start DFU
    4:34:11 pm: Update error: NotSupportedError: GATT operation failed for unknown reason.
    4:34:11 pm: Disconnected.

      1. yes, first atc.ota.40000.bin, then zigbee, but it failed, the thermometer disconnected. Unable to pair now. I’ll try the ttl method, but I don’t really understand it

      2. Yes – but have managed by repeatedly reconnecting managed to get devices flashed. It is the transitional firmware that I was having trouble flashing – the zigbee firmware always flashed first time OK. If the transitional firmware failed it was either at block #7, or the block number were increasing very slowly. Once the firmware had got passed block #7 – and the block count increased rapidly it would always work.

  14. I realized that the battery voltage is not exposed from the Zigbee state. To expose the battery voltage, I made a simple modification to the lywsd03mmc.js file :

    Original: exposes: [e.temperature(), e.humidity(), e.battery()],
    Modified: exposes: [e.temperature(), e.humidity(), e.battery(), e.battery_voltage()],

  15. Thanks for this. Got it working on 2 devices. Battery life is horrible with zigbee. I had a new battery with 100% reporting for a day. Today after around 5 days, it’s at 65%. So going by that it will only last for 12-15days max.

    Other sensor had around 60% battery on start, currently at 11% after 5 days. So around 8-10% drain a day. totally not acceptable.

    What are other’s findings?

    1. As I mentioned in another comment, Battery reporting is wildly inaccurate in these sensors no matter the firmware.
      They calculate the percentage left based on voltage, which can fluctuate.

      Give it some time to stabilize and see if it really is draining that much.
      My estimate is about 20-25% shorter life span of the battery with the Zigbee version but not what you are suggesting.

      Cheers

  16. Hello, I followed the instructions and flashed fw ATC_ota_40000.bin, successfully.
    then i wanted to flash fw z03mmc.bin, but it always ended in error
    21:46:30: Searching for devices
    21:46:34: Get Advertising MAC (Web Experimental Features!)
    21:46:34: Connecting to: ATC_3D6CCC
    21:46:35: MAC: A4C1383D6CCC, Bat: 100%, Vbat: 3151 mV , Temp: 21.43°C, Humi: 60.91%, Count: 14, Flg: 4
    21:46:44: Hardware Revision String: B1.5
    21:46:44: Software Revision String: V4.4
    21:46:44: Firmware Revision String: github.com/pvvx
    21:46:44: Detected custom Firmware
    21:46:47: Hardware Version: LYWSD03MMC B1.5, Software Version: 4.4, Sensor: SHTC3 (SHTV3)
    21:46:47: Custom config HEX string: 55051000002804a931318ab4
    21:46:55: File: z03mmc-1.bin
    21:46:55: File size: 129236 bytes
    21:46:55: Count: 8078
    21:46:57: Start DFU
    21:47:03: Update error: NotSupportedError: GATT Error Unknown.
    21:47:03: Disconnected.
    via HP ntb succeeded and flash started, there were three dashes on the display, but disconnected after 57 seconds, flasher now doesn’t see the thermometer, can’t pair.

  17. Mads Bondo Dydensborg

    So, I had problems with connecting for the first part, but eventually was able to flash the transition firmware. The device now appears as ATC_0E2D7B, but even after 6-8 reboots, and restarting the browser, etc, I am not really able to get it to connect to the ATC “version”. It shows up as unpaired, but never connects, just:
    Status: Connecting to: ATC_0E2D7B …
    Temp/Humidity: waiting notify for data after connecting
    and in the log:
    15.11.58: Searching for devices
    15.12.03: Connecting to: ATC_0E2D7B

    Any hints from anybody?

    1. Clear the cache or use another browser.
      Do you have others BLE devices in close proximity? Eliminate interference for the time being and test.

  18. Hello,
    I flashed mi device using UART. After that, I connected it via ZHA, but I only receive information at the time of linking. After that, the device not notifies changes via Zigbee

  19. Hi,
    I made a mistake and updated the firmware in the Xiaomi application before realized there was this amazing thing.
    Now in Telink, I get this report:
    01:46:19: Searching for devices
    01:46:48: Get Advertising MAC (Web Experimental Features!)
    01:46:48: Connecting to: LYWSD03MMC
    01:47:15: MiVer5, DevID: 0x055B-LYWSD03MMC, FnCnt: 214, CtrID: 0x5858 Not bound, Standard certification, MAC: A4C1388BD1A0, Data encrypted
    01:48:13: Hardware Revision String: B1.4
    01:48:13: Software Revision String: 0159
    01:48:13: Firmware Revision String: 2.1.1_0159
    01:48:13: Detected Mi device
    01:48:13: (!) Version: 2.1.1_0159 is temporarily not supported (!)
    01:48:13: Disconnected.

    Is there any way to downgrade the firmware of the device or wait for Telink to support this version?

    Fortunately, I had some other device lying around that I had not upgraded, and I had successfully converted it to Zigbee.

    I had to add the external converter because of some troubles with zigbee2mqtt upgrade.

    Thank you very much!

  20. I went back to ATC4.4 via the ttl converter, the thermometer works again. As soon as I upload the ATC40000, it’s over and the thermometer refuses to connect. Would it be possible to elaborate a bit on how to upload the zigbee variant via TTL, thank you

  21. good morning,
    can you help me?

    Detected custom Firmware
    12:14:43: Hardware Version: LYWSD03MMC B1.5, Software Version: 4.4, Sensor: SHTC3 (SHTV3)
    12:14:43: Custom config HEX string: 55211000002804a931318ab4
    12:16:08: File: z03mmc.bin
    12:16:08: File size: 129236 bytes
    12:16:08: Count: 8078
    12:16:11: Start DFU
    12:16:16: Update error: NotSupportedError: GATT operation failed for unknown reason.
    12:16:16: Disconnected.

    fortunally i can connect again with the device, but how can i solve? i installed before the ATC_ota_40000.bin firmware

        1. None at the moment, although I believe every Telink device can theoretically be flashed to Zigbee.
          Seems like the TH05 model you have uses encrypted BLE advertisements. It can be done, but understandably no one has interest in bothering with it.
          Your best bet is local tuya w/hub. 🙂

  22. Can confirm the transitional firmware step is important as bricked two out of 7 OTA, not an issue for me as done via wires now but still should have done it (found this guide after I had done it)! Worth noting that there is a report of an issue with bluetooth devices such as these connected to homeassistant using an SSD wearing out the SSD quite quickly as constant writes of a small file, this zigbee approach prevents that so seems like a good approach if true. Also makes my Z2M map look more fun

  23. Hello. Is it possible to change the “MHO-C303” model to zigbee?? It is a product with a clock and a thermo-hygrometer, and the guide description shows as follows.

    Hygro thermometer clock with alarm, rectangular body, e-ink display, broadcasts temperature, humidity and battery status. Not encrypted.

    Similar to the LYWSD02, with additional clock features (alarm, pomodoro timer). Runs on two AAA batteries.
    -redacted-

  24. If you can’t connect, please disable extensions in the browser like ublock origin. Without disabled i can’t connect. After that it goes a lot more smooth. But also needed reconnect 1 time.
    Just amazing devices are these small Xiaomi sensors. Lot of features and very precise. Hope there comes a lot more functionality in the firmware so you can configure it like the PVVX firmware. So enable and disable smile, battery status on display, update interval and so on.

  25. Hi
    I have flashed one of my LYWSD03MMC with the zigbee firmware and it worked also a few days with my sonoff Dongle-E and ZHA in home assistent.
    But now my ZHA network no sees the LYWSD03MMC anymore.
    An shorting grd and reset also not set it to pairing mode.
    I cant add the LYWSD03MMC to my network.
    So what can i do now?

  26. This looks as wonderful project, thank you for all the effort. However I am trying to flash the transition firmware, getting the message “Incorrect head in Telink OTA binary firmware”. Seemed simple but still I am doing something wrong. 🙂

    10:29:21 AM: Searching for devices
    10:29:23 AM: Connecting to: LYWSD03MMC
    10:29:23 AM: Hardware Revision String: ���U
    10:29:23 AM: Software Revision String: 0130
    10:29:23 AM: Firmware Revision String: 1.0.0_0130
    10:29:23 AM: Detected Mi device
    10:29:23 AM: Connected
    10:29:27 AM: Activating now, please wait…
    10:29:31 AM: Registration successful
    10:29:31 AM: Send Login, please wait…
    10:29:31 AM: Repeat login!
    10:29:36 AM: File: ATC_ota_40000.bin
    10:29:57 AM: Incorrect head in Telink OTA binary firmware

    ANy ideas? Thank you in advance!

    1. I will reply to myself. I solved the problem by programming the device via serial line. However, the python script approach did not work – device did not reset to boot mode when using parameters suggested in tutorial. But the web serial flasher tool performed the soft reset and flashing was successful then.

  27. Hi
    Do you know if it’s possible to do the same in jeedom
    In jeedom, in the zigbee2mqtt folder, there is no configuration.yaml file… Thanks

    1. No, I am not really familiar with Jeedom.
      The external converter is fairly new, so I guess you would need to adapt it to Jeedom in order to use it.

    2. Thanks a lot for your page. 🙂
      For Jeedom, you don’t need an adapter, BUT you must update dependencies on JeeZigbee plugin parameters page, to have at least zigbee2mqtt >= 1.33.1.
      You can find version of ZigbeeMqtt on “zigbee network” on JeeZigbee gestion page.

  28. Hello, having issues to connect to a new device, it’s the first time I try this:

    16:23:36: Connecting to: LYWSD03MMC
    16:24:14: MiVer5, DevID: 0x055B-LYWSD03MMC, FnCnt: 1, CtrID: 0x5830 Not bound, Standard certification, MAC: A4C1386E458A, Capability: 0x28 – front binding, IO: 0x0001
    16:24:21: Not found Telink UUID service!

    anything I’m doing wrong?
    kr
    Ivan

  29. Fantastic, just flashed 2 of them and zha picked them up right away!
    I have been having Bluetooth issues and passing the Bluetooth device through to a vm of HA and this has now solved it.

    Thanks very much

  30. My devices is flashed with the BLE firmware from ATC (https://github.com/atc1441/ATC_MiThermometer) and comes back with the following
    09:55:14: Searching for devices
    09:55:26: Get Advertising MAC (Web Experimental Features!)
    09:55:26: Connecting to: ATC_5456FA
    09:55:26: MAC: A4C1385456FA, Bat: 79%, Vbat: 2921 mV, Temp: 18.3°C, Humi: 65%, Count: 26
    09:55:36: Not found Telink UUID service!
    09:55:36: Disconnected.

    Is there something that can be done here?
    Thanks in Advance

  31. this flasher https://pvvx.github.io/ATC_MiThermometer/TelinkMiFlasher.html results in :
    13:54:23: Searching for devices
    13:54:48: Get Advertising MAC (Web Experimental Features!)
    13:54:48: Connecting to: ATC_6E0752
    13:54:51: MAC: A4C1386E0752, Bat: 72%, Vbat: 2863 mV, Temp: 18.2°C, Humi: 64%, Count: 20
    13:54:53: Not found Telink UUID service!
    13:54:53: Disconnected.

    So it connects to the device, retrieves bat/temp/humi/etc info but then disconnects.

  32. Thx for the Zigbee2MQTT yml instructions! Couldn’t pair without this.

    Pairing tip: put Zigbee2MQTT in pairing mode while at the end of your flashing. Then the device will be automatically paired, without you to remove the battery.

  33. I flashed 3 devices, the first two I had no problems, but the third now is stuck. It looked OK, but after flashing the z03mmc.bin firmware, the screen is ON but it doesn’t refresh the temp/humidity anymore and it doesn’t connect to Zigbee2MQTT. If I take the battery, it refresh the temp/humidity just once, it blinks the screen once, and then nothing…

  34. Hi all, I converted successfully 3 devices but the battery consumption is too high compared with other devices. I’ve a switchbot ble temperature devices that is at 100% battery after few months while the converted xiaomi zigbee device was dropped to 90% after one week.
    Could you shared the steps to return to ble firmware?

    Regards

  35. I have the newest firmware on my xiaomi sensors, and after pairing the flasher recognises it and automaticly disconected with incompatibly problem.

  36. I just flashed my Mi Thermometer, but it displays only Temp, no humidity/battery:

    MQTT publish: topic ‘zigbee2mqtt/Mi Temp 5’, payload ‘{“battery”:null,”humidity”:null,”linkquality”:80,”temperature”:27.68,”update”:{“installed_version”:-1,”latest_version”:-1,”state”:”idle”},”update_available”:false}’

    I used new sensor.

    Is there any way to fix this?

  37. That’s awesome!
    Just a question: will I be able to connect the Zigbee-converted device with the XIAOMI Mijia Smart Multi-Mode Gateway ZigBee/WIFI/Bluetooth?
    Thank you,
    Luca

    1. I had the same with zigbee2mqtt – i suspect it is the “min rep change” filter that is stopping it reporting because if I lower it to 1 I get lots of updates!

  38. I have a poor reception scenario, and I was playing around (before flashing to zb) with transmit power in the pvxx flasher. But not with a better bt reception as result.

    I thought that might change with zb, but doesn’t.

    As I read: “Remember, you will not be able to reconnect to the device with the Telink flashed since there is no Bluetooth firmware installed anymore.”
    – I might not be able to play around with transmit power, if this would be possibile anyway.

    Q.: How can I have a better range with zb, without using a zb Bulb as relay?

    1. Zigbee is a mesh protocol, it benefits greatly from routers being added to the network (switches, bulbs, mains connected devices)
      Range is reduced significantly when you don’t have something to relay traffic to the coordinator.

      1. which brings me to…
        I can’t edit the zb device anyway, right? Get rid of those silly smiling faces.

  39. Hello, I also have a problem with uploading the firmware in the second step. I managed to update the transitional firmware. However, when trying to upload z03mmc.bin, I receive the following message:
    20:30:00: Connecting to: ATC_C070A1
    20:30:08: NetworkError: Connection Error: Connection attempt failed.
    20:30:08: Reconnect 1 from 5
    20:30:10: Hardware Revision String: B1.5
    20:30:10: Software Revision String: V4.4
    20:30:10: Firmware Revision String: github.com/pvvx
    20:30:10: Detected custom Firmware
    20:30:10: Hardware Version: LYWSD03MMC B1.5, Software Version: 4.4, Sensor: SHTC3 (SHTV3)
    20:30:10: Custom config HEX string: 55051000002804a931318ab4
    20:30:44: File: z03mmc.bin
    20:30:44: File size: 130004 bytes
    20:30:44: Count: 8126
    20:31:11: Start DFU
    20:31:17: Update error: NotSupportedError: GATT operation failed for unknown reason.
    20:31:17: Disconnected.

    Similarly, when trying to return to the original firmware:
    21:09:21: Connecting to: ATC_C070A1
    21:09:24: Hardware Revision String: B1.5
    21:09:24: Software Revision String: V4.4
    21:09:24: Firmware Revision String: github.com/pvvx
    21:09:24: Detected custom Firmware
    21:09:24: Hardware Version: LYWSD03MMC B1.5, Software Version: 4.4, Sensor: SHTC3 (SHTV3)
    21:09:24: Custom config HEX string: 55051000002804a931318ab4
    21:09:27: Load firmware file ‘Original_OTA_Xiaomi_LYWSD03MMC_v1.0.0_0130.bin’…
    21:09:28: File: Original_OTA_Xiaomi_LYWSD03MMC_v1.0.0_0130.bin
    21:09:28: File size: 92868 bytes
    21:09:28: Count: 5805
    21:09:35: Start DFU
    21:09:42: Update error: NotSupportedError: GATT operation failed for unknown reason.
    21:09:42: Disconnected.

    I tried restarting the device, using the website https://devbis.github.io/telink-zigbee/ you can pair the sensor and read its data. Can something be done about it? Unfortunately, this seems to be a standard issue for HW B1.5.

  40. Anyone has successfully converted back from Zigbee to BT via OTA?
    I couldn’t via zigbee2MQTT OTA feature as it’s mentioned in this article

  41. I’ve been using the pvvx firmware because the reporting interval allows me to use humidity based automation in Home Assistant for bathroom fan automation.

    What are the reporting intervals like with the Zigbee firmware? Are they based on time or changes in temperature and/or humidity?

      1. Would it be possible to expose reporting interval as a configurable parameter? I would prefer a less frequent report in favor of longer battery life. To me it looks like with the current setup it will hardly last for three months.

  42. So I’ve bricked my device in the first step, using the transitional firmware ATC_ota_40000.bin. Any idea what went wrong? Log below:

    21:53:27: Searching for devices
    21:53:59: Get Advertising MAC (Web Experimental Features!)
    21:53:59: Connecting to: LYWSD03MMC
    21:54:11: MiVer5, DevID: 0x055B-LYWSD03MMC, FnCnt: 1, CtrID: 0x5830 Not bound, Standard certification, MAC: A4C13804DA34, Capability: 0x28 – front binding, IO: 0x0001
    21:54:21: Hardware Revision String: B1.4
    21:54:21: Software Revision String: 0130
    21:54:21: Firmware Revision String: 1.0.0_0130
    21:54:21: Detected Mi device
    21:54:21: Connected
    21:54:41: Activating now, please wait…
    21:54:45: Registration successful
    21:54:45: Send Login, please wait…
    21:54:45: Received device infos are correct
    21:54:45: Login successful
    21:56:26: File: ATC_ota_40000.bin
    21:56:26: File size: 82628 bytes
    21:56:26: Count: 5165
    21:56:55: Start DFU
    21:58:17: Update done after 80.452 seconds
    21:58:23: Disconnected.

      1. Unfortunately not, and the device’s display is also blank. Removing and reinserting the battery didn’t help either.

      2. One more update: during the UART flashing I realize the PCB says HW:B2.0 – could it be it’s not supported by the firmware yet?

        cheers
        Mike

    1. Sorry, overlooked your comment and started my own just below – I’m in the very same situation. Already tried with 3 out of 8 devices and all of them bricked the same way…

      Let’s see if we can help the maintainer to find and resolve the root cause.

      Mike

    2. OK, so I managed to move forward flashing the z03mmc.bin fw using UART.
      The device is unbricked, I can put it into pairing mode shorting Reset and GND for 3s, Z2M will detect a new device, but it’s unsupported and interview failed.

      I’m running z2m 1.34.0 commit: aae7312 and tried even setting up the external converter but it didn’t have any impact, stil Unsupported.

      Mike

  43. I completed the process on 3 devices. First one connected to zigbee2mqtt BUT the other two refuses to pair (removed and reinstalled new batteries, 3 seconds short in reset-gnd several times…) My zigbe2mqtt is old, but I managed to make it works with the first device… What can be the problem with the other two devices?

    1. It’s hard to tell without looking at the logs. Can you pair to the sensors via Bluetooth?
      Is it possible the flashing did not complete?

    2. I have the exact same problem. I have three sensors that I successfully flashed with the zigbee firmware. I managed to pair them with ZHA with no issues. They were working fine but I wanted to try them out with Zigbee2mqtt as well, so I removed them from ZHA, and did a reset (connect Reset and Gnd on the back for 3 seconds) on two of them. I am no longer able to pair them. Neither with zigbee2mqtt nor with ZHA. The third one that I did not reset is okay. It pairs well with ZHA again. I suspect that the reset caused the other two devices to not connect to my zigbee coordinator anymore. 🙁

    3. I am facing the same problem
      3 devices, one can be paired with Z2M – the other two don’t want to.
      I have tried everything. new battery, fixed power supply with 3.3V, older firmware 1.1.6 instead of 1.1.8 … 7 seconds shorted RST and GND … (the three dashes appear correctly), all without success.
      The thermometers are 30cm away from the coordinator – so it can’t be the distance either.
      Where can you view logs to see if anything is happening? Nothing happens in the Z2M log (debug)…as if the thermometers would not even go into pairing mode

  44. Hi, Thanks for the awesome writeup!
    I can’t find the cluster for toggling the display from C to F in ZHA. Can this be done in the UI?

  45. If by any bad luck I flashed it with an wrong firmware, is there any chance to revert it back using usb ttl? I have to mention that the sensor is stuck on black screen, nothing is showing on display

  46. I stumbled on this page just a few days ago and I have to say you and devbis have done an impressive job!
    I recently purchased a SwitchBot indoor/outdoor thermo-hygrometer (W3400010) as I couldn’t find a relatively cheap but good quality outdoor sensor and I hope one day you will dig in converting this product to Zigbee (it uses a REALTEK RTL8762CMF that support Zigbee).

  47. Hello Buddies, I flashed succesfully 3 on 4 LYWSD03MMC without problem.
    For the first I tried, i flashed a bad zigbee file 🙁 the one for mho-c122, my LYWSD03MMC works perfectly but I want the original zigbee file, how can I proceed to flash the correct one ?
    Thank you for your ansewer

  48. Battery life is horrible though, flashed with transitional firmware into latest available Zigbee (…117.bin) everything works and every sensor is picked up by ZHA but all 8 sensors drained their batteries in 7-8 days. I installed new batteries just to confirm, reset and re-paired all sensors and now they´re all at around 40% after a few days.

    Re-flashing or going back to BLE does not seem to be working on ZHA?

    1. It shouldn’t be such a big difference in battery life.
      Are you sure they are drained, or you are just going by the percentages reported?
      Because those are wildly inaccurate.

  49. I was wondering if I can change any settings, like on custom BLE firmware? Does it persist the settings separately, so that I could change settings on BLE and then flash to Zigbee and keep the settings?

  50. I am trying to flash back to BLE via zigbee2mqtt OTA, but struggling to get sensor into zigbee receiving mode. I managed to create local OTA index with a proper file and zigbee2mqtt now shows that update is available for this sensor. However, when I click “update” I always get timeout. I tried shorting the pins for 3 seconds and reinstalling the battery, to no avail. How can I see that the sensor has actually entered the mode it is supposed to be for Zigbee OTA?

  51. Hey thanks for the instructions.

    I have successfully flashed 5 x LYWSD03MMC.

    Now I still have a MJWSD05MMC here and am trying to flash it.

    Connecting still works, but when I click on “Activate”, I get NotSupportedError: GATT operation failed for unknow reason.

    Any Ideas?

    1. It’s still not supported, don’t flash it you will brick it and you will have to restore it by soldering an UART adapter.

        1. That section lists supported devices for the original pvvx BLE firmware, I’ve edited the article to make it more clear.
          Sorry for the confusion.

Comments are closed.