Blueprint repeat until release event (ZHA dimmer)

Hi.

I am trying to create a blueprint that can dim an Aqara Opple switch using ZHA events.

When holding a button, it sends 1 “Hold” event and upon release, a “release” event.

My current configuration does not work, since i cannot figure out the until condition. The current code does not work, since the template condition doesnt work with events.

Any ideas on how to make this work? Small example pasted below.

Help would be greatly appreciated.

blueprint:
  name: TEST - Opple2
  description: Control and dim lights with Aqara Opple switch 3 bands (WXCJKG13LM)
  domain: automation
  input:
    aqara_sw:
      name: Aqara switch
      description: Aqara switch to use
      selector:
        device:
          integration: zha
          manufacturer: LUMI

    light_top:
      name: Light
      description: The light to control with the top buttons
      default: []
      selector:
        target:
          entity:
            domain: light

mode: restart
max_exceeded: silent
trigger:
  - platform: event
    event_type: zha_event
    event_data:
      device_id: !input "aqara_sw"
action:
  - variables:
      command: "{{ trigger.event.data.command }}"
  - choose:
      ## Turn on upper lights
      - conditions:
          - "{{ command == '1_single' }}"
        sequence:
          - service: light.turn_on
            target: !input "light_top"

      ## Increase brightness for upper lights
      - conditions:
          - "{{ command == '1_hold' }}"
        sequence:
          repeat:
            sequence:
              - service: light.turn_on
                target: !input "light_top"
                data:
                  transition: 0.5
                  brightness_step_pct: 10
            until:
              - condition: template
                value_template: "{{ command == '1_release' }}"