ESPHome-Devices

Sonoff S31

Sonoff S31

Device Type: plug
Electrical Standard: us

Initial Install

This device cannot be converted to ESPHome using tuya-convert.

You must remove the cover and use the serial header for first upload. Hold down the button while powering on the device to put it into bootloader mode.

GPIO Pinout

PinFunction
GPIO0Push Button (HIGH = off, LOW = on)
GPIO12Relay and its status LED
GPIO13Green LED (HIGH = off, LOW = on)
GPIO1RX pin (for external sensors)
GPIO3TX pin (for external sensors)

Basic Configuration

# Basic Config
esphome:
name: sonoff_s31
platform: ESP8266
board: esp01_1m
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
logger:
baud_rate: 0 # (UART logging interferes with cse7766)
# Remove this line if you're not using Home Assistsant or your switch will restart every now and again
api:
ota:
# Device Specific Config
uart:
rx_pin: RX
baud_rate: 4800
binary_sensor:
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: True
name: "Sonoff S31 Button"
on_press:
- switch.toggle: relay
- platform: status
name: "Sonoff S31 Status"
sensor:
- platform: wifi_signal
name: "Sonoff S31 WiFi Signal"
update_interval: 60s
- platform: cse7766
current:
name: "Sonoff S31 Current"
accuracy_decimals: 1
voltage:
name: "Sonoff S31 Voltage"
accuracy_decimals: 1
power:
name: "Sonoff S31 Power"
accuracy_decimals: 1
id: my_power
- platform: total_daily_energy
name: "Sonoff S31 Daily Energy"
power_id: my_power
switch:
- platform: gpio
name: "Sonoff S31 Relay"
pin: GPIO12
id: relay
restore_mode: ALWAYS_ON
time:
- platform: sntp
id: my_time
status_led:
pin: GPIO13
Edit this page on GitHub