Script with wait_template needs 'until' timeout but how

this must be obvious, but I cant find the solution to my challenge right away, so please have a look?

using this in a script:

    - choose:
        conditions:
          condition: state
          entity_id: sun.sun
          state: below_horizon
        sequence:
          service: cover.close_cover
          entity_id: cover.screen_keuken
      default:
        - wait_template: >
            {{is_state('sun.sun','below_horizon') and
              is_state('input_select.activity','Home theater')}}
        - service: cover.close_cover
          entity_id: cover.screen_keuken

I want the wait_template to stop and halt the script if

not is_state('input_select.activity','Home theater') anymore.

can’t use the timeout for that, because that needs seconds/minutes. Don’t think I can add it in the wait template. Maybe it sounds more like a ‘while’, so I could wrap this whole section in a While? But this isn’t a loop, so that doesn’t really fit the bill either…

just asking what would be the most natural way of doing this.
thanks for having a look

I don’t get it.

Your choose action is the same as your default action. Just call the cover close service if the sun condition is true.

well that’s what I had before. Sometimes the ‘Home theater’ script is used while the sun hasn’t set yet. It will set during the period we’re watching tv, and I want it to close automatically then.

maybe I should create a simple additional automation, and cut out this whole choose section from the script:

  - alias: Sun sets screen while watching tv
    id: Sun sets screen while watching tv
    trigger:
      platform: sun
      event: sunset
    condition: "is_state('input_select.activity','Home theater')"
    action:
      service: cover.close_cover
      entity_id: cover.screen_keuken