Generic Sonoff¶
ESPHome supports Sonoff devices with ESP based chips inside, but as these devices are quite cheap and shipping from China takes a long time, I’ve only set up dedicated guides for the Sonoff S20 and Sonoff 4CH.
esphome:
name: <NAME_OF_NODE>
esp8266:
board: esp8285
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.
Note
SAFETY HAZARD: Some devices such as Sonoff POWs/Shelly/etc, have the digital GND connected directly to mains voltage so the GPIOs become LIVE during normal operation. Our advice is to mark these boards to prevent any use of the dangerous digital pins.
Sonoff RF¶
Pin |
Function |
---|---|
|
Button (inverted) |
|
Relay and Red LED |
|
Green LED (inverted) |
|
UART TX pin (for external sensors) |
|
UART RX pin (for external sensors) |
|
Optional sensor |
|
Optional sensor |
Sonoff SV¶
Pin |
Function |
---|---|
|
Button (inverted) |
|
Relay and Red LED |
|
Green LED (inverted) |
|
Analog Input |
|
UART TX pin (for external sensors) |
|
UART RX pin (for external sensors) |
|
Optional sensor |
|
Optional sensor |
|
Optional sensor |
Sonoff TH10/TH16¶
Pin |
Function |
---|---|
|
Button (inverted) |
|
Relay and Red LED |
|
Green LED (inverted) |
|
UART TX pin (for external sensors) |
|
UART RX pin (for external sensors) |
|
Optional sensor |
|
Optional sensor |
|
Optional Pin EXP-LOG (TH16 Ver 2.1 2019) |
Sonoff Dual R1¶
Pin |
Function |
---|---|
|
Relay #1 |
|
Relay #2 |
|
Blue LED (inverted) |
|
Optional sensor |
|
Optional sensor |
Sonoff Dual R2¶
Pin |
Function |
---|---|
|
Relay #1 |
|
Relay #2 |
|
Button |
|
Blue LED (inverted) |
|
Optional sensor |
|
Optional sensor |
Sonoff Dual R2 v1.4¶
Pin |
Function |
---|---|
|
Button #0(inside header board v1.4) |
|
Button #1(inside header board v1.4) |
|
Relay #1 |
|
Relay #2 |
|
Button on the case |
|
Blue LED (inverted) |
Sonoff Dual R3 v1.x, v2.x¶
Pin |
Function |
---|---|
|
Relay #1 |
|
Relay #2 |
|
Button |
|
Blue LED (inverted) |
|
SW Input #1 (inverted) |
|
SW Input #2 (inverted) |
|
UART TX pin (for power sensor) |
|
UART RX pin (for power sensor) |
For power measuring see CSE7761 Power Sensor (v1.x) or BL0939 Power Sensor (v2.x)
Sonoff Pow R1¶
(equivalent to Huafan SS)
Pin |
Function |
---|---|
|
Button (inverted) |
|
Relay and Red LED |
|
Blue LED |
|
HLW8012 SEL Pin |
|
HLW8012 CF1 Pin |
|
HLW8012 CF Pin |
See HLW8012 Power Sensor for measuring power.
Sonoff Pow R2¶
(equivalent to Huafan SS)
Pin |
Function |
---|---|
|
Button (inverted) |
|
Relay and Red LED |
|
Blue LED (inverted) |
See CSE7766 Power Sensor for measuring power.
Sonoff S20, Sonoff S22, Sonoff S26¶
Slampher¶
Pin |
Function |
---|---|
|
Button (inverted) |
|
Relay and Red LED |
|
Blue LED (inverted) |
|
UART TX pin (for external sensors) |
|
UART RX pin (for external sensors) |
Sonoff Touch¶
Pin |
Function |
---|---|
|
Button (inverted) |
|
Relay and Red LED |
|
Blue LED (inverted) |
|
UART TX pin (for external sensors) |
|
UART RX pin (for external sensors) |
Sonoff LED¶
Pin |
Function |
---|---|
|
Button (inverted) |
|
Blue LED (inverted) |
|
Red Channel |
|
Green Channel |
|
Blue Channel |
|
Cold White Channel |
|
Warm White Channel |
See RGBWW Light for controlling the lights together with ESP8266 Software PWM Output.
ElectroDragon¶
Pin |
Function |
---|---|
|
Button 1 (inverted) |
|
Button 2 (inverted) |
|
Relay 1 and Red LED |
|
Relay 2 and Red LED |
|
Green/Blue LED |
|
Analog Input |
Sonoff SC¶
Pin |
Function |
---|---|
|
Light |
|
Red LED (inverted) |
See Monochromatic Light and ESP8266 Software PWM Output for controlling the light pin.
Sonoff 4CH Pro¶
Same configuration as the Sonoff 4CH.
Sonoff B1, Ai-Thinker AiLight¶
Sonoff T1, Sonoff T3 (1CH, 2CH, 3CH)¶
Pin |
Function |
---|---|
|
Button 1 (inverted) |
|
Relay 1 and Blue LED |
|
Button 2 (inverted) |
|
Relay 2 and Blue LED |
|
Button 3 (inverted) |
|
Relay 3 and Blue LED |
|
Blue LED (inverted) |
|
UART TX pin (for external sensors) |
|
UART RX pin (for external sensors) |
Arilux LC10, Magic Home¶
Pin |
Function |
---|---|
|
Blue LED |
|
Red Channel |
|
Green Channel |
|
Blue Channel |
|
White Channel |
|
UART TX pin (for external sensors) |
|
UART RX pin (for external sensors) |
See RGBW Light for controlling the lights together with ESP8266 Software PWM Output.
Arilux LC01¶
Pin |
Function |
---|---|
|
Button (inverted) |
|
Blue LED |
|
Red Channel |
|
Green Channel |
|
Blue Channel |
|
White Channel |
|
UART TX pin (for external sensors) |
|
UART RX pin (for external sensors) |
See RGBW Light for controlling the lights together with ESP8266 Software PWM Output.
Arilux LC02¶
Pin |
Function |
---|---|
|
Button (inverted) |
|
Blue LED |
|
Red Channel |
|
Green Channel |
|
Blue Channel |
|
White Channel |
|
UART TX pin (for external sensors) |
|
UART RX pin (for external sensors) |
See RGBW Light for controlling the lights together with ESP8266 Software PWM Output.
Arilux LC11¶
Pin |
Function |
---|---|
|
Button (inverted) |
|
Blue LED |
|
Red Channel |
|
Green Channel |
|
Blue Channel |
|
Cold White Channel |
|
Warm White Channel |
|
UART TX pin (for external sensors) |
|
UART RX pin (for external sensors) |
See RGBWW Light for controlling the lights together with ESP8266 Software PWM Output.
Sonoff S31¶
Pin |
Function |
---|---|
|
Button (inverted) |
|
Relay and Red LED |
|
Green LED (inverted) |
See CSE7766 Power Sensor for measuring power
Sonoff S55¶
Pin |
Function |
---|---|
|
Button (inverted) |
|
Relay and Red LED |
|
Blue LED (inverted) |
|
UART TX pin (for external sensors) |
|
UART RX pin (for external sensors) |
Sonoff Mini¶
Pin |
Function |
---|---|
|
Button (inverted) |
|
SW Input (inverted) |
|
Relay and Red LED |
|
Blue LED (inverted) |
|
Optional sensor |
Sonoff THR316D¶
Pin |
Function |
---|---|
|
Button |
|
Relay 1 |
|
Relay 2 |
|
Optionnal sensor power ON/OFF |
|
sensor |
|
Power LED |
|
Wifi LED (inverted) |
|
Cycle LED (inverted) |
|
Display Read |
|
Display Write |
|
Display Data |
|
Display CS |
|
UART TX pin (for log) |
|
UART RX pin (for log) |
Shelly 1¶
Pin |
Function |
---|---|
|
Relay |
|
SW Input |
Shelly 2¶
Pin |
Function |
---|---|
|
Relay #1 |
|
Relay #2 |
|
SW Input #1 |
|
SW Input #2 |
Teckin¶
Pin |
Function |
---|---|
|
Button (inverted) |
|
Blue LED (inverted) |
|
Red LED (inverted) |
|
Relay |
|
HLW8012 SEL Pin (inverted) |
|
HLW8012 CF Pin |
|
HLW8012 CF1 Pin |
See HLW8012 Power Sensor for measuring power. Example config: teckin.yaml
Teckin SP20 (US)¶
Pin |
Function |
---|---|
|
Button |
|
Blue LED (inverted) |
|
Red LED (inverted) |
|
Relay |
|
HLW8012 SEL Pin (inverted) |
|
HLW8012 CF Pin |
|
HLW8012 CF1 Pin |
See HLW8012 Power Sensor for measuring power. Example config: teckin_sp20_us.yaml
TorchStar LED Controller (Nov 2018)¶
Pin |
Function |
---|---|
|
Button (inverted) |
|
Blue LED (inverted) |
|
Red LED (inverted) |
|
Red Channel |
|
Green Channel |
|
Blue Channel |
|
White Channel |