Xiaomiβs temperature and humidity sensors are among the most popular smart home devices due to their accuracy, compactness and integration with the Mi Home ecosystem. However, standard firmware often limits functionality: there is no support for local servers (such as Home Assistant), data is transmitted only to the Xiaomi cloud, and updates come with a delay. Custom software firmware solves these problems, but the process requires accuracy β an error can turn the sensor into a βbrickβ.
In this article, we will analyze all methods of firmware for models LYWSD03MMC, LYWSD02, CGG1 and others: from official updates through Mi Home to installing alternative firmware like ATC MiThermometer or Custom Firmware for Xiaomi Devices (CFW). We're going to focus on bypassing downgrade protection, which blocks the installation of older versions of software on new devices. If you've never flashed through sensors, don't worry: the instructions are tailored for beginners, with explanations of each step.
1.What Xiaomi sensors can be flashed and why it is necessary
Not all Xiaomi sensors support custom firmware, and here is a list of models for which alternative software is available, and the key reasons for their firmware:
- πΉ LYWSD03MMC (The most popular firmware adds support for Bluetooth Low Energy (BLE) Directly connect to Home Assistant or ESPHome without the cloud.
- πΉ LYWSD02 β fixes the sensor βfalling asleepβ bug after 10 minutes, improves measurement accuracy.
- πΉ CGG1 (sensor with display β unlocks hidden calibration settings and increases the frequency of data updates.
- πΉ MJWSD05MMC β add-on MQTT Integration with any smart home system.
The main reasons for firmware:
- π‘ Local management β data is transferred directly to your server, not to the Xiaomi cloud (important for privacy).
- β‘ Increased polling frequency β standard sensors send data every 10 minutes, custom firmware allows you to reduce the interval to 1 second.
- π§ Additional features β for example, calibration of readings, logging data on a microSD (for some models).
- π« Bypassing regional restrictions β some sensors block work outside China without firmware.
β οΈ Attention: Xiaomi sensor firmware with Telink chip TLSR8266 (for example, LYWSD03MMC) It requires a mandatory turn off of the protection from writing (write protection), without which any attempt to flash the device will end up with a Flash write error.
2. Preparation for firmware: what will be needed
Before you start, gather everything you need, and the absence of at least one component can interrupt the process and "brick" the sensor.
- π₯οΈ Computer on Windows 10/11 Linux (MacOS will require additional drivers).
- π USB-TTL base-mount CP2102 or FT232RL (for example, HC-05 Important: Adapter must support 3.3V β 5V burns the sensor.
- π§ soldering or tweezers β to connect the adapter to the sensor contacts (you need skills with small details).
- π Firmware β official (from the Xiaomi site) or custom (for example, from a repository) ATC MiThermometer).
- π οΈ Programs: Flash Tool (for example, TLSR Flash Tool for Telink chips. Python 3.x (for firmware scripts. Drivers for USB-TTL adapter.
Also prepare the workplace:
- π‘ Good lighting β contacts on the sensor board are miniature.
- π Uninterruptible power supply β if the computer turns off during firmware, the sensor may fail.
- π± Spare smartphone with the Mi Home application - to check the performance after firmware.
βοΈ Checklist before firmware
3. Step-by-step instruction: firmware through USB-TTL
This is the most reliable method, but it requires a physical connection to the sensor, and the instructions are universal for most models on a Telink chip. TLSR8266.
Step 1: Connection USB-TTL adapter
Disassemble the sensor case (take care of the latches with a flat screwdriver). GND, TX, RX and 3.3V. Connect them to the adapter according to the scheme:
Sensor β Adapter
GND β GND
TX β RX
RX β TX
3.3V β 3.3V (VCC)Important: Don't confuse TX and RX β If there's no marking on the board, use the multimeter to check the voltage.
Step 2: Disabling protection from the record
Telink chips are locked from the recording by default to unlock:
- Connect the sensor to the adapter (no power!).
- Close your contacts. P25 (or GPIO25) land (GND) tweezer.
- Serve the food (3.3V) β sensor will go into firmware mode.
Step 3: Firmware through TLSR Flash Tool
Download and launch. TLSR Flash Tool (e.g., from here). Specify in the settings:
- Port port (COMX) β Check in Device Manager.
- The speed (Baud Rate) is 115200.
- Firmware file (.bin).
Press Start and wait until it is completed (usually 1-2 minutes). If the process is stuck on Erasing Flash, check the connection. P25 ce GND.
What to do if the sensor is not detected?
Step 4: Checking the Results
After the firmware:
- Disconnect the sensor from the adapter.
- Insert the battery and wait for the switch on (can take up to 30 seconds).
- Connect the sensor to the Mi Home or check it through Home Assistant (if you have been through custom software).
β οΈ Note: If the sensor doesn't turn on after the firmware is flashed or flashes red, it's likely that the firmware is damaged. Try flashing the original Xiaomi software (download here).
4. Firmware without soldering: alternative methods
Not everyone is comfortable soldering or disassembling the sensor. Fortunately, there are ways to update the firmware without physical intervention β but they don't work for all models.
Method 1: Update via Mi Home (official method)
If you only need the latest official firmware:
- Open the Mi Home app.
- Go to the sensor settings (Device) β Settings β Firmware update).
- If the update is available, click Update.
Limitations: Xiaomi often blocks downgrade (installation of the old version), and new firmware can remove useful features (for example, local protocol).
Method 2: Firmware through the air (OTA) custom-based
Some custom firmware (for example, ATC MiThermometer supports Bluetooth update:
- Download. APK-file ATC MiThermometer Tool.
- Connect to the sensor via Bluetooth.
- Select the firmware file (.bin) and press Start. OTA.
Advantage: you don't have to disassemble the sensor, disadvantage: it doesn't work on all models (e.g., the sensor doesn't work on all models, CGG1 supportive OTA).
| Firmware method | Supported models | Difficulty | Risk of "bricking" |
|---|---|---|---|
| USB-TTL (ration) | LYWSD03MMC, LYWSD02, MJWSD05MMC | ββββ | Medium (in case of errors) |
| Mi Home (officially) | All models. | β | Low. |
| OTA (Bluetooth) | LYWSD03MMC (caste-only) | ββ | Low. |
| ESPHome (flashing) | LYWSD03MMC (modified) | βββββ | High-pitched |
π‘
If the sensor after firmware is not determined in Mi Home, but works on Bluetooth, try resetting it to factory settings. To do this, hold the reset button (if any) for 10 seconds or use the command through the terminal: AT+RESET (firmware).
5. Common mistakes and their solutions
Even with the correct following of the instructions, problems can arise, and below is a list of common errors and ways to fix them.
- π΄ Error: Flash Write Error Reason: Not disabled P25 (Solution: Close the lock. P25 on GND and repeat the firmware.
- π΄ Sensor does not turn on after firmware Reason: Wrong firmware (for example, from another model).Solution: Sweat the original software from Xiaomi.
- π΄ Error: Device not found Reason: Wrong port COM Solution: Check the adapter connection and reinstall the drivers.
- π΄ Sensor gives incorrect data Reason: Damaged calibration data Solution: Restore factory firmware or calibrate the sensor manually (if the firmware supports).
If the sensor has stopped responding to any action, try emergency recovery:
- Connect. USB-TTL adapter.
- Shut up. P25 on GND.
- Serve power and immediately start the firmware of the original software.
π‘
The most common mistake of beginners is trying to flash the sensor without turning off the protection (P25). Always check that the contact is closed to the ground before starting the firmware!
6. firmware for integration with Home Assistant
If your goal is to connect the sensor to Home Assistant, custom firmware ATC MiThermometer or CFW β These firmwares add Bluetooth Low Energy support (BLE), This allows you to read data without the cloud Xiaomi.
Set up Home Assistant
After the firmware:
- Add Bluetooth integration to Home Assistant (if not already added).
- Install the ESPHome supplement or BLE Monitor.
- In the configuration.yaml file, add:
sensor:
- platform: miflora
mac: "XX:XX:XX:XX:XX:XX" # MAC- sensor address
temperature:
name: "Temperature"
humidity:
name: "Humidity"
battery:
name: "Battery"Replace. XX:XX:XX:XX:XX:XX real MAC-The address of your sensor (can be found via nRF Connect or Bluetooth Scanner).
Advantages of custom firmware for Home Assistant
- π Data is updated every second (instead of 10 minutes in standard firmware).
- π No dependence on the Xiaomi cloud β work even when the Internet is disconnected.
- π οΈ The ability to calibrate readings directly from the Home Assistant interface.
7.How to get back the original Xiaomi firmware
If custom software is unstable or you want to return the sensor to its original state, run the official firmware.
- Download the original software for your model from the official website or from the firmware repository.
- Connect the sensor to USB-TTL Adapter (donβt forget to close the door) P25 on GND).
- Launch it. TLSR Flash Tool and select the downloaded.bin file.
- Press Start and wait until it is completed.
Once the firmware is in place, the sensor will return to factory settings to reconnect it to the Mi Home:
- Remove the device from the app.
- Press the reset button on the sensor (if any) or remove/insert the battery.
- Add the sensor again through Add the device β Temperature and humidity sensor.
β οΈ Note: Some new models (e.g, LYWSD03MMC firmware v2.0.0_0040 If you try to flash the old version, you will see a Version downgrade not allowed error, in which case you will have to use a patched firmware with bypass protection (see forums). 4PDA or GitHub).