Tutorial: Cheap, Tuya-based, Smart Plugs. HowTo reflash them and use them with OpenHAB

Cheap Smart Plugs (With power monitoring!)

The Mission:
Based on this thread about cheap, wifi-based smart plugs, it was suggested I do a write-up on how to flash them and how not to brick them (like I did :slight_smile:)

Smart plugs are probably the first or second thing you’ll want to do with your new smart home. But, there are a number of issues to smooth before you can use them. Once smoothed you’ll see that it’s actuallly a doddle to get these plumbed in to your system.

Why not use the stock firmware?

  • Because it phones home to China
  • Because they use proprietary protocol and you would need a new binding
  • Because it phones home to China (did I mention that?)


  • Buy some of the plugs from Amazon, AliExpress etc.
  • Try to ensure they are listed on this website: Tasmota Templates (Note that a lot of the plugs seem to be the same but are rebranded. I got some unlisted ones working by trying different templates.
  • Get yourself a spare Raspberry Pi 3B+ onwards (It must have LAN and WiFi)

(I am doing this from memory so might miss-step a bit)

1. Setup Tuya-Convert:
Assuming you have a spare RPi up, running, patched and git installed, follow the very well documented steps on his site: https://github.com/ct-Open-Source/tuya-convert

2. Flash the device
Long-Press the button on the plug. This will put it into recovery mode. It should be flashing rapidly.
As per the instructions, install it all and then run


This will go through the various steps needed to flash. One very important step is to ensure you connect your phone / tablet / other device to the new wifi hotspot. TBH, I don’t know why but it does not work without doing this step. Don’t be lazy :slight_smile:

3. Select the firmware to push
At this point, you have the choice to install the basic Espurna or Tasmota. Personally I prefer Espurna but, while the basic option boots and works, it has no features like mqtt. I tried various options and eventually bricked it. All you need is Tasmota. Install that :slight_smile:

4. Connect it to your WiFi.
Once you reboot your plug you should see a new WiFi hotspot. Connect to this and setup the credentials for your own WiFi.
Be sure to enable MQTT. You don’t need to change any of the settings if you don’t want to.
Be sure to click on the Information button and grab the hostname. eg “tmPowCoffeeMachine-2011”

5. Get the topic root from Tasmota
Once it’s all back up and logged into your network, go back to the new plug by typing in the hostname into your browser. If this does not work you’ll need to find the IP address from your router.
Again, clicking on the Information page you can see that mqtt is connected and take not of the full topic.

6. Plumb it in
Once you have all that you can plumb it into the item in question like this:

Switch PlugsChristmasTree1 "White ChristmasTree"     					{ 

Number PlugsChristmasTree1_Power    "White ChristmasTree - Power"      					

Number PlugsChristmasTree1_Voltage  "White ChristmasTree - Voltage"     					

(Yes, I used the mqtt 1. method which is not (the current) best but full mqtt setup is out of scope of this :slight_smile:)

Final notes
All in all it looks quite long winded but really, after the first plug, it took me maybe two minutes per plug to flash. All of it is automated and very slick. It’s really straightforward.

Let me know if I’ve missed anything or something breaks en route. I will review the steps when I flash the next batch.



Can confirm - as long as you get the right plugs, this is easy. Power reporting is faster and more reliable than zwave - so I’ve replaced all my zwave socket devices (and, as my zwave network is now simpler, it’s improved the responsiveness of the remaining zwave devices)

Which plugs are you using?

I think the same as you: https://www.amazon.co.uk/gp/product/B07QN5XY89/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

They are really very good indeed. Note that the similar looking (but cuter) round ones do not work.


These did work for me. Power button on the bottom.

mine were different - smaller and cuter, but didn’t work: https://www.amazon.co.uk/Outlet-TECKIN-Wireless-Control-Required/dp/B07MT622S1

Good to know so others don’t buy them.
Sucks for you though. Could not flash them?

I try stay away from the 10A verity because we’re rated to 13A here. Use these on a heavy load and you’re in a danger zone IMHO.
Having said that, my 13A and 16A ones probably just have a 13A or 16A sticker on :frowning:

yes, they don’t flash - have the newer firmware with the “vulnerability” patched. But the square ones in your first post are great.

A pi1 or p2 or even pi0 will work as long as it has a wifi dongle that can work in AP mode
I got this one:

You can check that by opening it up and checking the relay rating
You can then report to trading standards (in the uk: https://www.gov.uk/find-local-trading-standards-office) if needed

Just bought some of the sockets from Amazon - same link as the square ones above…
Teckin SP23

And they use the Realtec chip RMC-W302 so not flashable with this tecnique.
There isn’t any revision or serial number on the outsides of the sockets so we won’t know what we’ve got t’ll we open them up.
The main boards in mine are V1.1 dated 16/10/2018
What I don’t know is whether later or earlier versions have the ESP.
Interestingly the Wifi board has a sticker with SP27 writen on it so I presume these are SP27 boards in SP23 cases. SP27’s are known not to work.

1 Like

thanks for the info!

that’s extremely irritating - the vendor must have updated their stock. I ordered the exact same item and they were flashable. Was about to order some more, but I guess now have to start searching for an alternative…

This tutorial worked really well for me on an SM-S0301 power strip. The one thing that wasn’t clear to me before starting is how the Raspberry Pi would connect to the power strip, as that wasn’t specifically stated anywhere. It’s obvious now, but I’ll add some detail for the benefit of others.

  1. When you run start_flash.sh, Tuya-convert changes the RPi into a WiFi access point called vtrust-flash. You then need to connect a device to it (I used a Chromebook), but you don’t have to do anything with the connected device.
  2. Put the Tuya-based device into recovery mode by holding its button, and then press “Enter” on your RPi to proceed. Your RPi wll then go looking for nearby Tuya-based devices (in my case it was very quick). It will then backup the firmware and ask you to install Tasmota, Espurna, or the original firmware.
  3. Once you’ve installed Tasmota, the Tuya-based device will reboot and appear as a WiFi called tasmota-xxxx. Connect to with a device and then go to in a web browser to input your WiFi SSID and password. When you save, the device will reboot and connect to your WiFi network.
  4. Once the device is on your network, you can connect to it via its hostname (tasmota-xxxx) or its IP address. You can then upgrade the Tasmota firmware and configure it from a template using these instructions. You can also get all of the information you’ll need to set it up in openHAB.

Thanks for your efforts, @CDriver! Now to figure out how MQTT works…

1 Like