Skip to content
Get started

M5Stack 4-Relay Switch

The m5stack_4relay component controls the four relays of the M5Stack 4-Relay Unit over I²C. Each relay switches up to 250 V AC or 28 V DC at 10 A, and the unit’s LEDs follow the relays.

M5Stack 4-Relay Unit
M5Stack 4-Relay Unit
# Example configuration entry
m5stack_4relay:
id: relay_hub
switch:
- platform: m5stack_4relay
name: "Relay 1"
channel: 1
- platform: m5stack_4relay
name: "Relay 2"
channel: 2
  • id (Optional, ID): Manually specify the ID used for code generation.
  • address (Optional, int): The I²C address of the unit. Defaults to 0x26.
  • i2c_id (Optional, ID): The I²C bus to use. Required with more than one bus.
  • channel (Required, int): The relay to control, 1 to 4.
  • m5stack_4relay_id (Optional, ID): The unit the relay belongs to. Required with more than one unit.
  • restore_mode (Optional): Defaults to DISABLED. The unit keeps its relays while it stays powered, so after a reboot of the ESP a switch shows the relay as it is instead of changing it. Set one of the other restore modes to drive the relay at boot.
  • All other options from Switch.