ok here's the code just modify it to suit
when its connected to the fan
set the pid controller in home assistant a few degrees lower than your temp
run the auto tune and watch the output logs in esphome
might take some time it depends on your setup but at the the end it should say some shit...