IKEA FÖRNUFTIG in Home-Assistant

So far I have managed to send any preset frequency to the fan, and its spins on various speed based on that, but I cannot figure out how to modify this on the the fly, lets say with a slide in HA

esphome:
  name: $devicename
  platform: ESP8266
  board: d1_mini

substitutions:
  devicename: esp82-fornuftig1
  friendly_name: FORNÜFTIG

# Insert your SSID and Your PWD after inital setup
wifi:
  networks:
    - ssid: "myssid"
      password: "mypass"
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Airfilteresp Fallback Hotspot"
    password: "pass"


# Enable logging
logger:
  logs:
      # Make adc input less verbose
      adc: INFO

# Enable Home Assistant API
api:
  password: xxxxxxxxxxx

# Enable OTA upgrade
ota:
  safe_mode: True
  password: "e5a460b498b3a7a1471b4cc7a443e45d"

output:
  - platform: esp8266_pwm
    pin: D1
    frequency: 50 Hz
    id: pwm_output


fan:
 - platform: speed
   output: pwm_output
   id: fan_internal
   name: "$friendly_name Fan"

I’m pretty sure its something with

- output.esp8266_pwm.set_frequency:

here ESP8266 Software PWM Output — ESPHome but I’m too novice for this.