Wifi Programming Neo PowerPlugs with tasmota firmware by using tuya-convert

March 9, 2022   

TL;DR:

I succesfully programmed my Neo Wifi PowerPlugs with tasmota firmware by using tuya-convert over WIFI ( Without connecting UART )

The trick was to use an old ( buster ) debian version on the raspberry pi 4b - 4G.

Introduction

Below is a Neo Wifi PowerPlug (Neo PP) from China. It is manufactured by Szneo ( https://www.szneo.com/ )

It has an ESP8266 based Wifi Module inside. This module runs a proprietary Firmware, which is designed & developed by TUYA ( https://www.tuya.com/ )

This proprietary firmware communicates via Tuya Cloud and lets users to control such home automation devices over internet ( both local and remote )

However, this requires you to install Tuya mobile app on your phone and there is no way to send command to your tuya device in a simple or reliable way.

Note: there are such projects: https://github.com/TuyaAPI/cli but I couldn’t be able to register / attach my devices.

I wanted to control such devices with command line on my Linux desktop computer.

The solution is: Tasmota Firmware ( https://tasmota.github.io/docs/ )

Tasmota is an open source firmware for ESP based devices. I will not go into more details since it already has a great documentation.

For an alternative, see ESPurna.

Problem-1: No Uart Exposed outside

In order to install Tasmota to an ESP based device, you will usually need a UART connection.

Neo PP has an extremely compact mechanical design. There is no UART exposed to outside and it is very hard to reach its UART pins for programming Tasmota Firmware.

I broke two Neo PP device while trying to open its cover and solder its pins.

However, there were some people out there who managed to do it: https://www.youtube.com/watch?v=CV8Y61gEQpQ&t=2s

Solution to Problem-1

To solve this issure, there is a great tool called tuya-convert: https://github.com/ct-Open-Source/tuya-convert

Tuya-convert works as a man-in-the-middle, and fakes OTA upgrade of the system, and installs tasmota ( or espurna fw binary ) to your ESP based device without soldering cables

Problem-2: tuya-convert timeouts while installing tasmota

I used tuya-convert for about a year ago and it was working fine. After a year, I wanted to use it again to program Neo Powerplugs and unfortunately, it never worked. So I decided to open this issue: https://github.com/ct-Open-Source/tuya-convert/issues/1022

Solution to Problem-2

Today I got a great feedback from @Kintel and he reported that using an old version ( such as Debian 10.10 - Buster ) with a RaspberryPi4 , it worked fine.

Then I decided to give a try.

Note: I forgot that default images mostly doesn’t enable serial terminal , so I lost big time to understand why downloaded images were not working :( My bad.

Prerequisities ( What you will need )

First, read this: https://github.com/ct-Open-Source/tuya-convert/blob/master/README.md

  1. An RPi with a built-in Wifi ( I had a Rpi4b-4Gbyte model)

  1. An SDcard Writer

Easy way for the reader

I dumped my SDcard and put it here for the community: https://drive.google.com/file/d/1kfnwF5ofcHy8CO_yRMWNFfuxvwjJzHAQ/view?usp=sharing

username : pi password : 1 ( single character )

So you can just burn this image ( don’t forget, it is zstd compressed ) to an SDcard, and insert to your Rpi4b. On the first boot, give some time to it, until it resizes rootfs.

Then go to /root/tuya-convert directory, and just execute ./start-flash.sh

Steps to reproduce above image

  1. I downloaded this image: https://downloads.raspberrypi.org/raspios_arm64/images/raspios_arm64-2020-05-28/2020-05-27-raspios-buster-arm64.zip

  2. write it to an sdcard

  3. Connect your Rpi4b-4g to internet with ethernet cable ( we will use built-in WIFI of the Rpi, so you can’t use wifi )

  4. Let it boot. Connect to a monitor with HDMI, so that you can setup SSH to it ( by simply creating a file named “ssh” - with content doesn’t matter - in the /boot directory or partition )

  5. sudo install vim git

  6. git clone https://github.com/ct-Open-Source/tuya-convert.git && cd tuya-convert && sudo su

  7. run ./install-prereq.sh

  8. run ./start-flash.sh

  9. It will ask you to kill dnsmasq and mosquitto ( Say yes )

  10. connect your mobile phone to “vtrust-flash” SSID. Don’t forget to press tick on the top right corner if appears.

  11. press and hold the button on the Neo Powerplug for 5 seconds, so that its RED led will blink

  12. press enter on the screen and wait for about 2 minute

  13. It will find the device and install intermedia firmware

  14. Then it will ask you if you want to install tasmota to it or not

  15. After installation, you need to connect to Neo PowerPlug with its wifi. You can find it on your mobile wifi search

  16. After you connect to Neo Wifi, open 192.168.4.1 on your mobile phone browser.

  17. Enter SSID (2.4Ghz one ) of your home and its password

  18. Save. It will restart. Your phone will disconnect from it, and will automatically connect to your home network

  19. Your Neo PP will connect to your Home WIFI and will get an IP address given by your DHCP server. You need to find this IP by yourself ( There are many ways to find it )

  20. Your Neo with Tasmota is ready to use. You can open its webpage via its ip address and trigger the output ( ON / OFF ) or setup a timer to shutdown power at predefined time.

I am sharing screenshots of this process below.

Here are some screenshots:



comments powered by Disqus