on_multi_click:
- timing:
- ON for at most 1s
- OFF for at most 1s
- ON for at most 1s
- OFF for at least 0.2s
then:
- logger.log: "Double Clicked"
- timing:
- ON for 1s to 2s
- OFF for at least 0.5s
then:
- logger.log: "Single Long Clicked"
- timing:
- ON for at most 1s
- OFF for at least 0.5s
then:
- logger.log: "Single Short Clicked"
If you used multi click then you could set it to be off for at least 5 seconds. Could use 2nd click to do nothing or just delay few seconds.
I was assuming there was a physical momentary button attached to the ESP device. You would set up a binary sensor in ESPhome
binary_sensor:
- platform: gpio
name: "momentary_button"
pin:
number: 16
mode: INPUT_PULLUP
inverted: True
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
then:
- whatever
Something like that. But the OP didn’t give any more details. So you could be right that this wouldn’t help if it’s all being done in HA. The more details the OP gives the more people are likely to give an opinion. Could the answer just be as simple as…
I want to control a output pin. But the output should only go to high, if my conditions are met. My conditions “outlet_state” is read every 5s over RS485.
If you’re only using the button in HA, then there’s a very simple solution.
Set up an automation which does whatever you want it to do, then add a delay of 5s at the very end of the actions. Make sure your automation is set to mode: single and max_exceeded: silent.
What this should do is mark the automation as still running for 5s after the action is performed. The single mode will not allow the automation to be retriggered until those 5s are over & the automation is marked as finished. The silent option is there so you don’t get spammed with errors in the log.