Trigger issue - please help

AM having issues with a trigger YAML. I think, having searched on here, that it is due to the ‘above’ giving a string rather than a number - but any ideas how I can amend it so it works please?

Error code - Error:expected float for dictionary value @ data['actions'][3]['repeat']['until'][0]['above']. Got '{{ stop_threshold }}' expected float for dictionary value @ data['conditions'][0]['above']. Got '{{ start_threshold }}' .

triggers:
  - trigger: time
    at: "20:30:00"
  - trigger: time
    at: "21:30:00"
  - trigger: time
    at: "22:10:00"
  - trigger: time
    at: "22:50:00"

variables:
  session: >
    {% if now().strftime('%H:%M') == '20:30' %}
      1
    {% elif now().strftime('%H:%M') == '21:30' %}
      2
    {% elif now().strftime('%H:%M') == '22:10' %}
      3
    {% elif now().strftime('%H:%M') == '22:50' %}
      4
    {% endif %}

  start_threshold: >
    {% if session == 1 %} 90
    {% elif session == 2 %} 65
    {% elif session == 3 %} 46
    {% elif session == 4 %} 26
    {% endif %}

  stop_threshold: >
    {% if session == 1 %} 45
    {% elif session == 2 %} 35
    {% elif session == 3 %} 25
    {% elif session == 4 %} 10
    {% endif %}

  stop_time: >
    {% if session == 1 %} '21:20'
    {% elif session == 2 %} '22:05'
    {% elif session == 3 %} '22:45'
    {% elif session == 4 %} '23:20'
    {% endif %}

  battery_now: "{{ states('sensor.XXXX') }}"

conditions:
  - condition: numeric_state
    entity_id: sensor.XXXXX
    above: "{{ start_threshold }}"



  - repeat:
      until:
        - condition: numeric_state
          entity_id: sensor.XXXX
          above: "{{ stop_threshold }}"

above and below do not support templates:

Perhaps use a template condition instead of a numeric state condition.

thanks, just read about that now, trying to get my head round it. YAML is all completely new to my, was vaguely familiar with JSON prior to this weekend but YAML is a whole step beyond that :joy:

will try working that out