Need Help Flashing ESPHome on Sonoff S31 Lite wifi plug

I’ve got a RATGDO for my garage door on the way and decided to try and get started with ESPHome before it arrives. I’ve had HA installed on a RPi3 for about three years and use it with a bunch of zwave light switches and Hue lights around the house. I’m fairly familiar with HA but by no means a power user. I mostly use the UI and don’t mess much with yaml files.

I had a couple Sonoff S31 wifi smart switches around and decided to try to flash one with ESPHome to start getting familiar with that system. I added the ESPHome add-on and I’ve got nabu casa too so I can secure access the ESPHome web UI from HA. I got this USB to Serial adapter and some hook leads so I wouldn’t have to solder onto the Sonoff board. Connected the usb-serial adapter leads according to this blog, and held down the power button on the Sonoff as I plugged in the usb to my laptop where I access HA.

From the web UI, I click “+ new device” and it prompts me to connect to the device, which I do. I select the FT232R USB UART from the connection options and click connect. The usb-serial board LEDs light up and the ESPHome web UI status goes from “connecting” to “preparing installation.” But then it just stays in preparing installation forever and nothing happens.

So then I deleted the configuration from ESPHome in HA and tried from https://web.esphome.io/. Unplugged, replugged the usb-serial, clicked connect, then “prepare for first use,” then “install.” It installs to 100% and says “configuration installed!” I close that and it tries to connect to the device. Then I get the message “An error occurred. Improv Wi-Fi Serial not detected.”

I’ve also tried plugging it directly into my RPi3 running HA and get the same issues. What am I doing wrong?

Go back and follow the steps again. It explains the process in detail and with pictures so, if its not working your doing something wrong or missing something. Also, its time to upgrade the pi3, especially if you plan to be flashing esp boards with it. Theyre notorious for crashing or having too low system resources and cause flashes to fail.

I followed the steps and kept getting the same result. Someone on reddit who had a similar issue suggested trying to connect to the sonoff plug directly in AP mode. I plugged it in and it was indeed broadcasting an AP. So I connected and it asked to join my wifi network. HA discovered it but does not show any attributes, no on/off option. I tried to reinstall OTA and that went through but still no attributes.

I found the yaml for Sonoff S31 esphome here Sonoff S31 | devices.esphome.io and copied it into my plug’s yaml and it worked. Had no idea about that last step. Is this normal for esphome devices or do they usually come into HA with their correct attributes/entities after they are flashed?

It has no entities or switch to toggle the plug? No, thats not normal but, i know what your talking about. Try deleting the device from the list of known esphome devices and then add it back manually. Dont delete the device from the esphome dashboard, where the yaml file is but from HA under Devices-Services - Esphome. Also make sure you dont have a duplicate device there too.

For what its worth, im a big fan of Kauf products. They come preflashed with esphome already and they work great. He makes stuff specifically for HA users and you can find his stuff on his website or Amazon.
https://kaufha.com/