Sonoff Tx T3 us yaml code for a double click button esphome

hello i been trying to get my sonoff TX T3 us one gang to have a double click function in home assistant. is this something that can be done or not i flashed the board whit this code

binary_sensor:

  • platform: gpio
    pin:
    number: GPIO0
    mode:
    input: true
    pullup: true
    inverted: true
    id: button_1
    on_click:
    then:
    - light.toggle: light_1
    on_double_click:
    then:
    - homeassistant.service:
    service: light.toggle
    data:
    entity_id: light.led_relay_bedroom

i added sum code to the binary sensor part and it works but it turn on the main relay whit the double tap as well is there a way to add a delay or a pause for the main relay

i got leds in my rooms on a solar panel and want to see if i can used the wall switch as a roof light on of and ass a double tap action to turn the led light on as well from the same switch.

any help will be greatly appreciated

Hi.

First, format your post correctly. Any yaml needs to be in preformatted text tags, shown as </> on the posting toolbar. Also read topic 11 of the pinned post: How to help us help you - or How to ask a good question

I would also start by having a fiddle with the min_length: and max_length: values, maybe the defaults are too long or short.

binary_sensor:
  - platform: gpio
    # ...
    on_double_click:
      min_length: 50ms
      max_length: 350ms
      then: ...