ESP32 - PWM relay/heater control

Hi I’m seeking for a similar answer.

I want to adjust the power of an electric boiler via a Kemo M028 and M150.
https://www.kemo-electronic.de/en/Transformer-Dimmer/Converter/M150-DC-pulse-converter.php

https://www.kemo-electronic.de/en/Light-Sound/Effects/Modules/M028N-Power-control-110-240-V-AC-4000-VA.php
The M150 expects TTL rectangular pulses 5 V/DC, 1 - 10 kHz, pulse width approx. 10 - 90% PWM (Puls width modulation). Regulation is done by changing the pulse width.
I have an ESP32 board but as the GPIO outputs are working on 3.3V I also need a logical level converter to 5V.

I have all done, but I’m not familiar with the specific yaml code to start sending PWM signals to GPIO4 compatebel with the M150.
Next I want to adjust the PWM signal based on the numeric value of a helper input_number.injectie.