How to use current state of trigger for until condition action

Hello All

I’m attempting to set up an automation with multiple vibration sensor triggers. I’m configuring it to send notifications whenever the state changes to ‘ON’ and to continue sending them until the trigger changes its state to ‘OFF.’ How can I monitor the state of this trigger so that I can use it in the ‘UNTIL’ condition? Any guidance on how to accomplish this? Thanks


alias: Monitor - Vibration Sensors
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.1_sensor_vibration
      - binary_sensor.2_sensor_vibration
    from: null
    to: "on"
    id: vibration-on
  - platform: state
    entity_id:
      - binary_sensor.1_sensor_vibration
      - binary_sensor.2_sensor_vibration
    from: "on"
    to: "off"
    id: vibration-off
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - vibration-on
        sequence:
          - repeat:
              sequence:
                - service: notify.monitor_telegram
                  data:
                    message: >-
                      {{ trigger.to_state.attributes.friendly_name }} has
                      changed from {{ trigger.from_state.state }} to {{
                      trigger.to_state.state }}
                - delay:
                    hours: 0
                    minutes: 0
                    seconds: 15
                    milliseconds: 0
              until: []
            enabled: true
      - conditions:
          - condition: trigger
            id:
              - vibration-off
        sequence:
          - service: notify.monitor_telegram
            data:
              message: >-
                {{ trigger.to_state.attributes.friendly_name }} has changed from
                 {{ trigger.from_state.state }} 
                      to {{ trigger.to_state.state }}
mode: parallel
max: 10
until:
  - condition: template
    value_template:  "{{ is_state(trigger.to_state.entity_id, 'off') }}"

Or in shorthand notation:

until:
  -  "{{ is_state(trigger.to_state.entity_id, 'off') }}"