Sonoff SwitchMan M5 3C 3 Gang switch with ESPHome

You need to create a gpio output with the pin number for each relay.

output:
  - platform: gpio
    id: relay_1
    pin: 23

Then instead of a switch, create a light changing the platform to binary and linking it to the corresponding output.

light:
  - platform: binary
    id: switch_1
    name: "Light 1"
    output: relay_1

For the phisical buttons to work, just change the on_press method from switch.toggle to light.toggle and put the corresponding light id.

binary_sensor:
  - platform: gpio
    id: left_button
    name: "kitchen left button"
    pin:
      number: 4
      mode: INPUT_PULLUP
    on_press:
      - light.toggle: switch_1

I’ll link you my full config: