diff -r 5874a6480322 -r b69438db19ec thermferm/thermferm.c --- a/thermferm/thermferm.c Wed Aug 13 21:04:29 2014 +0200 +++ b/thermferm/thermferm.c Wed Aug 13 21:21:55 2014 +0200 @@ -722,17 +722,27 @@ syslog(LOG_NOTICE, "sp=%.2f pv=%.2f err_old=%.2f err=%.2f P_err=%.2f I_err=%.2f D_err=%.2f Out=%.2f", sp, pv, unit->PID_err_old, err, P_err, unit->PID_I_err, D_err, Out); if (unit->heater_address) { - if (Out >= 2) + if (Out >= 2) { + if (! unit->heater_state) + syslog(LOG_NOTICE, "Heater Off => On"); unit->heater_state = 100; - else + } else { + if (unit->heater_state) + syslog(LOG_NOTICE, "Heater On => Off"); unit->heater_state = 0; + } device_out(unit->heater_address, unit->heater_state); } if (unit->cooler_address) { - if (Out <= -2) + if (Out <= -2) { + if (! unit->cooler_state) + syslog(LOG_NOTICE, "Cooler Off => On"); unit->cooler_state = 100; - else + } else { + if (unit->cooler_state) + syslog(LOG_NOTICE, "Cooler On => Off"); unit->cooler_state = 0; + } device_out(unit->cooler_address, unit->cooler_state); } if (unit->heater_address && unit->cooler_address && unit->fan_address) { @@ -745,8 +755,12 @@ */ if (((unit->air_temperature - unit->beer_temperature) > 1000) || ((unit->air_temperature - unit->beer_temperature) < -1000)) { + if (! unit->fan_state) + syslog(LOG_NOTICE, "Fan Off => On"); unit->fan_state = 100; } else { + if (unit->fan_state) + syslog(LOG_NOTICE, "Fan On => Off"); unit->fan_state = 0; } device_out(unit->fan_address, unit->fan_state);