Common PWN FAN doesn't stop on 0% PWM signal and still running on minimum RPM. It is possible to control the fan speed not by fan PWM, but by PWM of DC input. In that case the fan can be stopped, but RPM data from the fan is messed up.
We will start/stop the fan with a MOSFET and set the speed with the FAN PWM input signal.
Be careful while connect PSU +12V and GND to MOSFET.
Tested on ESPHome v 1.20.1
A little bit trick to stop PWM fan is set 100% level of PWM on output. That's why I do not use power_supply component.
My fan has maximum 1200 RPM so I filtered out RPM above 1500.