Converting with tuya-cloudcutter
Warning
This guide is outdated.
See tuya-cloudcutter and UnTuyaOS3 for up-to-date instructions on flashing custom firmware to supported devices.
Tip
See the Cloudcutter video guide for a complete tutorial on flashing with Cloudcutter and installing LibreTiny-ESPHome. Includes Home Assistant Add-On setup.
Note
This currently applies to BK7231T and BK7231N only. tuya-cloudcutter can't be used for other chips.
tuya-cloudcutter is a tool that disconnects IoT devices from the Tuya cloud, while also allowing remote firmware flashing. This means you can flash ESPHome without even disassembling it.
If your device doesn't have a profile yet, it will probably not work. You can contribute by taking a device dump and posting it on cloudcutter's issues page.
Instructions
Preparation
- Get a laptop (or a PC with Wi-Fi) with Linux and Docker installed. This was tested on Ubuntu 20.04, but you should be able to use another Debian-based distribution with NetworkManager.
- To install Docker, run
sudo apt-get install docker.io. When it completes, runsudo adduser <your username> dockerand reboot the machine. - This was also successfully performed on a VirtualBox VM, with a USB Wi-Fi adapter redirected to the VM.
- To install Docker, run
- Install
git, if you haven't already (sudo apt-get install git). git clone https://github.com/tuya-cloudcutter/tuya-cloudcutter
Firmware building
- Compile ESPHome, or your custom firmware based on LibreTiny.
- Get the firmware binary, named
bk7231x_app.ota.ug.binfrom the build directory (.pio/build/<board>/or.esphome/build/<board>/.pioenvs/<board>/). - Put it in the
custom-firmwaredirectory of tuya-cloudcutter.
Pairing and flashing
- Run
./tuya-cloudcutter.shfrom the cloudcutter directory. - Answer questions about the desired firmware file, the device vendor and profile.
- Put the device to AP mode: (**)
- Bulbs (devices without buttons) usually need to be power-cycled a few times, until they start blinking slowly.
- Switches, plugs, relays (devices with buttons) usually enable AP after pressing the button for a few seconds.
- If the device (bulb or switch LED) is blinking quickly (~2 times per second), do the procedure again.
- Cloudcutter will scan for APs, connect to the device and send a payload to it.
- The device will most likely hang (not respond). Reboot it again to AP mode (just like in step 9).
- Cloudcutter will scan for APs again, configure the device to talk to it, then begin the OTA update.
- After around 30 seconds, the device will boot new firmware 👏
** Use a smartphone with the Wi-Fi screen open and scanning, so that you can see if AP mode got enabled.