devices.esphome.io

Sonoff 4CH Pro R2

Sonoff 4CH Pro R2

Device Type: relay
Electrical Standard: global
Board: esp8266

GPIO Pinout

PinFunction
GPIO0Push Button 1 (HIGH = off, LOW = on)
GPIO9Push Button 2 (HIGH = off, LOW = on)
GPIO10Push Button 3 (HIGH = off, LOW = on)
GPIO14Push Button 4 (HIGH = off, LOW = on)
GPIO12Relay 1 and its status LED
GPIO5Relay 2 and its status LED
GPIO4Relay 3 and its status LED
GPIO15Relay 4 and its status LED
GPIO13Blue LED (HIGH = off, LOW = on)

Basic Configuration

# Basic Config
esphome:
name: sonoff_4chpror2
platform: ESP8266
board: esp01_1m
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
logger:
api:
ota:
# Device Specific Config
binary_sensor:
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: True
on_press:
- switch.toggle: "relay_1"
- platform: gpio
pin:
number: GPIO9
mode: INPUT_PULLUP
inverted: True
on_press:
- switch.toggle: "relay_2"
- platform: gpio
pin:
number: GPIO10
mode: INPUT_PULLUP
inverted: True
on_press:
- switch.toggle: "relay_3"
- platform: gpio
pin:
number: GPIO14
mode: INPUT_PULLUP
inverted: True
on_press:
- switch.toggle: "relay_4"
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: True
name: "Sonoff 4CH Pro Button 1"
- platform: gpio
pin:
number: GPIO9
mode: INPUT_PULLUP
inverted: True
name: "Sonoff 4CH Pro Button 2"
- platform: gpio
pin:
number: GPIO10
mode: INPUT_PULLUP
inverted: True
name: "Sonoff 4CH Pro Button 3"
- platform: gpio
pin:
number: GPIO14
mode: INPUT_PULLUP
inverted: True
name: "Sonoff 4CH Pro Button 4"
- platform: status
name: "Sonoff 4CH Pro Status"
switch:
- platform: gpio
name: "Relay 1"
pin: GPIO12
id: "relay_1"
- platform: gpio
name: "Relay 2"
pin: GPIO5
id: "relay_2"
- platform: gpio
name: "Relay 3"
pin: GPIO4
id: "relay_3"
- platform: gpio
name: "Relay 4"
pin: GPIO15
id: "relay_4"

LED Configuration

Use one of the following three configurations to adjust the led to your needs. Note: Using the Status LED on the 4CH Pro may cause relay 4 to activate on power up.

Status LED (see https://esphome.io/components/status_led.html)

status_led:
pin:
number: GPIO13
inverted: True

Always-on led (plugged in == led on)

output:
- platform: esp8266_pwm
id: blue_led
pin: GPIO13
inverted: True
light:
- platform: monochromatic
name: "Blue LED"
output: blue_led
restore_mode: ALWAYS_ON
internal: true

Normal light, toggleable via Home Assistant

output:
- platform: esp8266_pwm
id: blue_led
pin: GPIO13
inverted: True
light:
- platform: monochromatic
name: "Blue LED"
output: blue_led
Edit this page on GitHub