Binary sensor as automation trigger

Hi all,
I am using shelly 2.5 as roller shutter controller ,I would like to add automaiton the recognize how many times I click on the physical switch ( this is a monetary switch, that connected to the shelly).
I am receiving the switch state through mqtt topic ( true when the switch is pushed)
An example for my desirable automation : " if I click twice on the physical switch ( on off, on off) it will turn on my bed-light".
Thanks :slight_smile:

There is an example of this exact idea, verbatim, right in the docs (on_double_click):

1 Like

Thank you :blush:

how can I convert this syntax of ESPHome to a native home assistant sytax
for example this automation:

    on_multi_click:
    - timing:
        - ON for at most 1s
        - OFF for at most 1s
        - ON for 0.5s to 1s
        - OFF for at least 0.2s

https://esphome.io/components/binary_sensor/index.html

any idea? :frowning:

This would, I think, be a tricky and unreliable mess of a state machine made up of automations and binary sensors / input booleans that probably wouldn’t work properly with such short timings.

You’d be better off, if possible, flashing ESPHome onto the Shelly, using that to detect the multi-click events and then send a single signal to HA.

But the “multi clicks” state machine in ESPHome are a software not in the firmware, am I wrong?

Not sure what you mean. on_multi_click is a feature of ESPHome, which is a system that generates firmware to be flashed to an ESP8266/ESP32 device.

My suggestion is a) work out how to flash ESPHome firmware on to your Shelly device; b) once successfully working to the same level as the Shelly original firmware, enhance it via the use of on_multi_click to detect the press sequences and send a single, simple trigger signal to HA.

I see , I thought its kind of plugin/integration for the HA that add some new abilities.
Thanks