Making my light switches “smart” used to be such a cumbersome task which required me to flash a Sonoff Mini with ESPHome, connect it to a momentary switch and, stuff it in the electrical box. It worked, but as you could imagine, this didn’t bode well as far as troubleshooting was concerned.

I was tired of that implementation and decided to go a different route once I moved into my new apartment. I came across these Tuya-based smart light switches made by GoSund.

Gosund Smart Light Switch

These smart light switches give you the power to automatically or remotely access and control which devices are switched on/off. The smart switch supports wireless connection via a 2.4G Wi-Fi network and can be controlled via a free smartphone app. The biggest selling points were the following:

  • Easy firmware flashing with no soldering
  • Included screwless faceplates
  • Works with 2+ gang Decora faceplates
  • Screws instead of clips to secure it in the wall
  • All in one cost-effective solution


Setting these up to run ESPHome isn’t as straightforward as it is to set them up with Tasmota. In fact, we’ll need to flash them with Tasmota first, and then flash them with ESPHome firmware.

Go ahead and open up the switch using a T6 Torx screwdriver. You will then find the circuit board, which is where the fun begins.

Because these switches had contact pads instead of via holes, I need to find a way to get an FTDI USB adapter wired to the board.

So I went ahead and designed a jig that would align some Pogo Pin Test Probes to the individual contact pads. You can find it on Thingiverse. It’s not the best, but it does its job.

You may need to hold the jig in place or perhaps use some tape to keep the contact still. Plug your Dupont connectors into your FTDI adapter of choice, then plug it into USB power of your computer. You should see the light on your switch turn on and flash several times. This is a good sign as your switch is now initiating pairing mode or “SmartConnect”.

Flashing Firmware

Flashing the firmware is a two-step process. You will first flash with Tasmota. Once flashed, you’ll use it’s UI to flash the ESPHome .bin file.

Flash the firmware

Before you begin you’ll need:

  1. One of the Linux machines listed below:
  2. A micro SD Card for your raspberry pi (at least 2gb, 8+ recommended).
  3. A wifi device that can connect to the SSID that will be generated by the raspberry pi and eventually the flashed tuya device.  This cannot be an iOS device, android devices will work.

Installing the OS on Raspberry Pi:

  1. Download and install Etcher
  2. Plug your microSD card into your PC using a microSD adapter
  3. Start Etcher.
  4. Select the disk image you downloaded and your microSD card from the etcher interface.
  5. Press Flash and wait.
  6. Add a blank file called ssh to the root of the Raspberry Pi to enable the SSH service on Raspbian.
  7. Plug the SD card into your raspberry pi, connect power and ethernet, and boot it up.

Connecting to your raspberry pi via SSH:

  1. Download and install Putty
  2. Start Putty.
  3. Enter the IP address of your Raspberry Pi in the box that says Host Name.  I recommend using an app like Fing to find the IP address of your Raspberry Pi.
  4. In the Saved Sessions input box, name your Raspberry Pi connection and then press “save”.
  5. Select your new saved session.
  6. Press Open

Setting up your Pi and updating the OS

  1. In the putty window log in with user pi and password raspberry
  2. Expand the file system by typing sudo raspi-config then selecting Advanced Options and then Expand Filesystem, select “Finish” and then select Yes when it asks to reboot.
  3. Reconnect via putty using your saved session and log in with username pi and password raspberry again.
  4. Type sudo apt-get update and wait for the updates to install
  5. Type sudo apt-get dist-upgrade and wait for the upgrades to install
    • You may get a prompt for permission, just type y and press enter.
  6. Type sudo apt-get install network-manager and wait for it to install.
  7. Type sudo apt install git and wait for it to install.

Setup and Install Tuya-Convert

  1. In the putty window type git clone press enter and wait.
  2. Type cd tuya-convert and press enter.
  3. Type ./ and wait.

Use Tuya-Convert to install Tasmota

  1. Type cd tuya-convert and press enter.
  2. Type ./
  3. Types yes and press enter.
  4. Connect your separate WiFi device to the vtrust-flash SSID that is being broadcast by your Raspberry Pi. There should be no password, but if there is somehow one, it should be flashmeifyoucan.
  5. Plug in your Tuya plug, switch, dimmer, or bulb and put it into pairing mode.
    • Different models are put into pairing mode via different methods, check the curated product pages for information for putting your device in pairing mode.  The LED should flash rapidly if done successfully.
  6. Press enter on your putty window to start the flash process and wait.
  7. Once the process completes you can type curl to install Tasmota or look at the other options available.

Setup Tasmota

  1. On your secondary device, disconnect from vtrust-flash and connect to the new SSID called tasmota-XXXX
  2. Open in your browser and enter your WiFi’s SSID and password.
  3. Use Fing or your router’s settings to find your new device on your WiFi network, it should be called tasmota-XXXX
  4. Open the IP address of your new device in a browser.
  5. Navigate to console and enter SetOption78 1 which allows you to flash non-Tasmota based firmware/binary files.
  6. Head over to the Firmware Upgrade page and flash your ESPHome binary.

ESPHome Configuration

  name: gosund_guest_bathroom_light
  platform: ESP8266
  board: esp01_1m

  entity_name: "Guest Bathroom Light"
  entity_id: "gosund_guest_bathroom_light"
  ssid: !secret WIFI_SSID
  password: !secret WIFI_PASS

  # Enable fallback hotspot (captive portal) in case wifi connection fails
    ssid: "Gosund Guest Bathroom Light"
    password: !secret FALLBACK_AP_PASS


# Enable logging

# Enable Home Assistant API
  password: !secret OTA_API_PASS
  reboot_timeout: 0s

  password: !secret OTA_API_PASS

# used just for testing, otherwise no need for it
  port: 80

# Config

    number: GPIO01
    inverted: true

  - platform: gpio
    id: button
      number: GPIO0
      mode: INPUT_PULLUP
      inverted: true
        - light.toggle: $entity_id
  - platform: status
    name: "$entity_name status"

  - platform: gpio
    id: relay
    pin: GPIO14

  - platform: binary
    id: $entity_id
    name: $entity_name
    output: relay

  - platform: wifi_signal
    name: "$entity_name WiFi signal"
    update_interval: 60s

  - platform: uptime
    name: "$entity_name uptime"

  - platform: version
    name: "$entity_name ESPHome version"