Smoth fan control

I made a fan with a smooth speed change

The AC fan is connected to an autotransformer that can accept singal 0-10V.
To connect to the smart home, I used a dimmer with an output of 0-10V (Shenzhen Homa HLC610-Z).
The fan is controlled. but it has one problem it is visible in the ligh domain.
I can’t set up smooth speed control in the range 0-254.

    pre_fan:
        friendly_name: "вентилятор  подпора"
        value_template: "{{ states('light.pre_fan') }}"
        speed_template: "{{ states('input_number.pre_fan_speed') }}"
        turn_off:
          service:  light.turn_off
          target:
            entity_id: light.pre_fan          
        turn_on:
          service:  light.turn_on
          data_template:
            entity_id: light.pre_fan
            brightness: "{{ states.input_number.pre_fan_speed.state }}"            
        set_speed:
          service: script.pre_fan_speed
          data_template:
            speed:  "{{ states.input_number.pre_fan_speed.state }}"

Help to determine the fan speed in the form of a numeric range