thermferm/thermferm.c

changeset 352
a8e106c95db4
parent 350
7283561977b1
child 355
8f946f9d125a
--- a/thermferm/thermferm.c	Wed Apr 01 22:10:59 2015 +0200
+++ b/thermferm/thermferm.c	Wed Apr 01 22:37:28 2015 +0200
@@ -1364,13 +1364,13 @@
 			    unit->light_wait--;
 			} else {
 			    unit->light_state = 0;
-			    syslog(LOG_NOTICE, "Lights On => Off");
+			    syslog(LOG_NOTICE, "Unit `%s' lights On => Off", unit->name);
 			}
 		    }
 		    if (!unit->door_state && !unit->light_state) {
 			unit->light_wait = unit->light_delay;   /* No delay to turn lights on   */
 			unit->light_state = 1;
-			syslog(LOG_NOTICE, "Lights Off => On");
+			syslog(LOG_NOTICE, "Unit `%s' lights Off => On", unit->name);
 		    }
 		    device_out(unit->light_address, unit->light_state);
 		}
@@ -1440,32 +1440,31 @@
 			} else {
 			    Out = 0.0;
 			}
-			if (((Out >= 1) && unit->heater_address) || ((Out <= -1) && unit->cooler_address) ||
-			    (seconds == 60) || unit->heater_state || unit->cooler_state) {
-			    syslog(LOG_NOTICE, "sp=%.2f pv=%.2f P_err=%.2f Out=%.2f",
-				sp, pv, P_err, Out);
-			}
+//			if (((Out >= 1) && unit->heater_address) || ((Out <= -1) && unit->cooler_address) ||
+//			    (seconds == 60) || unit->heater_state || unit->cooler_state) {
+//			    syslog(LOG_NOTICE, "sp=%.2f pv=%.2f P_err=%.2f Out=%.2f", sp, pv, P_err, Out);
+//			}
 		    }
 
 		    if (unit->heater_address && ! unit->cooler_state) {
 			if (Out >= 1) {
 			    if (unit->heater_wait < unit->heater_delay) {
 				unit->heater_wait++;
-				syslog(LOG_NOTICE, "heater_wait + %d/%d", unit->heater_wait, unit->heater_delay);
+//				syslog(LOG_NOTICE, "heater_wait + %d/%d", unit->heater_wait, unit->heater_delay);
 			    } else {
 				int	power = round(Out);
 				if (unit->heater_state != power) {
-				    syslog(LOG_NOTICE, "Heater %d%% => %d%%", unit->heater_state, power);
+				    syslog(LOG_NOTICE, "Unit `%s' heater %d%% => %d%%", unit->name, unit->heater_state, power);
 				    unit->heater_state = power;
 				}
 			    }
 			} else {
 			    if (unit->heater_wait > 0) {
 				unit->heater_wait--;
-				syslog(LOG_NOTICE, "heater_wait - %d/%d", unit->heater_wait, unit->heater_delay);
+//				syslog(LOG_NOTICE, "heater_wait - %d/%d", unit->heater_wait, unit->heater_delay);
 			    } else {
 				if (unit->heater_state) {
-				    syslog(LOG_NOTICE, "Heater On => Off");
+				    syslog(LOG_NOTICE, "Unit `%s' heater On => Off", unit->name);
 				    unit->heater_state = 0;
 				}
 			    }
@@ -1480,21 +1479,21 @@
 			if (Out <= -1) {
 			    if (unit->cooler_wait < unit->cooler_delay) {
 				unit->cooler_wait++;
-				syslog(LOG_NOTICE, "cooler_wait + %d/%d", unit->cooler_wait, unit->cooler_delay);
+//				syslog(LOG_NOTICE, "cooler_wait + %d/%d", unit->cooler_wait, unit->cooler_delay);
 			    } else {
 				int	power = round(0 - Out); 
 				if (unit->cooler_state != power) {
-				    syslog(LOG_NOTICE, "Cooler %d%% => %d%%", unit->cooler_state, power);
+				    syslog(LOG_NOTICE, "Unit `%s' cooler %d%% => %d%%", unit->name, unit->cooler_state, power);
 				    unit->cooler_state = power;
 				}
 			    }
 			} else {
 			    if (unit->cooler_wait > 0) {
 				unit->cooler_wait--;
-				syslog(LOG_NOTICE, "cooler_wait - %d/%d", unit->cooler_wait, unit->cooler_delay);
+//				syslog(LOG_NOTICE, "cooler_wait - %d/%d", unit->cooler_wait, unit->cooler_delay);
 			    } else {
 				if (unit->cooler_state) {
-				    syslog(LOG_NOTICE, "Cooler On => Off");
+				    syslog(LOG_NOTICE, "Unit `%s' cooler On => Off", unit->name);
 				    unit->cooler_state = 0;
 				}
 			    }
@@ -1513,20 +1512,20 @@
 			if ((unit->heater_address && unit->heater_state) || (unit->cooler_address && unit->cooler_state)) {
 			    if (unit->fan_wait < unit->fan_delay) {
 				unit->fan_wait++;
-				syslog(LOG_NOTICE, "fan_wait + %d/%d", unit->fan_wait, unit->fan_delay);
+//				syslog(LOG_NOTICE, "fan_wait + %d/%d", unit->fan_wait, unit->fan_delay);
 			    } else {
 				if (! unit->fan_state) {
-				    syslog(LOG_NOTICE, "Fan Off => On");
+				    syslog(LOG_NOTICE, "Unit `%s' Fan Off => On", unit->name);
 			    	    unit->fan_state = 100;
 				}
 			    }
 			} else {
 			    if (unit->fan_wait > 0) {
 				unit->fan_wait--;
-				syslog(LOG_NOTICE, "fan_wait - %d/%d", unit->fan_wait, unit->fan_delay);
+//				syslog(LOG_NOTICE, "fan_wait - %d/%d", unit->fan_wait, unit->fan_delay);
 			    } else {
 			    	if (unit->fan_state) {
-				    syslog(LOG_NOTICE, "Fan On => Off");
+				    syslog(LOG_NOTICE, "Unit `%s' Fan On => Off", unit->name);
 			    	    unit->fan_state = 0;
 				}
 			    }
@@ -1649,7 +1648,7 @@
 	device_out(unit->cooler_address, unit->cooler_state);
 	device_out(unit->fan_address, unit->fan_state);
 	device_out(unit->light_address, unit->light_state);
-	syslog(LOG_NOTICE, "Stopped unit %s mode %s", unit->name, UNITMODE[unit->mode]);
+	syslog(LOG_NOTICE, "Unit `%s' stopped in mode %s", unit->name, UNITMODE[unit->mode]);
     }
 
     if (debug)

mercurial