Success with ESPHome for Smart Plug Control!

Hey everyone, I wanted to share my recent success with setting up a Gosund smart plug using ESPHome. I’ve been trying to get this working for a while, and I thought I’d document my journey in case it helps someone else.

I started with Tasmota because I heard great things about it, but I ran into a few issues. The MQTT setup was a bit overwhelming for me, and I kept having problems with the firmware flashing. It was frustrating because I couldn’t get past the initial setup. I tried using TuyaConvert, but it kept bricking the plug. I was really stuck and wasn’t sure if I should continue or try something else.

Then I came across ESPHome, and it seemed like a good alternative. I read through the documentation and decided to give it a shot. The process was a bit daunting at first, but I managed to compile the binary and flash it onto the plug. I was so relieved when it worked on the first try!

Here’s the configuration I used. It’s based on some examples I found online, but I had to tweak it to fit my setup:

yaml
esphome:
name: washing_machine_plug
comment: Gosund UP111 with power monitoring
platform: ESP8266
board: esp01_1m

wifi:
ssid: “MyWiFiNetwork”
password: “MySecurePassword”

api:
reboot_timeout: 0s
password: “esphome”

sensor:

  • platform: hlw8012
    sel_pin: GPIO12
    cf_pin: GPIO4
    cf1_pin: GPIO5
    current_resistor: 0.00221
    voltage_divider: 955
    name: “Washing Machine Current”
    unit_of_measurement: “A”
  • platform: hlw8012
    sel_pin: GPIO12
    cf_pin: GPIO4
    cf1_pin: GPIO5
    current_resistor: 0.00221
    voltage_divider: 955
    name: “Washing Machine Voltage”
    unit_of_measurement: “V”
  • platform: hlw8012
    sel_pin: GPIO12
    cf_pin: GPIO4
    cf1_pin: GPIO5
    current_resistor: 0.00221
    voltage_divider: 955
    name: “Washing Machine Power”
    unit_of_measurement: “W”
    id: washing_machine_power

binary_sensor:

  • platform: gpio
    pin: GPIO3
    name: “Washing Machine Button”
    internal: true
    on_click:
    • switch.toggle: washing_machine_relay

switch:

  • platform: gpio
    pin: GPIO14
    name: “Washing Machine Relay”
    id: washing_machine_relay
    restore_mode: ALWAYS_ON

led:

  • platform: gpio
    pin: GPIO1
    id: washing_machine_led
    inverted: true
    name: “Washing Machine LED”

This setup gives me real-time monitoring of the washing machine’s power usage, which is super helpful. I can track how much energy it uses during different cycles and even set up automations based on the power consumption.

I also added a physical button on the plug, which toggles the relay. It’s a nice touch because I can manually override the automation if needed. Plus, the LED indicator shows the current state, so I don’t have to guess whether it’s on or off.

One thing I’m still figuring out is how to log the power usage over time. I know Home Assistant has some built-in tools for this, but I’m not entirely sure how to set it up. If anyone has experience with this, I’d love to hear your tips!

Overall, I’m really happy with how this turned out. ESPHome was the right choice for me, and I’m excited to explore more possibilities with it. If you’re struggling with Tasmota or MQTT, I highly recommend giving ESPHome a try. It’s been a game-changer for my setup.

Looking forward to hearing about your experiences too!