When double click on binary sensor both on_double_click and on_click are triggered

Following is my configuration:

binary_sensor:
  - platform: gpio
    name: "My Button"
    id: my_button
    pin:
      number: 0
      inverted: true
    on_click:
      - light.turn_on:
          id: my_light
          blue: 0%
          red: 0%
          green: 100%
          brightness: 100%
          effect: Random Effect With Custom Values
    on_double_click:
      - light.turn_on:
          id: my_light
          blue: 100%
          red: 0%
          green: 0%
          brightness: 100%
          effect: Fast Pulse

when I double click the button, the color change to blue then quickly to green, and the effect stay on Random Effect With Custom Values.

Try adding a min_length: value to the `on_click:’. Something longer than the default 50ms.

For example:

    on_click:
    - min_length: 100ms
      - light.turn_on:
          id: my_light
          blue: 0%
          red: 0%
          green: 100%
          brightness: 100%
          effect: Random Effect With Custom Values