How to convert a switch to a fan?

I have connected the remote of my ventilation system by using switches.
and in esphome i have:


switch:
  - platform: gpio    
    pin: D7
    name: Fanspeed1
    icon: "mdi:fan-speed-1"
    id: stand1
    interlock: [stand2, stand3,stand4]
    #on_turn_on:
    #- delay: 500ms
    #- switch.turn_off: stand1    
  - platform: gpio
    pin: D6
    name: Fanspeed2
    icon: "mdi:fan-speed-2"
    id: stand2
    interlock: [stand1, stand3, stand4]
    #on_turn_on:
    #- delay: 500ms
    #- switch.turn_off: stand2    
  - platform: gpio    
    pin:  D5
    name: Fanspeed3
    icon: "mdi:fan-speed-3"
    id: stand3
    interlock: [stand1, stand2,stand4]
    #on_turn_on:
    #- delay: 500ms
    #- switch.turn_off: stand2
  - platform: gpio
    pin: D8
    name: Fanspeed4
    id: stand4
    interlock: [stand1, stand2,stand3]
    icon: "mdi:fan-auto"

How can I convert this to a fan entity that can Only have 1 state at the time? Do i have to solve that in home assistant or in esphome?

I thin by using on_speed_set Fan Component — ESPHome