ESP32 LEDC Output variable frequency

Hi

I’m running the esp 32 (esphome) talking to a VFD in combination with Homey(home automation).
And I want to have a slider (0/100%) in homey, and the esp to output 0hz to 100hz.
first I had written a code to have it working with PWM but my VFD doesn’t support PWM.
This code works good with esp.

number:
  - platform: template
    name: Pomp %
    optimistic: true
    min_value: 0
    max_value: 100
    step: 1
    mode: slider
    on_value:
      then:
        lambda: 'id(PWM).set_level(x/100);'

output:
  - platform: ledc
    pin: GPIO26
    id: PWM
    frequency: 100Hz
    inverted: true

But when I change the code to get variable frequency the output of the esp goes all over the place (frequency and pulse with) and output doesn’t change with the slider.

number:
  - platform: template
    name: Pomp %
    optimistic: true
    min_value: 0
    max_value: 100
    step: 1
    mode: slider
    on_value:
      then:
        lambda: 'id(freq).set_frequency(x);'
        

output:
  - platform: ledc
    pin: GPIO26
    id: freq

how do I get this working

Hi, have you made it work? Can I also find your solution?

Thanks.

Not yet tried, but looks another method to be used - update_frequency.
See in ledc component code:

  void set_frequency(float frequency) { this->frequency_ = frequency; }
  /// Dynamically change frequency at runtime
  void update_frequency(float frequency) override;