TUYA firmware
In the process of building your "smart home", it became necessary to remotely control power outlets.
Since I am still learning the basics of building a "smart home", the choice was made in favor of WiFi
devices. And after a little search, Avatto sockets were found. For a sample, I ordered one outlet, and
after some time of use, I decided to buy a few more.
Sockets were easily added to the TuyaSmart app TuyaSmartand further integrated into Home
Assistant and Alice. In general, the work of the sockets suited me and there are no complaints about
them in this regard. The only thing that bothered me was linking to Chinese servers.
After twirling the socket in my hands, I realized that I would not be able to carefully disassemble it.
After some time of searching on the Internet, I came across an article about parsing a similar outlet,
but I still had little desire to disassemble and solder it. So I continued my search and came across
theTUYA-CONVERT project, which allows Tuya devices to be flashed over the air to their own
firmware.
I tried it and it worked.
For this process, we will need:
•
A Linux device (I used a Raspberry Pi) with a WiFi adapter running in AP mode.
•
Second device: a smartphone / laptop or other device that can connect to the created AP point.
•
the device is a patient that we will "treat".
Preparatory work
If the Raspberry Pi is used as a working machineRaspberry Pi, then you must first disconnect from
the WiFi network on it.
sudo
killall
wpa_supplicant
#
edit
wpa_supplicant.
conf
sudo
nano
/etc/wpa_supplicant/wpa_supplicant. conf # comment out the network= {} block in the file# then
save the file and close it # reboot the Raspberry Pi sudo reboot
•
Next, downloadthe archivewith the project and unpack it, for example, to the /tmp folder.
# go to the /tmp cd /tmp folder # download the wget archive https://github.com/ct-OpenSource/tuya-convert/archive/master.zip # unzip the unzip master archive.zip # go to the cd tuyaconvert-master folder
•
Or, if git is installed, clone the repository.
# go to the /tmp cd /tmp folder # clone the git clone repository clonehttps://github.com/ct-OpenSource/tuya-convert.git # go to the project folder cd tuya-convert
•
Running the script install_prereq.sh to install the required dependencies.
./install_prereq.sh
Firmware update process
Moving on to the most interesting part:
•
running the script start_flash.sh and we agree with the risk warning.
./start_flash.sh
connect the second device (for example, a smartphone) to сети vtrustthe vtrust-flash WiFi
network;switch the flash device to pairing mode (hold down the button for 5 seconds or longer);
press Enter and wait.
We connect to the new network and go to the browser by ip192.168.4.1 to enter the settings page.
After that, specify the settings for connecting to your home WiFi network, save and restart.
After rebooting, we find ipthe device's ip in the settings of our router and open this ip in the browser.
Upload your firmware to the device and reboot.
Nuances and tips
•
The project website says that the firmware size should not exceed 512KB (did not check).
•
It took me several attempts to "connect" to the device (either the phone disconnects from the
network, or the device exits pairing mode).
•
At startup, the script disables the running dockerservice and web servers to access the
necessary ports.
•
Tuya periodically releases patches that interfere with the tuya-convert project. It is
recommended not to connect the flash device to TuyaSmartto avoid updating the native
firmware.
•
A list of compatible devices can be foundhere (http update) andhere (https update)