Linux

How To Easily Flash Tuya Devices Over The Air Using Linux

Hello Smart Home tek lover! If you have landed here in this little corner of the internet, I will assume you already know what Tasmota is and why it is a great idea to get your devices out of the cloud.

In this particular guide I aim to show you the quick and easy way to flash your Tuya devices over the air with Ubuntu. Yep, put that soldering iron away, you’re not gonna need it!

Flashing your device over the air is effectively an exploit of the Tuya device. If you are not comfortable with the process or are unsure, but can access the circuit, you may prefer to flash it over a wired connection.

Requirements

  • Ubuntu, at the time of writing I am using 18.04.03
  • Wifi Adapter that supports AP mode (I’m using a recycled 2009 MacBook Pro with stock WiFi adapter)
  • Another WiFi device, a mobile phone will do just fine
Disclaimer: this process has the potential to brick your device, therefore proceed at your own risk. Probably not though, you'll be fine, probably…

Prerequisites

Firstly we need to go to the Terminal and make sure everything is up-to-date.

Update Linux

Open the Terminal and enter the following, if you are prompted for your password then go ahead and enter it. Don’t forget that you will not see the password characters!

sudo apt-get update
sudo apt-get upgrade

You may be prompted to perform some updates, simply enter ‘y’ and allow the updates to install. Once complete you will be returned to the command prompt.

Install Git

Next we will need to install Git in order to download and install Tuya-Convert. Go ahead and enter the following command to install it.

sudo apt-get install git

Install Tuya-Convert

Next, you will need to navigate to the location where you wish to install Tuya-Convert. If you are unsure then I would recommend the user home directory, you can navigate there by typing the following.

cd ~

Now we need to download Tuya-Convert by cloning the Git repository, simply enter the following command.

git clone https://github.com/ct-Open-Source/tuya-convert

Once the Tuya-Convert repository has been cloned to your machine, we need to install the prerequisites. There is an installation script provided that makes it very easy! Simply switch to the Tuya-Convert directory and run the script by typing the following commands.

cd tuya-convert
sudo ./install_prereq.sh

Flashing Your Device

Now that everything is installed, we can begin the flashing process. To start Tuya-Convert, simply type the following command whilst in the Tuya-Convert directory.

sudo ./start_flash.sh

Stop services

It is likely that your system will request that you stop some services in order for the process to work. Simply enter ‘y’ for each one and after we finish flashing we can just reboot to restart these services.

If everything is successful, you will be presented with the 3 step Tuya-Convert instructions. Before you jump in, I would recommend that we perform number 2 before number 1 and I will explain why in a moment.

  1. Connect any other device (a smartphone or something) to the WIFI vtrust-flash
    This step is IMPORTANT otherwise the smartconfig may not work!
  2. Put your IoT device in autoconfig/smartconfig/pairing mode (LED will blink fast). This is usually done by pressing and holding the primary button of the device
    Make sure nothing else is plugged into your IoT device while attempting to flash.
  3. Press ENTER to continue

Put your device in pairing mode

Next we will need to put our Tuya device in to ‘EZ pairing mode.’ This step is specific to your device, therefore you should consult the manual for your specific device. Please note that the device must be in EZ mode and not in AP mode.

Connect to the vtrust flash

The next step is important, remember the additional WiFi device I mentioned earlier? We are going to need it for this step, a mobile phone will do just fine. Now that Tuya-Convert is running, it will have created a new WiFi network called ‘vtrust-flash’ and we need to connect our mobile phone to this network in order for the flashing to work. In my experience the phone does not stay connected for too long, therefore I recommend connecting it to vtrust-flash after you put your device into EZ pairing mode.

Simply open up WiFi settings on your phone, locate vtrust-flash and connect to it as you would with any WiFi network. If you are prompted for a password, it should be ‘flashmeifyoucan‘ and following the connection you may be presented with a login-style pop-up, the type you get on public WiFi networks. Note that nothing needs to be done here, once you get this pop-up you are good to go. Just make sure you don’t close this pop-up or lock your phone, to ensure you remain connected to vtrust-flash.

Flash the cloud away!

Now we are ready to flash! Press ENTER and Tuya-Convert will begin to look for the device. Patience is key here, it can take a while. If the operation times out with the “Device did not appear with the intermediate firmware” error, just power cycle your device and repeat. This happened to me with the first Tuya device that I tried to flash and power cycling it fixed the issue.

When your device is successfully recognised, it will perform a firmware backup. Finally when completed you will be presented with the option for the firmware you wish to flash. You can choose any of the firmware options, but if you do not specifically want to install a different firmware then I would recommend starting with Tasmota.

You will be presented with a final confirmation, at this stage it is the point of no return, you have been warned! Enter ‘y’ and wait for the flashing to complete.

Congratulations! You have now taken your Tuya device out of the cloud and successfully installed Tasmota. Now you are ready to configure Tasmota, so head on over to the Tasmota configuration guide.

If you are unable to get the over the air method to work with your device, you can have a go at flashing it with a wired connection.

Congratulations! You have now taken your Tuya device out of the cloud. I hope that this tutorial helped you, please let me know what you thought in the comments. Also why not check out some more of my awesome Tasmota tutorials!

Bitmoji Image

Join the discussion

  1. Will

    when I enter sudo ./start_flash.sh I get the following:

    Checking for network interface wlan0… Not found!
    Please edit WLAN in config.txt to one of: enp6s0, lo, wlp2s0
    ======================================================
    Cleaning up…
    No screen session found.
    No screen session found.
    No screen session found.
    No screen session found.
    Closing AP
    Exiting…

Leave a Reply

Your email address will not be published. Required fields are marked *

back to top