Programming Teckin SP20 ESPHome without using tuya-convert

The video and configuration below is for programming SP20 plugs to add to Home Assistant.
The OEM branding for these plugs changes from time to time. If you find new ones let me know and I’ll update this list. You can buy these plugs on Amazon here:

Link updated 8/13/21.

I’ve haven’t yet gotten tuya-convert to work and frankly I enjoy opening these plugs and soldering them. So I just posted a video on how to do it for anyone who’s still uneasy about this. I’m also posting my yaml configuration for programming them with esphome.


  plug_name: energy_1
  # Higher value gives lower watt readout
  current_res: "0.00221"
  # Lower value gives lower voltage readout
  voltage_div: "955"

  name: ${plug_name}
  platform: ESP8266
  board: esp8285

  ssid: 'SSIDHERE'
  password: 'PASSWORDHERE'

# Enable logging

# Enable Home Assistant API
  password: 'PASSWORD'

  password: 'PASSWORD'

  - platform: homeassistant
    id: homeassistant_time
  - platform: gpio
      number: GPIO13
      inverted: True
    name: "${plug_name}_button"
        - switch.toggle: "${plug_name}_Relay"
- platform: gpio
  id: "${plug_name}_Relay"
  name: "${plug_name}_Relay"
  pin: GPIO4
  restore_mode: RESTORE_DEFAULT_OFF
      - switch.turn_on: "${plug_name}_LED_Red"
      - switch.turn_off: "${plug_name}_LED_Red"          
- platform: gpio
  name: "${plug_name}_LED_Blue"
  pin: GPIO2
  inverted: True
  restore_mode: RESTORE_DEFAULT_OFF
- platform: gpio
  id: "${plug_name}_LED_Red"
  name: "${plug_name}_LED_Red"
  pin: GPIO0
  inverted: True
  restore_mode: RESTORE_DEFAULT_OFF
  - platform: hlw8012
      number: GPIO12
      inverted: True
    cf_pin: GPIO05
    cf1_pin: GPIO14
    current_resistor: ${current_res}
    voltage_divider: ${voltage_div}
      name: "${plug_name}_Amperage"
      unit_of_measurement: A
      name: "${plug_name}_Voltage"
      unit_of_measurement: V
      name: "${plug_name}_Wattage"
      unit_of_measurement: W
      id: "${plug_name}_Wattage"
    change_mode_every: 8
    update_interval: 10s
  - platform: total_daily_energy
    name: "${plug_name}_Total Daily Energy"
    power_id: "${plug_name}_Wattage"
        # Multiplication factor from W to kW is 0.001
        - multiply: 0.001
    unit_of_measurement: kWh
# Extra sensor to keep track of plug uptime
  - platform: uptime
    name: ${plug_name}_Uptime Sensor

I’m surprised you haven’t had any comments here yet. I stumbled across this while looking to see if I could do anything OTA to program the ZooZee plugs I have (based on the SP20 design of these Teckin plugs, from what I hear). Thanks for sharing and especially for posting your code, which will make getting the two plugs I have up and running a breeze.

@aweiss I just tried this and it worked great. Now my vegetable garden seedlings have a grow light that automatically comes on at sunset and shuts off at sunrise. Thanks for the step-by-step video and the esphome config, it made this process a breeze!

You’re welcome. Glad I could help!

Got another pair of these recently and am going to flash them soon!

I’ve been strapped for GPIOs with the ESP-01 boards I have around and it was just too tempting to leave some of the internal pins untouched with these sockets. I therefore drilled a small hole on the left side of the two plugs I’ve done already, nearest to the wall, to allow me to run a GND and RX wire out of the device to use as an additional switch.

# Disable TX/RX logging.
  baud_rate: 0

And then farther down in the “binary_sensor” area:

  - platform: gpio
    id: button
    name: ${socket_name}_input
      # Connected to GPIO
      number: GPIO3
      mode: INPUT_PULLUP
      inverted: true
      # Small filter, to debounce the button press if needed
      # - delayed_on: 10ms
      # - delayed_off: 500ms

