Flashing Sonoff S31s with ESPHome
Summary
I recently needed to flash some Sonoff S31 power switches, and realized I forgot to write down what I did and how to do it. Thankfully the process (thanks to ESPHome) is exceptionally easy. So this is a quick write up to explain the disassembly and flashing process.
Disassembly
First pull the grey power button plate off the S31 switch, this can be done with a small flathead screwdriver.
After the power button plate has been removed there are two sliders that can be removed:
Once the sliders are removed, three screws will be exposed, remove them:
The PCB can now be removed from the shell:
Take note of the contact pads (top to bottom):
- VCC
- RX
- TX
- D - TX
- D - RX
- GND
Getting a console
I have attached (top to bottom):
- Blue: RXD
- Green: TXD
- Black: GND
- Red: VCC
Now attach:
- Black: GND
- Blue: TX
- Green: RX
- Red: VCC
Before plugging the USB into a computer, press and hold the power button on the S31, while holding the power button plug the USB in, continue holding the power button for ~5 seconds.
The device is now read to be flashed.
Flashing
Flashing is as simple as:
sudo esphome run ./s31.yaml