Technology / 

20 Sep 2019

Tasmota 'Smart Plug' Reflashing With 'tuya-convert' (2018)

Tasmota is an open source firmware for ESP8266-based (so, WiFi-enabled) “smart” devices, such as smart plugs, bulbs, power strips, etc.

Intro:

2022 Note: This process (using tuya-convert) no longer works with many types of cheap Chinese-import smart plugs, because they use a different SoC.
Opening them up and soldering them is usually required to reflash.

(Or you can just buy ones pre-loaded with Tasmota and save yourself the trouble. They are much easier to get in 2022 than in 2018 and the price premium over crappy manufacturer firmware is smaller.) However, if you have older devices that were previously flashed to Tasmota with tuya-convert, I found that the Tasmota online upgrade process worked well, as long as I followed the instructions.

My plugs are marked model “YM-WS-1” with no obvious brand.
They are round, about 2 inches in diameter, with a single push-button on the side. They don’t look like they’d be especially easy to open up.

Instructional video that I followed: https://www.youtube.com/watch?v=O5GYh470m5k

Ingredients:

Process:

  1. Flash Raspbian Lite to the card
  2. touch ssh on the /boot partition to enable SSH access
  3. Insert card, connect RPi to Ethernet and power, determine IP address from DHCP
  4. SSH into the RPi
  5. Resize to take advantage of entire card
  6. sudo apt update && sudo apt upgrade 
  7. sudo apt install network-manager 
  8. sudo apt install git
  9. git clone https://github.com/ct-Open-Source/tuya-convert
  10. cd tuya-convert
  11. ./install_prereq.sh 
  12. ./start_flash.sh 
  13. Accept disclaimer / warning
  14. IF YOU GET “unknown log file” error… instructions in video at 7m04s on editing the script
  15. Connect to the emitted Wifi network (trust-flash?) with a phone or other device—this is important or the process won’t work
  16. Follow prompts — Put the device into Wifi pairing mode by pressing and holding primary button for 5s
  17. curl http://10.42.42.42/flash3 to continue to flash custom firmware (Sonoff-Tasmota)
  18. Connect to Sonoff Wifi network and set up per documentation
  19. In “Other Configuration” enable single-device Belkin emulation in order to allow control from Amazon Alexa and/or Google Home

Configuration Template:

Template to use:

{"NAME":"Aoycocr Smart","GPIO":[0,0,56,0,0,0,0,0,0,17,0,21,0],"FLAG":1,"BASE":18}

This can be copied and pasted into the “Other Parameters” configuration pane.