Get Tuya and Xiaomi OTA url
Introduction
This guide explains how to obtain firmware update files for Aqara / Xiaomi and Tuya devices.
The scope is to mirror the files on zigbee-OTA, so Zigbee2MQTT users can update their devices without the proprietary hub.
If you know there is an update available, but you are unable to follow the steps below, please open an issue to request the OTA file.
Notes
A lot of these devices share update identifiers ("manufacturer code" and "image type").
To prevent conflicts, we must lock each update to the unique "model id" or "manufacturer name".
Some Tuya devices (TS0601, datapoint-driven) have 2 MCUs: a Tuya module running the main device logic, and a Zigbee module for networking. Currently, only the Zigbee module can be updated with Zigbee2MQTT.
Aqara updates sometimes have mistakes in the OTA files. This was seen on some switches:
The update has a wrong "file version", and Zigbee2MQTT thinks it's a downgrade. More info in this thread.
New methods
Aqara
Tools and information are available in these repositories:
Tuya
This method involves reading the logs from a rooted gateway.
Prerequisites:
- Mobile device with normal Tuya app
- Tuya device that's not updated yet
- Tuya gateway
- Root access on the gateway (See this guide for LIDL model)
Steps:
- Make sure you can access the console on the gateway OS (via serial or ssh)
- Connect your device to the gateway (normally, with mobile app)
- Save (screenshot) the release notes from the mobile app
- Start the update (it works even if the device is offline)
- Find the log. The current one is
/tmp/tuya.log.
(Previous logs are archived in/tuya/log_dir/) - Run this command to search for OTA links in the latest log:
grep fw_url /tmp/tuya.log
(Alternatively, copy the file on your PC via scp or tftp) - Try to access the obtained link. It should download the OTA file directly
- Replace the regional domain with the global address, and make sure it still works. Follow this example:
- before:
https://ota1-eu.lifeaiot.com:443/smart/firmware/upgrade/20240508/1715138033-tk_common_link_lp_OTA_1.0.13.bin - after:
https://images.tuyaeu.com/smart/firmware/upgrade/20240508/1715138033-tk_common_link_lp_OTA_1.0.13.bin
- before:
- Submit to zigbee-OTA (more info below)
- Enable OTA updates for your model (more info below)
Old method
This method involves intercepting the web traffic of the Android apps, using a proxy.
At least for Tuya, it's obsolete. They block proxies since a ~2020 app update.
It still works using the old app, but that version does not recognize newer devices, and therefore does not offer updates for them.
Additionally, using Android Studio to emulate ARM (and run the Tuya app) may not be possible anymore.
Prerequisites:
- Docker
- Tuya / Aqara gateway
- Device that's not updated yet
- Android Studio / spare Android phone
- Old Tuya / Aqara app
Step 1: running the proxy
Execute the following command: docker run --rm -it -p 8080:8080 mitmproxy/mitmproxy
Step 2: setup the Android emulator
(Or skip this step and take a spare Android phone)
Start Android Studio and create a new empty project:
- File -> New -> New Project...
- Phone and Tablet -> Empty Activity -> Next
- Finish
- Click on the emulator ("Pixel3a..." in the case below) -> Device Manager

- Click on the pencil icon of the device, under "Show Advanced Settings" change the "Internal Storage" to "2000". Click "Finish".
- Start the emulator by clicking the play icon.

- On the emulator, go to Settings -> Network & internet -> Internet -> AndroidWifi -> Edit (pencil right top) -> Advanced options -> Proxy -> Manual. For proxy host name fill in the IP address of your computer (e.g. 192.168.2.145), for port fill in 8080. Save.
- Open Chrome on the emulator, go to http://mitm.it and click on "Get mitmproxy-ca-cert.cer" under Android.
- Go to settings again, Security -> Encryption & credentials -> Install a certificate -> CA certificate -> Install anyway -> Drawer icon -> Downloads -> click on the downloaded certificate.
Step 3a: get the Tuya OTA url
- Download the Tuya app apk from this link (IMPORTANT: newer version don't work, tested with 3.12.6). Drag the downloaded apk on the emulator (which will install it).
- Open the Tuya Smart Life app in the emulator, log in with your account
- Make sure the Tuya bridge + the device you want to get the OTA of is already coupled to your account, this cannot be done from the emulator so use your phone for this. Make sure to use the same app on your phone, otherwise the device will not show up (e.g. for iOS use this, not this).
- Click on the device -> edit (pencil icon right top). Click "Check for Firmware Upgrade".
- If a firmware upgrade is available, quickly go back to the output of mitm (step 1), click on the latest request (yes you can click in the console window). This will show your the OTA url (see red box below).
- Tip: to go back to the overview of requests press the
Qkey on your keyboard.
- Tip: to go back to the overview of requests press the

Step 3b: get the Xiaomi OTA url
NOTE: This only works for native Aqara gateways which can be connected to the Aqara Home app (not the Xiaomi home app!)
- Works: ZHWG16LM/HE1-G0, ZHWG15LM, ZHWG12LM
- Doesn't work: ZNDMWG03LM, DGNWG02LM
- Download the Aqara home app apk from this link, tested with version 2.2.5. Drag the downloaded apk on the emulator (which will install it).
- Open the Aqara home app in the emulator, log in with your account
- Make sure the Aqara gateway + the device you want to get the OTA of is already coupled to your account, this cannot be done from the emulator so use your phone for this.
- Click on your device and check for a firmware upgrade.
- If a firmware upgrade is available, quickly go back to the output of mitm (step 1), click on the latest request (yes you can click in the console window). This will show your the OTA url (see screenshot of step 3a).
Submit the update to zigbee-OTA
- Fork zigbee-OTA and create a new branch
- Add the unaltered OTA file, with its original name, to
/images/Tuya/or/images/Lumi/ - Commit and create the pull request
- Add the respective metadata in the PR description. Copy this example and edit accordingly:
```json
{
"originalUrl": "https://images.tuyaeu.com/smart/firmware/upgrade/20240508/1715138033-tk_common_link_lp_OTA_1.0.13.bin",
"releaseNotes": "1. Support the first reporting command 0x2C;\r\n2. Supports packet delivery of DP data larger than 64 bytes;\r\n3. Support weather acquisition 0x3A 0x3B;\r\n4. Fix the problem of shortened communication distance;",
"modelId": "TS0601",
"manufacturerName": ["_TZE284_2se8efxh"]
}
```
If the update is already submitted, just edit index.json.
Find the respective entry and add your manufacturerName to the list.
Refer to zigbee-OTA readme for more details.
Enable OTA updates for your model
Zigbee2MQTT will not check for updates without OTA enabled in the device definition. You must:
- Fork zigbee-herdsman-converters and create a new branch
- Find your model
- Add
ota: trueto its definition, orextend: [lumiZigbeeOTA()] - Commit and create the pull request
