Automation repeat index not working + how to message when in normal state?

I am using this automation to tell me when my UPS is on battery power. UPS is plugged into a smart plug.

Why doesn’t the max repeat index work? I have also tried this condition above the delay. And how do i make it so that when the power is above 50 for 1 minute after not being above 50 i get a different Telegram message? Can this be done in the same automation?

alias: Zolder - (Telegram bericht) Smart Plug controle
description: ""
trigger:
  - type: power
    platform: device
    device_id: ee631307bf6eb386910378dad949ac1c
    entity_id: 308b990b8da06b90e05632fa9032d0f5
    domain: sensor
    below: 50
    for:
      hours: 0
      minutes: 0
      seconds: 30
condition: []
action:
  - repeat:
      until:
        - type: is_power
          condition: device
          device_id: ee631307bf6eb386910378dad949ac1c
          entity_id: 308b990b8da06b90e05632fa9032d0f5
          domain: sensor
          above: 50
      sequence:
        - service: notify.telegram_bericht_nick
          data:
            message: "!!!!! Zolder UPS op accu !!!!!"
            title: "!!!!! ZOLDER UPS OP ACCU !!!!!"
        - delay: "00:02:30"
        - condition: template
          value_template: "{{ repeat.index > 10 }}"
mode: single
trace:
  stored_traces: 10


This Template Condition, located at the end of the repeat’s sequence, serves no purpose.

        - condition: template
          value_template: "{{ repeat.index > 10 }}"

You want it to be part of until’s condition, logically ORed with the existing Numeric Device Condition.

  - repeat:
      until:
        or: 
          - type: is_power
            condition: device
            device_id: ee631307bf6eb386910378dad949ac1c
            entity_id: 308b990b8da06b90e05632fa9032d0f5
            domain: sensor
            above: 50
          - condition: template
            value_template: "{{ repeat.index > 10 }}"
      sequence:

I suggest you use a separate automation.