Need some help for auto fan control

seems that you have 2 different pieces of code controlling the fan.