Xiaomi LYWSD03MMC Zigbee Firmware
This repository contains the Zigbee firmware for Xiaomi LYWSD03MMC Bluetooth temperature and humidity sensor.
The LYWSD03MMC is a Bluetooth temperature and humidity sensor that can be integrated into a Zigbee network using this firmware. This repository hosts the code and related resources to flash the device and make it compatible with Zigbee networks.
Full-featured firmware to convert Xiaomi LYWSD03MC device with default ZCL battery, temperature and relative humidity clusters
Display support for known revisions
OTA support in firmware and binaries in ZCL format for update
Flashable over-the-air from custom ATC firmware https://devbis.github.io/telink-zigbee/
Flashable over SWS-UART interface using one of:
You can download binaries from releases: https://github.com/devbis/z03mmc/releases
You may also want to compile it yourself, the instruction is below.
If OTA flasher displays this error, the only possible way to write a custom firmware (Zigbee or custom BLE) is to use USB-UART method. To get more info, please visit https://github.com/atc1441/ATC_MiThermometer/issues/298
To flash a new firmware via an standard USB to UART adapter, simply connect the Thermometer as seen in the picture Mi_SWS_Connection.jpg to the USB to UART converter and run the TLSR825xComFlasher.py tool.
Example: python3 TLSR825xComFlasher.py -p COM3 wf 0 z03mmc.bin
Example: python3 TLSR825xComFlasher.py -p /dev/ttyUSB0 wf 0 z03mmc.bin
In case if the SWS pin is used by the firmware, try this sequence:
Power off the sensor
python3 TLSR825xComFlasher.py -p <YOUR_COM_PORT> -t5000 wf 0 z03mmc.bin
Now you have 5 seconds to power on the sensor
In case the chip has not started being flashed, run python3 TLSR825xComFlasher.py -p <YOUR_COM_PORT> wf 0 z03mmc.bin
without the timeout again.
If the flashing fails reduce baud rate down to 340000 or increase timeouts in the script.
If you flashed the module but the screen is remaining blank, try python3 TLSR825xComFlasher.py -p <YOUR_COM_PORT> ea
to erase all flash and then write the firmware again.
The UART flasher software uses the tool from https://github.com/pvvx/ATC_MiThermometer. Thanks to pvvx for the awesome work on this!
The already flashed firmware supports OTA zigbee upgrade via standard flow. See zigbee2mqtt, ZHA, and HOMEd documentation for details.
Migrated device is fully compatible with ZCL standards for zigbee devices. It reuses standard clusters where possible for Zigbee 3.0.
And to fine tune display and values, additional attributes are implemented:
You can switch to displaying temperature in degrees Fahrenheit by "pressing" reset-gnd for 1 second. Or write 1 to 0x0204/0x0000 (Thermostat User Interface Configuration/TemperatureDisplayMode)
Clone TC32 toolchain according to your host OS:
git clone https://github.com/devbis/tc32.git -b linux
git clone https://github.com/devbis/tc32.git -b macos
git clone https://github.com/devbis/tc32.git -b windows
Clone this repository and SDK:
git clone https://github.com/devbis/z03mmc.git
git clone https://github.com/devbis/tl_zigbee_sdk.git -b 3.6.8.6 --depth 1
cd z03mmc
Configure and build:
cmake -B build -DSDK_PREFIX=$(pwd)/../tl_zigbee_sdk -DTOOLCHAIN_PREFIX=$(pwd)/../tc32 -DMANUFACTURER_CODE=0x1141
cmake --build build --target z03mmc.zigbee
Firmware binary is located at build/src/z03mmc.bin
The binary with OTA header is at the same folder, ending with z03mmc.zigbee
z03mmc is based on the original work of @pvvx, and @atc1441, who developed the initial firmware versions for bluetooth-capable device.
This project is licensed under the GNU General Public License 3.0 or later - see the LICENSE.txt file for details.