Skip to main content
Device Type:plug
Electrical Standard:eu
Board:esp32

Shelly Power Strip 4 Gen4

Shelly Power Strip 4 Gen4

Product Image

GPIO Pinout

PinFunction
GPIO1Relay 4 (Outlet 4)
GPIO2Relay 2 (Outlet 2)
GPIO3Relay 3 (Outlet 3)
GPIO4Relay 1 (Outlet 1)
GPIO6ADE7953 #0 IRQ (Outlets 1+2)
GPIO7ADE7953 #1 IRQ (Outlets 3+4)
GPIO10SPI CS1 – ADE7953 #1
GPIO11SPI MOSI
GPIO12SPI MISO
GPIO13SPI SCLK
GPIO15SPI CS0 – ADE7953 #0
GPIO16UART TX (Debug / Flash)
GPIO17UART RX (Debug / Flash)
GPIO18WS2812B Data (12 LEDs, via R36)
GPIO20Button 1 (SW1, low-active)
GPIO21Button 4 (SW4, low-active)
GPIO22Button 2 (SW2, low-active)
GPIO23Button 3 (SW3, low-active)

Flashing

Note: OTA flashing from the original Shelly firmware is not possible. Shelly Gen4 verifies OTA images with an ECDSA signature using their private key. The device must be flashed via UART.

Wiring

Connect a 3.3V USB-to-serial adapter to the UART pads on the ESP-Shelly-C68F module (J1 connector). Testpoints are also available on the PCB.

J1 Connector Pinout

PinFunction
1GND
2IO9
3EN
4VCC
5RXD
6TXD
7NC

PCB Testpoints

The testpoints are labeled on the PCB. When using an ESP-Prog, connect as follows:

PCB LabelESP-Prog
3.3VVCC
GNDGND
RESETEN
IO9IO0
U0RXDRXD0
U0TXDTXD0

To enter download mode, hold IO9 low (connect to GND) while powering on the device. Release after boot.

Backup the original firmware

Always back up the original firmware before flashing:

esptool.py --chip esp32c6 --port /dev/ttyUSB0 --baud 460800 \
--before no-reset --after no-reset \
read_flash 0 0x800000 shelly-powerstrip4-gen4-backup.bin

Compile

esphome compile shelly-powerstrip4-gen4.yaml

The factory binary is located at:

.esphome/build/shelly-power-strip-gen4/.pioenvs/shelly-power-strip-gen4/firmware-factory.bin

Flash

esptool.py --chip esp32c6 --port /dev/ttyUSB0 --baud 460800 \
write_flash 0x0 firmware-factory.bin

Basic Configuration

esphome:
name: shelly-powerstrip4-gen4
friendly_name: "Shelly Power Strip 4 Gen4"

esp32:
variant: ESP32C6
board: esp32-c6-devkitc-1
flash_size: 8MB
framework:
type: esp-idf
version: recommended

logger:
api:
ota:
wifi:
captive_portal:

spi:
- id: spi_bus
clk_pin: GPIO13
mosi_pin: GPIO11
miso_pin: GPIO12

sensor:
- platform: ade7953_spi
id: ade7953_0
cs_pin: GPIO15 # Outlets 1+2
irq_pin: GPIO6
update_interval: 10s
voltage:
name: "Voltage"
frequency:
name: "AC Frequency"
current_a:
name: "Outlet 1 Current"
current_b:
name: "Outlet 2 Current"
active_power_a:
name: "Outlet 1 Power"
active_power_b:
name: "Outlet 2 Power"

- platform: ade7953_spi
id: ade7953_1
cs_pin: GPIO10 # Outlets 3+4
irq_pin: GPIO7
update_interval: 10s
voltage:
name: "Voltage 2"
internal: true
frequency:
name: "AC Frequency 2"
internal: true
current_a:
name: "Outlet 3 Current"
current_b:
name: "Outlet 4 Current"
active_power_a:
name: "Outlet 3 Power"
active_power_b:
name: "Outlet 4 Power"

switch:
- platform: gpio
id: relay_0
name: "Outlet 1"
pin: GPIO4
restore_mode: RESTORE_DEFAULT_OFF
icon: mdi:power-socket-eu

- platform: gpio
id: relay_1
name: "Outlet 2"
pin: GPIO2
restore_mode: RESTORE_DEFAULT_OFF
icon: mdi:power-socket-eu

- platform: gpio
id: relay_2
name: "Outlet 3"
pin: GPIO3
restore_mode: RESTORE_DEFAULT_OFF
icon: mdi:power-socket-eu

- platform: gpio
id: relay_3
name: "Outlet 4"
pin: GPIO1
restore_mode: RESTORE_DEFAULT_OFF
icon: mdi:power-socket-eu

binary_sensor:
- platform: gpio
id: button_0
name: "Button 1"
pin:
number: GPIO20
mode: INPUT_PULLUP
inverted: true
on_press:
- switch.toggle: relay_0

- platform: gpio
id: button_1
name: "Button 2"
pin:
number: GPIO22
mode: INPUT_PULLUP
inverted: true
on_press:
- switch.toggle: relay_1

- platform: gpio
id: button_2
name: "Button 3"
pin:
number: GPIO23
mode: INPUT_PULLUP
inverted: true
on_press:
- switch.toggle: relay_2

- platform: gpio
id: button_3
name: "Button 4"
pin:
number: GPIO21
mode: INPUT_PULLUP
inverted: true
on_press:
- switch.toggle: relay_3

light:
- platform: esp32_rmt_led_strip
id: led_strip
name: "LED Strip"
pin: GPIO18
num_leds: 12
chipset: WS2812
rgb_order: GRB
default_transition_length: 0s
internal: true

- platform: partition
id: led_outlet_0
name: "Outlet 1 LED"
segments:
- id: led_strip
from: 0
to: 2

- platform: partition
id: led_outlet_1
name: "Outlet 2 LED"
segments:
- id: led_strip
from: 3
to: 5

- platform: partition
id: led_outlet_2
name: "Outlet 3 LED"
segments:
- id: led_strip
from: 6
to: 8

- platform: partition
id: led_outlet_3
name: "Outlet 4 LED"
segments:
- id: led_strip
from: 9
to: 11