Fan template speeds to value

Hi,

Now with homeassistant 2202.2 my fan template is broken. I think I must go to values but I have no idea what to change

This worked with the old version:

fan:
  - platform: template
    fans:
      ventilatie:
        value_template: "{{ states('binary_sensor.ventilatiestatus') }}"
        speed_template: "{{ states('sensor.ventilatiespeed') }}"
        percentage_template: "{{ states('sensor.ventilatiespeed') }}"
        turn_on:
          service: script.fan_high
        turn_off:
          service: script.fan_low
        set_speed:
          service_template: >
            {% if speed == 'high' %}
              script.fan_high
            {% elif speed == 'medium' %}
              script.fan_medium
            {% elif speed == 'low' %}
              script.fan_low
            {% endif %}
        speeds:
          - 'high'
          - 'medium'
          - 'low'

Any idea how to get it to work with de value speeds?