thermferm/thermferm.c

changeset 591
95cf33f8021f
parent 588
322a29000fd7
child 594
1904badedf8f
--- a/thermferm/thermferm.c	Sun Apr 28 19:59:43 2019 +0200
+++ b/thermferm/thermferm.c	Thu May 09 16:40:17 2019 +0200
@@ -21,7 +21,6 @@
  *****************************************************************************/
 
 #include "lock.h"
-#include "logger.h"
 #include "rdconfig.h"
 #include "devices.h"
 #include "server.h"
@@ -405,7 +404,6 @@
 {
     current_unit->mqtt_flag |= MQTT_FLAG_DATA;
     if ((current_unit->mode == UNITMODE_OFF) && (mode != UNITMODE_OFF)) {
-	initlog(current_unit->product_code, current_unit->product_name);
 	current_unit->mqtt_flag |= MQTT_FLAG_BIRTH;
     } else if ((current_unit->mode != UNITMODE_OFF) && (mode == UNITMODE_OFF)) {
 	current_unit->mqtt_flag |= MQTT_FLAG_DEATH;
@@ -1008,8 +1006,6 @@
 
 int server(void)
 {
-    char                buf[1024], *filename, target_lo[40], target_hi[40], heater[40], cooler[40], fan[40], door[40];
-    char		use_heater[40], use_cooler[40], use_fan[40], room_temp[40];
     time_t		now, last = (time_t)0, ndata = (time_t)0;;
     units_list		*unit;
     prof_step		*step;
@@ -1122,13 +1118,6 @@
 	} else {
 	    syslog(LOG_NOTICE, "Starting unit `%s' in off state", unit->alias);
 	}
-
-	/*
-	 * Initialize logfile
-	 */
-	if (unit->mode != UNITMODE_OFF) {
-	    initlog(unit->product_code, unit->product_name);
-	}
     }
     printf("Units started\n");
     publishDBirthAll();
@@ -1963,60 +1952,10 @@
 		seconds = 0;
 
 		/*
-		 * Log temperature and status every minute if unit is active.
+		 * Publish data every minute if unit is active.
 		 */
 		for (unit = Config.units; unit; unit = unit->next) {
 		    if (unit->mode != UNITMODE_OFF) {
-
-			snprintf(target_lo, 39, "NA");
-			snprintf(target_hi, 39, "NA");
-			snprintf(heater, 39, "NA");
-			snprintf(cooler, 39, "NA");
-			snprintf(fan, 39, "NA");
-			snprintf(door, 39, "NA");
-			snprintf(use_heater, 39, "NA");
-			snprintf(use_cooler, 39, "NA");
-			snprintf(use_fan, 39, "NA");
-			snprintf(room_temp, 39, "NA");
-
-			if ((unit->mode == UNITMODE_BEER) || (unit->mode == UNITMODE_FRIDGE) || (unit->mode == UNITMODE_PROFILE)) {
-			    snprintf(target_lo, 39, "%.1f", unit->PID_heat->SetP);
-			    snprintf(target_hi, 39, "%.1f", unit->PID_cool->SetP);
-			}
-
-			if (unit->heater_address) {
-			    snprintf(heater, 39, "%d", unit->heater_state);
-			    snprintf(use_heater, 39, "%d", unit->heater_usage);
-			}
-			if (unit->cooler_address) {
-			    snprintf(cooler, 39, "%d", unit->cooler_state);
-			    snprintf(use_cooler, 39, "%d", unit->cooler_usage);
-			}
-			if (unit->fan_address) {
-			    snprintf(fan, 39, "%d", unit->fan_state);
-			    snprintf(use_fan, 39, "%d", unit->fan_usage);
-			}
-			if (unit->door_address) {
-			    snprintf(door, 39, "%d", unit->door_state);
-			}
-			if (Config.temp_address) {
-			    snprintf(room_temp, 39, "%.3f", Config.temp_value / 1000.0);
-			}
-
-			snprintf(buf, 1023, "%s,%.3f,%.3f,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%.3f,%s",
-					UNITMODE[unit->mode], unit->air_temperature / 1000.0,
-					unit->beer_temperature / 1000.0,
-					target_lo, heater, cooler, fan, door, use_heater, use_cooler, use_fan, room_temp, target_hi,
-					unit->chiller_temperature / 1000.0,
-					(unit->event_msg) ? unit->event_msg : (char *)"");
-			filename = xstrcpy(unit->product_code);
-			filename = xstrcat(filename, (char *)" ");
-			filename = xstrcat(filename, unit->product_name);
-			filename = xstrcat(filename, (char *)".log");
-			logger(filename, buf);
-			free(filename);
-			filename = NULL;
-
 			publishDLog(unit);
 			if (unit->event_msg)
 			    free(unit->event_msg);

mercurial