How to create a on_multi_click in one binary sensor but with other sensor's condition

For example, during below the whole multi click period, another sense.state need to be “true”, otherwise, the action will be stopped. I considered waiting until but it seems not correct because it just consider the beginning, so anyone can help me ? thanks.

binary_sensor:

  • platform: gpio

    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:
      • logger.log: “Double-Clicked”