One additional note is that I’ve been using this for the ZooZee plugs, which are identical to the Teckin SP20, they have “Model: SA102” on the back and are just a rebranded version.

Attaching a diagram I made for my own reference off of @aweiss’s input for a quick reference in soldering:


Nice diagram! I love it! I’m going to see about those ZooZee plugs, word has been that the Teckin SP20’s have moved to a different chip rather than the esp. -Andy

I just bought the second 2-pack I have (only 4 total at this point) for about $13 shipped off eBay. There are a few more floating around on eBay at least.

Have you reached 100 yet? I don’t know if I have even 50 things plugged in with our family of five… I would enjoy seeing energy usage spikes at home, but do you have a different plan for your army of smart energy usage sockets?

You pretty much have to do it this way now. I’ve tried 2 recently over the air and they’re both bricked. 3 other model plugs flashed perfectly, these Teckin SP20’s are picky as hell. I have a serial programmer coming Saturday so hopefully I can get them both up and running again.

PS I bought my 4 pack awhile ago, apparently new ones don’t have the ESP chip and they can’t be flashed at all, luckily all of mine do.

Bummer about bricking a couple. Good luck flashing with the serial programmer.

I finally have a wireless dongle that could serve as an access point for tuya-converting any more I would buy, but now I’m a bit wary of doing that, if you’ve had a bad experience…

1 Like

I ended up bricking 3, the two Teckin SP20’s and another model, that one was 100% my fault. I tried to flash Tasmota-minimal to it first which is a big no-no.

In the end with the serial programmer I was able to rescue all 3, they’re all up and running on the latest Tasmota full. :slight_smile:

For what it’s worth the Teckin SP20 specifically is the only one that has any issue with OTA flashing, everything else I tried worked perfectly. Also newer SP20’s don’t have an ESP chip so they’re not flashable anyway.

Is there a way to distinguish the new non-ESP SP20, for example by UPC?

Does anyone have a reliable link to procure the older ESP ones?

1 Like

In case anyone else is interested, the currently available and new on the market Emporia Energy Smart Plugs (amazon link) are this exact same hardware and can be flashed through a hole in the back as described above. They’re not a Tuya though, so you do need to physically open them up to flash them.

1 Like

Thanks for the heads up on these–I might grab a 4-pack since the ZooZee ones aren’t too common to find cheaper on eBay than that and the Teckin ones might be hard to find the right hardware version.


Hi there… I am new to all this and am going to try this hardwired programming trick on some of my Teckin plugs. My question is regarding the programming Script: There are reference to passwords for both Home Assistant API and OTA I am wondering where these are set in Home Assistant as I haven’t seen reference to them before? Thanks for any help! Bob


My understanding is that these passwords are optional, but when set you’re creating a password to interact with the ESP. You set the password here, then when Home Assistant tries to OTA new code, or tries to connect for information from the API, then Home Assistant will prompt you to provide the password that is set in this config file. This helps protect the device from someone connecting to your network and OTA’ing new code onto all your devices.

Good luck with the plugs.


Does it matter if using a PL2303 instead of the FTDI to program? I already have a Prolific and hate to spend money on a FTDI if this one would work.

EDIT: I just ordered a 4 pk of the Emporia Energy Smart Plugs, as someone above suggested. I guess I will find out tomorrow whether or not the PL2303 will work to program them.

So I got my switches today and sure enough the PL2303 flashed them just fine. However, a huge problem I discovered with these switches. While they do remember their last state with the stock firmware on a power outage, they do not when using this ESPHome firmware. They always return in the off state when power is restored. Any idea on how to correct this?


1 Like

use tasmota with mqtt. esphome while easy on the yaml and development the nodes suck

It would be good to see if @aweiss (or a mod) can edit the original post to include this info. It would be good for SEO — I was trying to flash my Emporia outlets with Tasmota today and found very little info from googling. Eventually I found this post but only after hours of searching :sweat_smile:

Thank you for the useful post, OP! And thank you @ksanislo for the Amazon review on the Emporia outlets. Was good to know that they were indeed ESP8266.

1 Like