-
Notifications
You must be signed in to change notification settings - Fork 16
Flashing ESPHome via OTA
There's an excellent overall guide on the Tuya-Convert OTA process that was at ESPHome-configs.io (site appears to be dead, so I'm pointing to the Web Archive for now).
This guide uses the Docker image and a docker-compose
file to avoid needing to permanently install all the required dependencies. The non-Docker approach is very similar if you prefer that route.
You'll need the following:
- Linux computer with a wifi adapter. A RaspberryPi with a wifi dongle works fine, although for simplicity you'll want to either use it connected to a monitor, or have it connected to the network via ethernet. The Wifi adapter will act as a temporary access point, so you can't use it for primary connectivity.
- Secondary wifi device, such as a smartphone. You'll use this to connect to the temporary Wifi network, and it's necessary for the Tuya-Convert process!
- Docker installed
- docker-compose installed
git clone https://github.com/ct-Open-Source/tuya-convert
cd tuya-convert
Essentially we'll be following the Tuya-Convert Docker process. Building may take some time, depending on your system.
docker build -t tuya:latest .
Below is a modified docker-compose.yml
file from the one provided in the Tuya-Convert repo. This compose file adds single-file volumes for the .log
files, and for a so you can easily get the output if needed.
NOTE: You may need to chance the WLAN=wlan0
line of the configuration, if your Wifi device has a different name!
Save this file as docker-compose.yml
in the tuya-convert
folder:
version: '3'
services:
tuya:
image: tuya:latest
privileged: true
network_mode: "host"
environment:
- WLAN=wlan0 # Change if needed!
- AP=vtrust-flash
- GATEWAY=10.42.42.1
volumes:
# Default volume, to store backups of original firmware and logs
- ./data/backups:/usr/bin/tuya-convert/backups
# Single-file volume to pass in a compiled ESPHome binary placed in the /files folder
- ${PWD}/files/esphome.bin:/usr/bin/tuya-convert/files/esphome.bin
[To be expanded] For now, reference the old ESPHome-configs.io instructions for this step.
ota:
and ap:
(fallback hotspot) keys in your ESPHome config, until you're sure everything is working right.
After compiling, copy the firmware named firmware.bin
in the ESPHome build folder into the files
subfolder of your tuya-convert
folder, and rename it to esphome.bin
(so the docker-compose
file above can find it).
If not already in the directory, cd
into the root of your tuya-convert
folder, and then run the following:
docker-compose up -d
docker-compose exec tuya start
- At the prompt, confirm you want to continue (if you so choose).
- Tuya-Convert starts the various subprocesses.
- At the next prompt, Tuya-Convert notes to connect some other wireless device (phone, tablet, etc., type shouldn't matter) to the
vtrust-flash
Wifi network that should now be available. - Plug in the smart plug you want to convert, and put it in "pairing" mode per the appropriate method (usually holding a button for ~5 seconds).
- Hit ENTER. Tuya-Convert will begin to try and flash your compatible device.
- You should hopefully see progress, as Tuya-Convert flashes your device with an intermediate firmware.
- Upon an initial flash success, Tuya-Convert will ask what actual firmware you would like to flash to the device. Assuming you placed the ESPHome firmware in the
/files
folder, you should get three options: (0) return to stock, (1) flash esphome.bin, (2) flash espurna.bin, or (3) flash tasmota.bin. Type1
to select your ESPHome binary. - Tuya-Convert should proceed to flash your ESPHome compiled binary to your device! Assuming everything went correctly, it should reboot after the flash and attempt to connect as you specified.