Templating a fan with API calls and presets

I am trying to configure a fan that calls presets using API calls.
I’ve tried several templates, but i just can’t wrap my head around it.

What I have got so far:

fan:
  - platform: template
    fans:
      afzuiging:
        friendly_name: "Afzuiging"
        unique_id: "afzuiging"
        turn_on:
          service: rest_command.afzuiging_high
        turn_off:
          service: rest_command.afzuiging_auto

These rest command are the api call, for example:

 rest_command:
   afzuiging_high:
     url: "http://nrg-itho-fc00.local/api.html?rfcommand=high"

I have several presets on my fan. Low, Medium, High and Auto.
I have an mqtt topic where the percentage of the current speed is shown.

state_topic: "itho/ithostatus" with this for the speed: value_json['Absolute speed of the fan (%)']
I can also get the current percentage with an API call, if that makes any difference. That would be located at http://nrg-itho-fc00.local/api.html?get=ithostatus. Which response is a json.

Is there somebody that can help me with setting up this fan and presets based on percentages from that mqtt topic? If you need more info, let me know!

Thanks in advance!

First, you’ll need a MQTT sensor that get’s that value out of the topic for use in template fan.

Second, are you sure you can’t send commands to this fan via MQTT?

A MQTT fan would be more ideal than an MQTT sensor and template fan.

Unfortunately I can’t control it with MQTT, yet.
This esp addon for my mechanical ventilation is still in the works.

So up to then I have to use API calls.
Which work fine for the time being. I managed to create buttons for it with the restful commands.

I can create a sensor that reads the percentage of the fan, I already have one for the current speed (rpm).