In principle ESPHome supports all Sonoff devices, but as these devices are quite expensive and shipping from China takes a long time, I've only set up dedicated guides for the Sonoff S20 <sonoff_s20>
and Sonoff 4CH <sonoff_4ch>
.
esphome:
name: <NAME_OF_NODE>
platform: ESP8266
board: esp01_1m
After that use the following list of pin to function mappings to set up your Sonoff device. This list has been compiled from the Sonoff Tasmota pin source file which can be found here: https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/sonoff_template.h ❤️
GPIO0, Button (inverted), GPIO12, Relay and Red LED, GPIO13, Green LED (inverted), GPIO1, UART TX pin (for external sensors) GPIO3, UART RX pin (for external sensors) GPIO4, Optional sensor GPIO14, Optional sensor
GPIO0, Button (inverted), GPIO12, Relay and Red LED, GPIO13, Green LED (inverted), GPIO17, Analog Input, GPIO1, UART TX pin (for external sensors) GPIO3, UART RX pin (for external sensors) GPIO4, Optional sensor GPIO5, Optional sensor GPIO14, Optional sensor
GPIO0, Button (inverted), GPIO12, Relay and Red LED, GPIO13, Green LED (inverted), GPIO1, UART TX pin (for external sensors) GPIO3, UART RX pin (for external sensors) GPIO4, Optional sensor GPIO14, Optional sensor
GPIO1, Relay #1, GPIO3, Relay #2, GPIO13, Blue LED (inverted), GPIO4, Optional sensor GPIO14, Optional sensor
GPIO12, Relay #1, GPIO5, Relay #2, GPIO10, Button, GPIO13, Blue LED (inverted), GPIO4, Optional sensor GPIO14, Optional sensor
(equivalent to Huafan SS)
GPIO0, Button (inverted), GPIO12, Relay and Red LED, GPIO15, Blue LED,
GPIO5, HLW8012 SEL Pin GPIO13, HLW8012 CF1 Pin GPIO14, HLW8012 CF Pin
See /components/sensor/hlw8012
for measuring power.
(equivalent to Huafan SS)
GPIO0, Button (inverted), GPIO12, Relay and Red LED, GPIO13, Blue LED (inverted),
See /components/sensor/cse7766
for measuring power.
See sonoff_s20
.
GPIO0, Button (inverted), GPIO12, Relay and Red LED, GPIO13, Blue LED (inverted), GPIO1, UART TX pin (for external sensors) GPIO3, UART RX pin (for external sensors)
GPIO0, Button (inverted), GPIO12, Relay and Red LED, GPIO13, Blue LED (inverted), GPIO1, UART TX pin (for external sensors) GPIO3, UART RX pin (for external sensors)
GPIO0, Button (inverted), GPIO13, Blue LED (inverted), GPIO5, Red Channel GPIO4, Green Channel GPIO15, Blue Channel GPIO12, Cold White Channel GPIO14, Warm White Channel
See /components/light/rgbww
for controlling the lights together with /components/output/esp8266_pwm
.
GPIO2, Button 1 (inverted), GPIO0, Button 2 (inverted), GPIO13, Relay 1 and Red LED, GPIO12, Relay 2 and Red LED, GPIO16, Green/Blue LED GPIO17, Analog Input
GPIO12, Light, GPIO13, Red LED (inverted)
See /components/light/monochromatic
and /components/output/esp8266_pwm
for controlling the light pin.
Same configuration as the Sonoff 4CH <sonoff_4ch>
.
See /components/my9231
.
GPIO0, Button 1 (inverted), GPIO12, Relay 1 and Blue LED, GPIO9, Button 2 (inverted), GPIO5, Relay 2 and Blue LED, GPIO10, Button 3 (inverted), GPIO4, Relay 3 and Blue LED, GPIO13, Blue LED (inverted), GPIO1, UART TX pin (for external sensors) GPIO3, UART RX pin (for external sensors)
GPIO2, Blue LED, GPIO14, Red Channel, GPIO5, Green Channel, GPIO12, Blue Channel, GPIO13, White Channel,
GPIO1, UART TX pin (for external sensors) GPIO3, UART RX pin (for external sensors)
See /components/light/rgbw
for controlling the lights together with /components/output/esp8266_pwm
.
GPIO0, Button (inverted), GPIO2, Blue LED, GPIO5, Red Channel, GPIO12, Green Channel, GPIO13, Blue Channel, GPIO14, White Channel,
GPIO1, UART TX pin (for external sensors) GPIO3, UART RX pin (for external sensors)
See /components/light/rgbw
for controlling the lights together with /components/output/esp8266_pwm
.
GPIO0, Button (inverted), GPIO2, Blue LED, GPIO5, Red Channel, GPIO14, Green Channel, GPIO12, Blue Channel, GPIO13, White Channel,
GPIO1, UART TX pin (for external sensors) GPIO3, UART RX pin (for external sensors)
See /components/light/rgbw
for controlling the lights together with /components/output/esp8266_pwm
.
GPIO0, Button (inverted), GPIO2, Blue LED, GPIO5, Red Channel, GPIO4, Green Channel, GPIO14, Blue Channel, GPIO13, Cold White Channel, GPIO12, Warm White Channel,
GPIO1, UART TX pin (for external sensors) GPIO3, UART RX pin (for external sensors)
See /components/light/rgbww
for controlling the lights together with /components/output/esp8266_pwm
.
GPIO0, Button (inverted), GPIO12, Relay and Red LED, GPIO13, Green LED (inverteD),
See /components/sensor/cse7766
for measuring power
GPIO4, Relay, GPIO5, SW Input,
GPIO4, Relay #1, GPIO5, Relay #2, GPIO12, SW Input #1, GPIO14, SW Input #2,
sonoff_s20
sonoff_4ch
sonoff_basic
esp8266
Edit