Howto control fanspeeds using the LEDC-component?

Newbie on ESPhome here, working on my first project.

I want to ESPhome to control the speed of my fan using a temperature sensor. The temperature sensor is a Dallas-sensor.

Given a certain range, for example 20 to 50 degrees, I want the fan to speed up. Below 20 degrees the fan needs to be stopped, and the closer the temperature gets to 50 degrees, the faster the fan needs to go.

I have PWM fans, so the LEDC component (and an ESP32) looks awesome for this.

However, how can I control the fan speed within the temperature range?

I have the sensor programmed and working and of course the LEDC-component. But how do I connect them?

sensor:
  - platform: dallas
    address: 0x74030297944C1128
    name: "DBE Bart Links Temp"
    id: temp

output:
  - platform: ledc
    pin: GPIO19
    id: gpio_19

Did you see what https://esphome.io/components/fan/speed.html has to offer? Also this https://esphome.io/components/sensor/index.html#sensor-on-value-range might be useful in this case.