Sadly, I never posted any notes on the Sonoff products. Long ago I ordered a set of S31 outlets and B1 lamps. Both of which I reflashed with espurna. The notes on how to flash tasmota are helpful here, too. I found a quick tutorial on flashing with a Raspberry Pi in their docs. In todays world you might need to use pip3 instead of pip to install esptool. Tinkerman has posted lots of great details for the S31.
NEVER connect the S31 to mains power when flashing. For the S31 the connections to the Pi are very simple :
S31 Pin - Pi Pin Vcc - #1 (3.3vdc) - do not connect yet RX - #8 (TX) TX - #10 (RX) GND - #39 (Ground)
Once you have the wiring ready you can setup the Pi – make sure you have esptool installed. If not sudo pip3 install esptool
should handle it. You can then use raspi-config -> InterfaceOptions -> Serial to say No to shell on the serial port and Yes to Serial hardware.
The S31 will enter loader mode if you hold down the button, connect Vcc and continue holding the button for 10 seconds. You are now ready to actually flash the device(I was using an older Pi 2):
esptool.py --port /dev/ttyAMA0 erase_flash
esptool.py --port /dev/ttyAMA0 write_flash -fm dout 0x0 /path/to/downloaded/image
If you are using a Pi 3 or 4 replace ttyAMA0
with ttyS0
.
The bad news is the Sonoff B1 is no longer made and their replacement uses a different chip and is not re-flashable. For the B1 lamps I have MQTT control after reflashing is awesome. MQTT make the integration with Openhab super easy. If you happen to come across these at a good price then the flashing instructions at the Tasmota site are very helpful.