Hi, I would like to use my Sonoff Switchman M5 as a smart switch for the yeelight lamp and not as a power cutter. Installed esphome, configuration as below, I searched the entire forum and google, however, I did not find any relevant clues on this topic.
I would guess how to detach buttons from leds, still be able to use buttons to trigger HA trigger for smart bulbs and ideally keep the led indicators for the on/off of the lights?
This is an old topic but it deserves a correct answer.
Disconnecting the buttons from the relays is quite easy:
Remove the on_press: action frrom the binary sensor definition. That will disconnect the button from the relay. You can do it for any of the buttons or both, it’s completely your choice.
To make the button visible as an entity in Home Assistant, you need to add a name: attribute to the respective binary sensor definiton and give it some name.
The config file shown above already has correctly defined binary light entities so the relays are now controlled from the HA only.
Hi, I’m interested in the M5 and flashing it with ESPhome. Does this method give the ability to decouple the relay and reconnect to the relay manually? I would like to use the m5 with smart lights but have the backup option. Similar to what the Aqara switches do? Thanks.
yes, my code does this automatically - if wifi and api are connected, use the virtual device, if not, use the relay. you can create a template switch that you can manually toggle between the smartlights and relay.
Hi Veli, I’m trying to apply this config but getting an invalid YAML Syntax. This is at light.toggle device_name led_red. Also, does this tell the red led to turn on and off with the light? What if I don’t want the red led on? Thanks.
It depends.
On M5 1-gang You can operate LED and Relay individually.
M5 2-gang: Left channel LED & Relay connected on motherboard, Right button - separately.
M5 3-gang: All channels LED’s & Relays wired together.
ESPHome has had many updates, but I tried my old config on Github and it compiles for me with no error
Creating esp32 image...
Successfully created esp32 image.
esp32_create_combined_bin([".pioenvs/m5-1c/firmware.bin"], [".pioenvs/m5-1c/firmware.elf"])
Wrote 0x1a2650 bytes to file /config/.esphome/build/m5-1c/.pioenvs/m5-1c/firmware-factory.bin, ready to flash to offset 0x0
Also, does this tell the red led to turn on and off with the light