Sonoff SwitchMan M5 3C 3 Gang switch with ESPHome

Not much, but if someone needs an example yaml file for Sonoff SwitchMan M5 3C you can find it here

Works with the ESPHome integration of Home Assistant.

I have M5 1C but the button is not switching on/off the light (physical or through HA). Not sure what I am doing wrong.

Hi, if you were following this guide, Flashing Sonoff SwitchMan M5 with ESPHome
the settings for one button are wrong, switch is not on pin: 22 it must be on 23:

switch:
  - platform: gpio
    id: relay_1
    name: "Button"
    pin: 23

Yep, figured that out while testing different PINs. Do you know how can I add a light instead of switch here?

I think newest HA update let you change swtich to light entity manually.

https://www.home-assistant.io/integrations/switch_as_x/

I have 2 gang switch and only 1 LED (left one) shows status when relay is on. Right LED does not show status when LED is on, anyone got same problem?

2 Likes

Hey, Have you figured this out? I have the same issue. I play around a bit with the gpios but no luck, just realized that the Right led works when pinning the relay to 22 instead of 19, but then the relay doesnt. :confused:

nothing yet

hi! somebody managed out something with the right led ? thanks

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:

I have made some progress on the 2nd LED for the 2 button switch. The second Switch LED is controlled by pin 22. I have created a virtual relay_4 tied to this pin and set it to toggle when pressing button 2. This works great on the physical switch (led goes on and off as expected) but doesnt work when triggering through HA. (switch goes on and off, but LED doesn’t) Here is my yaml, appreciate any ideas on this. (I have seen elsewhere that this could be done as a rule in HA? Not sure how to do that…

switch:
  - platform: gpio
    id: relay_1
    name: "Left Button"
    pin: 23
  - platform: gpio
    id: relay_2
    pin: 19
    name: "Right Button"
    
    
output:
  - platform: ledc
    pin: 18
    frequency: 1000 Hz
    id: pwm_output
    
  - platform: gpio
    id: relay_4
    pin: 22
    
light:
  - platform: monochromatic
    output: pwm_output
    name: "LEDs"
  - platform: status_led
    name: "Switch state"
    pin:
      number: 5
      inverted: true
      
  - platform: binary
    id: led2
    name: "LED 2"
    output: relay_4

binary_sensor:
  - platform: gpio
    id: left_button
    pin:
      number: 4
      mode: INPUT_PULLUP
    on_press:
      - switch.toggle: relay_1
  - platform: gpio
    id: right_button
    pin:
      number: 15
      mode: INPUT_PULLUP
    on_press:
      - switch.toggle: relay_2
      - light.toggle: led2
2 Likes

Thanks, your solution save my day!