if function issue

Thanks, this fixed it!

Now Google hysteresis to find out how to stop the system hunting around the target temperature and turning the fan on and off too frequently.