ESPHome Physical Button - Long Press action without release

This is what on_multi_click is for:

binary_sensor:
  - platform: gpio
    id: g0
    pin:
      number: 0
      mode: input_pullup
      inverted: true
    on_press:
      - switch.turn_on: led
    on_multi_click:
      - timing:
          - on for at least 1s
        then:
          - switch.turn_off: led
4 Likes