I have reprogrammed a Sonoff mini with ESPHome. It’s controlling a standard switch and light. I would like to execute a double click automation on HA different that the single click.
single click → on or off the light
dbl click → close or open the room window cover
I did program on ESPHome a press and a on release function. On HA I did program an automation who reacts to the double click. Everything works perfectly except the fact that on the double click the main light flickers.
So I need a way to make sure that the main light doesn’t change the status when I do a double click. How can I implement this ? I have tried a delayed_on_off, but it doesn’t work with on_press and on_release
Well I nearly have it working, the on_multiclick can fill my need pretty well. I replaced the double click by a fast click (even better). The only thing I need is to send a trigger to HA to start an automation. What would the easiest/best way to do this ?
on_multi_click:
- timing:
- ON for at most 1s
- OFF for at least 0.5s
then:
- logger.log: "Fast Click. Need to send a trigger to HA to start automation"
- timing:
- OFF for at least 0.5s
then:
- switch.turn_off: relay_01
- timing:
- ON for at least 0.5s
then:
- switch.turn_on: relay_01
Thanks I’ll try a binary template sensor. I can only select 1 person for the solution, but all 3 of you gave me correct answers to solve my problem, so thank u all.