Low voltage DC motor speed controller (irrigation pump)

I have built up a dripper system using an ESP8266 (NodeMCUv3) switching a low voltage DC pump from GPIO. The final control system will use HA automation with Ecowitt soil moisture sensors something like [ run pump for period > wait for stable moisture > check moisture]
However the pumps are running very fast so I need to PWM the output: Start the pump on 100% duty then to preset duty(s) after 2 seconds to extend pump life. So far I have just started to read and hopefully understand this [Guides — ESPHome] but hints and tips will be most welcome.

i have the same issue with the speed of my thermosolar pump. inside the ESP8266 (esp01) I now have set up an analog output with PWM. the output is adressed by light platform with attribute brightness (which can be set between 0…255) or between 0…100%. So i can use the “brightness level” to get an analog output between 0… 3,3 V. This output will thus be used to control the resistor of a TRIAC to modulate the pump speed. (this is under construction right now - probably via optocoupler). PS: you can also use fan platform…