PWM output ESPhome

I‘m i trouble in integrating an EspHome in my HA. HA should read my solar production and my ESP should output a specific PWM level, depending on my overproduction.

Since you post in Esphome category, your problem is related to output pwm??