Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.

Thu, 07 Feb 2019 14:59:47 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 07 Feb 2019 14:59:47 +0100
changeset 578
d694abd9d809
parent 577
7a29f835e20a
child 579
7032693272f1

Version 0.9.3. Splitted the temperature low and high settings in fridge and beer mode.

configure file | annotate | diff | comparison | revisions
configure.ac file | annotate | diff | comparison | revisions
thermferm/mqtt.c file | annotate | diff | comparison | revisions
thermferm/rdconfig.c file | annotate | diff | comparison | revisions
thermferm/server.c file | annotate | diff | comparison | revisions
thermferm/thermferm.c file | annotate | diff | comparison | revisions
thermferm/thermferm.h file | annotate | diff | comparison | revisions
www-thermferm/getstate.php file | annotate | diff | comparison | revisions
www-thermferm/index.php file | annotate | diff | comparison | revisions
www-thermferm/liveview.php file | annotate | diff | comparison | revisions
--- a/configure	Mon Jan 21 17:11:50 2019 +0100
+++ b/configure	Thu Feb 07 14:59:47 2019 +0100
@@ -2035,7 +2035,7 @@
 
 
 PACKAGE="mbsePi-apps"
-VERSION="0.9.2"
+VERSION="0.9.3"
 COPYRIGHT="Copyright (C) 2014-2019 Michiel Broek, All Rights Reserved"
 CYEARS="2014-2019"
 
--- a/configure.ac	Mon Jan 21 17:11:50 2019 +0100
+++ b/configure.ac	Thu Feb 07 14:59:47 2019 +0100
@@ -8,7 +8,7 @@
 dnl General settings
 dnl After changeing the version number, run autoconf!
 PACKAGE="mbsePi-apps"
-VERSION="0.9.2"
+VERSION="0.9.3"
 COPYRIGHT="Copyright (C) 2014-2019 Michiel Broek, All Rights Reserved"
 CYEARS="2014-2019"
 AC_SUBST(PACKAGE)
--- a/thermferm/mqtt.c	Mon Jan 21 17:11:50 2019 +0100
+++ b/thermferm/mqtt.c	Thu Feb 07 14:59:47 2019 +0100
@@ -290,10 +290,13 @@
 					    unit->PID_heat->SetP = json_object_get_double(val);
 				    	if (json_object_object_get_ex(setpoint, "high", &val))
 					    unit->PID_cool->SetP = json_object_get_double(val);
-					if (unit->mode == UNITMODE_FRIDGE)
-					    unit->fridge_set = unit->PID_heat->SetP + ((unit->PID_cool->SetP - unit->PID_heat->SetP) / 2);
-					else
-					    unit->beer_set = unit->PID_heat->SetP + ((unit->PID_cool->SetP - unit->PID_heat->SetP) / 2);
+					if (unit->mode == UNITMODE_FRIDGE) {
+					    unit->fridge_set_lo = unit->PID_heat->SetP;
+					    unit->fridge_set_hi = unit->PID_cool->SetP;
+					} else {
+					    unit->beer_set_lo = unit->PID_heat->SetP;
+					    unit->beer_set_hi = unit->PID_cool->SetP;
+					}
 					unit->mqtt_flag |= MQTT_FLAG_DATA;
 					syslog(LOG_NOTICE, "DCMD change fermenter %s: setpoints %.1f %.1f", message_alias, unit->PID_heat->SetP, unit->PID_cool->SetP);
 				    }
--- a/thermferm/rdconfig.c	Mon Jan 21 17:11:50 2019 +0100
+++ b/thermferm/rdconfig.c	Thu Feb 07 14:59:47 2019 +0100
@@ -322,8 +322,10 @@
 	    }
 	    xmlTextWriterWriteFormatElement(writer, BAD_CAST "MODE", "%s", UNITMODE[tmp3->mode] );
 	    xmlTextWriterWriteFormatElement(writer, BAD_CAST "STAGE", "%s", UNITSTAGE[tmp3->stage] );
-	    xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_SET", "%.1f", tmp3->beer_set);
-	    xmlTextWriterWriteFormatElement(writer, BAD_CAST "FRIDGE_SET", "%.1f", tmp3->fridge_set);
+	    xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_SET_LO", "%.1f", tmp3->beer_set_lo);
+	    xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_SET_HI", "%.1f", tmp3->beer_set_hi);
+	    xmlTextWriterWriteFormatElement(writer, BAD_CAST "FRIDGE_SET_LO", "%.1f", tmp3->fridge_set_lo);
+	    xmlTextWriterWriteFormatElement(writer, BAD_CAST "FRIDGE_SET_HI", "%.1f", tmp3->fridge_set_hi);
 	    xmlTextWriterWriteFormatElement(writer, BAD_CAST "TEMP_SET_MIN", "%.1f", tmp3->temp_set_min);
 	    xmlTextWriterWriteFormatElement(writer, BAD_CAST "TEMP_SET_MAX", "%.1f", tmp3->temp_set_max);
 
@@ -569,8 +571,8 @@
 		 unit->cooler_address = unit->fan_address = unit->door_address = \
 		 unit->light_address = unit->psu_address = unit->profile_uuid = unit->profile_name  = NULL;
     unit->volume = unit->prof_peak_abs = unit->prof_peak_rel = 0.0;
-    unit->air_temperature = unit->beer_temperature = unit->chiller_temperature = unit->beer_set = \
-			    unit->fridge_set = unit->profile_inittemp_lo = unit->profile_inittemp_hi = 20.0;
+    unit->air_temperature = unit->beer_temperature = unit->chiller_temperature = unit->beer_set_lo = unit->beer_set_hi = \
+			    unit->fridge_set_lo = unit->fridge_set_hi = unit->profile_inittemp_lo = unit->profile_inittemp_hi = 20.0;
     unit->air_state = unit->beer_state = unit->chiller_state = 1; // missing
     unit->heater_state = unit->cooler_state = unit->fan_state = unit->door_state = \
 			 unit->light_state = unit->psu_state = unit->mode = unit->prof_state = unit->stage = 0;
@@ -799,16 +801,40 @@
 	    }
 	    xmlFree(key);
 	}
-	if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEER_SET"))) {
+	if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEER_SET"))) {	// Remove in 2020.
+	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
+	    if (sscanf((const char *)key, "%f", &val) == 1)
+		unit->beer_set_lo = unit->beer_set_hi = val;
+	    xmlFree(key);
+	}
+	if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEER_SET_LO"))) {
+	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
+	    if (sscanf((const char *)key, "%f", &val) == 1)
+		unit->beer_set_lo = val;
+	    xmlFree(key);
+	}
+	if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEER_SET_HI"))) {
 	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
 	    if (sscanf((const char *)key, "%f", &val) == 1)
-		unit->beer_set = val;
+		unit->beer_set_hi = val;
+	    xmlFree(key);
+	}
+	if ((!xmlStrcmp(cur->name, (const xmlChar *)"FRIDGE_SET"))) {	// Remove in 2020
+	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
+	    if (sscanf((const char *)key, "%f", &val) == 1)
+		unit->fridge_set_lo = unit->fridge_set_hi = val;
 	    xmlFree(key);
 	}
-	if ((!xmlStrcmp(cur->name, (const xmlChar *)"FRIDGE_SET"))) {
+	if ((!xmlStrcmp(cur->name, (const xmlChar *)"FRIDGE_SET_LO"))) {
 	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
 	    if (sscanf((const char *)key, "%f", &val) == 1)
-		unit->fridge_set = val;
+		unit->fridge_set_lo = val;
+	    xmlFree(key);
+	}
+	if ((!xmlStrcmp(cur->name, (const xmlChar *)"FRIDGE_SET_HI"))) {
+	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
+	    if (sscanf((const char *)key, "%f", &val) == 1)
+		unit->fridge_set_hi = val;
 	    xmlFree(key);
 	}
 	if ((!xmlStrcmp(cur->name, (const xmlChar *)"TEMP_SET_MIN"))) {
--- a/thermferm/server.c	Mon Jan 21 17:11:50 2019 +0100
+++ b/thermferm/server.c	Thu Feb 07 14:59:47 2019 +0100
@@ -1697,7 +1697,7 @@
 	unit->volume = unit->prof_peak_abs = unit->prof_peak_rel = 0.0;
 	unit->air_state = unit->beer_state = unit->chiller_state = 1;
 	unit->air_temperature = unit->beer_temperature = unit->chiller_temperature = 20000;
-	unit->beer_set = unit->fridge_set = unit->profile_inittemp_lo = unit->profile_inittemp_hi =20.0;
+	unit->beer_set_lo = unit->beer_set_hi = unit->fridge_set_lo = unit->fridge_set_hi = unit->profile_inittemp_lo = unit->profile_inittemp_hi =20.0;
 	unit->heater_state = unit->cooler_state = unit->fan_state = unit->door_state = unit->mode = \
 			     unit->light_state = unit->psu_state = unit->prof_state = unit->stage = 0;
 	unit->heater_delay = unit->cooler_delay = unit->fan_delay = 20;	/* 5 minutes delay	*/
@@ -1831,8 +1831,10 @@
 		srv_send((char *)"PSU_ADDRESS,%s", unit->psu_address);
 		srv_send((char *)"PSU_STATE,%d", unit->psu_state);
 		srv_send((char *)"PSU_IDX,%d", unit->psu_idx);
-		srv_send((char *)"FRIDGE_SET,%.1f", unit->fridge_set);
-		srv_send((char *)"BEER_SET,%.1f", unit->beer_set);
+		srv_send((char *)"FRIDGE_SET_LO,%.1f", unit->fridge_set_lo);
+		srv_send((char *)"FRIDGE_SET_HI,%.1f", unit->fridge_set_hi);
+		srv_send((char *)"BEER_SET_LO,%.1f", unit->beer_set_lo);
+		srv_send((char *)"BEER_SET_HI,%.1f", unit->beer_set_hi);
 		if (unit->profile_uuid) {
 		    srv_send((char *)"PROFILE_UUID,%s", unit->profile_uuid);
 		    srv_send((char *)"PROFILE_NAME,%s", unit->profile_name);
@@ -2224,19 +2226,35 @@
 				    }
 				}
 
-			    } else if (val && (strcmp(kwd, (char *)"FRIDGE_SET") == 0)) {
+			    } else if (val && (strcmp(kwd, (char *)"FRIDGE_SET_LO") == 0)) {
 				if ((sscanf(val, "%f", &fval) == 1) && (fval >= unit->temp_set_min) && (fval <= unit->temp_set_max)) {
-				    if (unit->fridge_set != fval)
-				    	syslog(LOG_NOTICE, "Fermenter unit %s fridge temperature %.1f to %.1f", unit->uuid, unit->fridge_set, fval);
-				    unit->fridge_set = fval;
+				    if (unit->fridge_set_lo != fval)
+				    	syslog(LOG_NOTICE, "Fermenter unit %s fridge temp low %.1f to %.1f", unit->uuid, unit->fridge_set_lo, fval);
+				    unit->fridge_set_lo = fval;
 				    unit->mqtt_flag |= MQTT_FLAG_DATA;
 				}
 
-			    } else if (val && (strcmp(kwd, (char *)"BEER_SET") == 0)) {
+			    } else if (val && (strcmp(kwd, (char *)"FRIDGE_SET_HI") == 0)) {
+				if ((sscanf(val, "%f", &fval) == 1) && (fval >= unit->temp_set_min) && (fval <= unit->temp_set_max)) {
+				    if (unit->fridge_set_hi != fval)
+					syslog(LOG_NOTICE, "Fermenter unit %s fridge temp high %.1f to %.1f", unit->uuid, unit->fridge_set_hi, fval);
+				    unit->fridge_set_hi = fval;
+				    unit->mqtt_flag |= MQTT_FLAG_DATA;
+			    	}
+
+			    } else if (val && (strcmp(kwd, (char *)"BEER_SET_LO") == 0)) {
 				if ((sscanf(val, "%f", &fval) == 1) && (fval >= unit->temp_set_min) && (fval <= unit->temp_set_max)) {
-				    if (unit->beer_set != fval)
-				    	syslog(LOG_NOTICE, "Fermenter unit %s beer temperature %.1f to %.1f", unit->uuid, unit->beer_set, fval);
-				    unit->beer_set = fval;
+				    if (unit->beer_set_lo != fval)
+				    	syslog(LOG_NOTICE, "Fermenter unit %s beer temp low %.1f to %.1f", unit->uuid, unit->beer_set_lo, fval);
+				    unit->beer_set_lo = fval;
+				    unit->mqtt_flag |= MQTT_FLAG_DATA;
+				}
+
+			    } else if (val && (strcmp(kwd, (char *)"BEER_SET_HI") == 0)) {
+				if ((sscanf(val, "%f", &fval) == 1) && (fval >= unit->temp_set_min) && (fval <= unit->temp_set_max)) {
+				    if (unit->beer_set_hi != fval)
+					syslog(LOG_NOTICE, "Fermenter unit %s beer temp high %.1f to %.1f", unit->uuid, unit->beer_set_hi, fval);
+				    unit->beer_set_hi = fval;
 				    unit->mqtt_flag |= MQTT_FLAG_DATA;
 				}
 
--- a/thermferm/thermferm.c	Mon Jan 21 17:11:50 2019 +0100
+++ b/thermferm/thermferm.c	Thu Feb 07 14:59:47 2019 +0100
@@ -150,8 +150,6 @@
 #endif
     slcdClear(slcdHandle);
     slcdPosition(slcdHandle, 0, 0);
-
-    syslog(LOG_NOTICE, "from menu %d to menu %d", setupmenu, menu);
     setupmenu = menu;
 
     switch (menu) {
@@ -230,14 +228,27 @@
 				slcdPuts(slcdHandle, "New mode BEER");
 				break;
 
-	case MENU_BEER_TEMP:	
-#ifdef HAVE_WIRINGPI_H				
-				lcdPuts(lcdHandle, "Set beer temp");
+	case MENU_BEER_TEMP_LO:
+#ifdef HAVE_WIRINGPI_H
+				lcdPuts(lcdHandle, "Set beer low");
 				lcdPosition(lcdHandle, 0, 1);
 #endif
-				slcdPuts(slcdHandle, "Set beer temp");
+				slcdPuts(slcdHandle, "Set beer low");
 				slcdPosition(slcdHandle, 0, 1);
+				snprintf(buf, Config.lcd_cols, "Set %.1f", temp_temp);
+#ifdef HAVE_WIRINGPI_H
+				lcdPuts(lcdHandle, buf);
+#endif
+				slcdPuts(slcdHandle, buf);
+				break;
 
+        case MENU_BEER_TEMP_HI:
+#ifdef HAVE_WIRINGPI_H
+				lcdPuts(lcdHandle, "Set beer high");
+				lcdPosition(lcdHandle, 0, 1);
+#endif
+				slcdPuts(slcdHandle, "Set beer high");
+				slcdPosition(slcdHandle, 0, 1);
 				snprintf(buf, Config.lcd_cols, "Set %.1f", temp_temp);
 #ifdef HAVE_WIRINGPI_H
 				lcdPuts(lcdHandle, buf);
@@ -252,12 +263,26 @@
 				slcdPuts(slcdHandle, "New mode FRIDGE");
 				break;
 
-	case MENU_FRIDGE_TEMP:	
-#ifdef HAVE_WIRINGPI_H				
-				lcdPuts(lcdHandle, "Set fridge temp");
+	case MENU_FRIDGE_TEMP_LO:
+#ifdef HAVE_WIRINGPI_H
+				lcdPuts(lcdHandle, "Set fridge low");
 				lcdPosition(lcdHandle, 0, 1);
 #endif
-				slcdPuts(slcdHandle, "Set fridge temp");
+				slcdPuts(slcdHandle, "Set fridge low");
+				slcdPosition(slcdHandle, 0, 1);
+				snprintf(buf, Config.lcd_cols, "Set %.1f", temp_temp);
+#ifdef HAVE_WIRINGPI_H
+				lcdPuts(lcdHandle, buf);
+#endif
+				slcdPuts(slcdHandle, buf);
+				break;
+
+        case MENU_FRIDGE_TEMP_HI:
+#ifdef HAVE_WIRINGPI_H
+				lcdPuts(lcdHandle, "Set fridge high");
+				lcdPosition(lcdHandle, 0, 1);
+#endif
+				slcdPuts(slcdHandle, "Set fridge high");
 				slcdPosition(slcdHandle, 0, 1);
 				snprintf(buf, Config.lcd_cols, "Set %.1f", temp_temp);
 #ifdef HAVE_WIRINGPI_H
@@ -578,8 +603,8 @@
 			    go_menu(MENU_MODE_NONE);
 			if (key == KEY_ENTER) {
 			    if (current_unit->mode == UNITMODE_FRIDGE) {
-				temp_temp = current_unit->fridge_set;
-				go_menu(MENU_FRIDGE_TEMP);
+				temp_temp = current_unit->fridge_set_lo;
+				go_menu(MENU_FRIDGE_TEMP_LO);
 			    } else {
 			    	change_mode(UNITMODE_FRIDGE);
 			    	go_menu(MENU_MODE_FRIDGE);
@@ -587,23 +612,49 @@
 			}
 			break;
 
-	case MENU_FRIDGE_TEMP:
+	case MENU_FRIDGE_TEMP_LO:
+			if (key == KEY_ESCAPE) {
+			    temp_temp = current_unit->fridge_set_hi;
+			    go_menu(MENU_FRIDGE_TEMP_HI);
+			}
+			if (key == KEY_DOWN) {
+			    if (temp_temp > current_unit->temp_set_min)
+				temp_temp -= 0.1;
+			    go_menu(MENU_FRIDGE_TEMP_LO);
+			}
+			if (key == KEY_UP) {
+			    if (temp_temp < current_unit->temp_set_max)
+				temp_temp += 0.1;
+			    go_menu(MENU_FRIDGE_TEMP_LO);
+			}
+			if (key == KEY_CONFIRM) {
+			    if (temp_temp != current_unit->fridge_set_lo) {
+				syslog(LOG_NOTICE, "Fridge temp low changed from %.1f to %.1f from the panel", current_unit->fridge_set_lo, temp_temp);
+				current_unit->fridge_set_lo = temp_temp;
+				current_unit->mqtt_flag |= MQTT_FLAG_DATA;
+			    }
+			    temp_temp = current_unit->fridge_set_hi;
+			    go_menu(MENU_FRIDGE_TEMP_HI);
+			}
+			break;
+
+	case MENU_FRIDGE_TEMP_HI:
 			if (key == KEY_ESCAPE)
 			    go_menu(MENU_MODE_FRIDGE);
 			if (key == KEY_DOWN) {
 			    if (temp_temp > current_unit->temp_set_min)
 				temp_temp -= 0.1;
-			    go_menu(MENU_FRIDGE_TEMP);
+			    go_menu(MENU_FRIDGE_TEMP_HI);
 			}
 			if (key == KEY_UP) {
 			    if (temp_temp < current_unit->temp_set_max)
 				temp_temp += 0.1;
-			    go_menu(MENU_FRIDGE_TEMP);
+			    go_menu(MENU_FRIDGE_TEMP_HI);
 			}
 			if (key == KEY_CONFIRM) {
-			    if (temp_temp != current_unit->fridge_set) {
-				syslog(LOG_NOTICE, "Fridge temperature changed from %.1f to %.1f degrees from the panel", current_unit->fridge_set, temp_temp);
-				current_unit->fridge_set = temp_temp;
+			    if (temp_temp != current_unit->fridge_set_hi) {
+				syslog(LOG_NOTICE, "Fridge temp high changed from %.1f to %.1f from the panel", current_unit->fridge_set_hi, temp_temp);
+				current_unit->fridge_set_hi = temp_temp;
 				current_unit->mqtt_flag |= MQTT_FLAG_DATA;
 			    }
 			    go_menu(MENU_MODE_FRIDGE);
@@ -623,8 +674,8 @@
 			    go_menu(MENU_MODE_FRIDGE);
 			if (key == KEY_ENTER) {
 			    if (current_unit->mode == UNITMODE_BEER) {
-				temp_temp = current_unit->beer_set;
-				go_menu(MENU_BEER_TEMP);
+				temp_temp = current_unit->beer_set_lo;
+				go_menu(MENU_BEER_TEMP_LO);
 			    } else {
 			    	change_mode(UNITMODE_BEER);
 			    	go_menu(MENU_MODE_BEER);
@@ -632,26 +683,52 @@
 			}
 			break;
 
-	case MENU_BEER_TEMP:
+	case MENU_BEER_TEMP_LO:
+			if (key == KEY_ESCAPE) {
+			    temp_temp = current_unit->beer_set_hi;
+			    go_menu(MENU_BEER_TEMP_HI);
+			}
+			if (key == KEY_DOWN) {
+			    if (temp_temp > current_unit->temp_set_min)
+				temp_temp -= 0.1;
+			    go_menu(MENU_BEER_TEMP_LO);
+			}
+			if (key == KEY_UP) {
+			    if (temp_temp < current_unit->temp_set_max)
+				temp_temp += 0.1;
+			    go_menu(MENU_BEER_TEMP_LO);
+			}
+			if (key == KEY_CONFIRM) {
+			    if (temp_temp != current_unit->beer_set_lo ) {
+				syslog(LOG_NOTICE, "Beer temp low changed from %.1f to %.1f from the panel", current_unit->beer_set_lo, temp_temp);
+				current_unit->beer_set_lo = temp_temp;
+				current_unit->mqtt_flag |= MQTT_FLAG_DATA;
+			    }
+			    temp_temp = current_unit->beer_set_hi;
+			    go_menu(MENU_BEER_TEMP_HI);
+			}
+			break;
+
+	case MENU_BEER_TEMP_HI:
 			if (key == KEY_ESCAPE)
 			    go_menu(MENU_MODE_BEER);
 			if (key == KEY_DOWN) {
 			    if (temp_temp > current_unit->temp_set_min)
 				temp_temp -= 0.1;
-			    go_menu(MENU_BEER_TEMP);
+			    go_menu(MENU_BEER_TEMP_HI);
 			}
 			if (key == KEY_UP) {
 			    if (temp_temp < current_unit->temp_set_max)
 				temp_temp += 0.1;
-			    go_menu(MENU_BEER_TEMP);
+			    go_menu(MENU_BEER_TEMP_HI);
 			}
 			if (key == KEY_CONFIRM) {
-			    if (temp_temp != current_unit->beer_set) {
-				syslog(LOG_NOTICE, "Beer temperature changed from %.1f to %.1f degrees from the panel", current_unit->beer_set, temp_temp);
-				current_unit->beer_set = temp_temp;
+			    if (temp_temp != current_unit->beer_set_hi ) {
+				syslog(LOG_NOTICE, "Beer temp high changed from %.1f to %.1f from the panel", current_unit->beer_set_hi, temp_temp);
+				current_unit->beer_set_hi = temp_temp;
 				current_unit->mqtt_flag |= MQTT_FLAG_DATA;
 			    }
-			    go_menu(MENU_MODE_BEER);			    
+			    go_menu(MENU_MODE_BEER);
 			}
 			break;
 
@@ -1037,9 +1114,9 @@
 	    	syslog(LOG_NOTICE, "Starting unit `%s' in profile state %s.", unit->alias, PROFSTATE[unit->prof_state]);
 	    }
 	} else if (unit->mode == UNITMODE_BEER) {
-	    syslog(LOG_NOTICE, "Starting unit `%s' beer cooler at %.1f degrees", unit->alias, unit->beer_set);
+	    syslog(LOG_NOTICE, "Starting unit `%s' beer cooler at %.1f - %.1f degrees", unit->alias, unit->beer_set_lo, unit->beer_set_hi);
 	} else if (unit->mode == UNITMODE_FRIDGE) {
-	    syslog(LOG_NOTICE, "Starting unit `%s' as refridgerator at %.1f degrees", unit->alias, unit->fridge_set);
+	    syslog(LOG_NOTICE, "Starting unit `%s' as refridgerator at %.1f - %.1f degrees", unit->alias, unit->fridge_set_lo, unit->fridge_set_hi);
 	} else if (unit->mode == UNITMODE_NONE) {
 	    syslog(LOG_NOTICE, "Starting unit `%s' in inactive state", unit->alias);
 	} else {
@@ -1588,13 +1665,13 @@
 		     */
 		    unit->PID_cool->Mode = unit->PID_heat->Mode = PID_MODE_NONE;
 		    if (unit->mode == UNITMODE_FRIDGE) {
-			unit->PID_cool->SetP = unit->fridge_set;
-			unit->PID_heat->SetP = unit->fridge_set;
+			unit->PID_cool->SetP = unit->fridge_set_hi;
+			unit->PID_heat->SetP = unit->fridge_set_lo;
 			unit->PID_cool->Input = unit->PID_heat->Input = unit->air_temperature / 1000.0;
 			unit->PID_cool->Mode = unit->PID_heat->Mode = PID_MODE_BOO;
 		    } else if (unit->mode == UNITMODE_BEER) {
-			unit->PID_cool->SetP = unit->beer_set;
-			unit->PID_heat->SetP = unit->beer_set;
+			unit->PID_cool->SetP = unit->beer_set_hi;
+			unit->PID_heat->SetP = unit->beer_set_lo;
 			unit->PID_cool->Input = unit->PID_heat->Input = unit->beer_temperature / 1000.0;
 			unit->PID_cool->Mode = unit->PID_heat->Mode = PID_MODE_AUTO;
 		    } else if (unit->mode == UNITMODE_PROFILE) {
@@ -1810,11 +1887,13 @@
 			LCDstatC = '\3';
 		}
 		LCDspH = LCDspL = 0.0;
-		if (unit->mode == UNITMODE_BEER)
-		    LCDspH = LCDspL = unit->beer_set;
-		else if (unit->mode == UNITMODE_FRIDGE)
-		    LCDspH = LCDspL = unit->fridge_set;
-		else if (unit->mode == UNITMODE_PROFILE) {
+		if (unit->mode == UNITMODE_BEER) {
+		    LCDspH = unit->beer_set_hi;
+		    LCDspL = unit->beer_set_lo;
+		} else if (unit->mode == UNITMODE_FRIDGE) {
+		    LCDspH = unit->fridge_set_hi;
+		    LCDspL = unit->fridge_set_lo;
+		} else if (unit->mode == UNITMODE_PROFILE) {
 		    if (unit->prof_state != PROFILE_OFF) {
 			LCDspL = unit->prof_target_lo;
 			LCDspH = unit->prof_target_hi;
--- a/thermferm/thermferm.h	Mon Jan 21 17:11:50 2019 +0100
+++ b/thermferm/thermferm.h	Thu Feb 07 14:59:47 2019 +0100
@@ -77,9 +77,11 @@
 #define MENU_NONE_COOL          2122
 #define MENU_NONE_FAN           2123
 #define MENU_MODE_BEER		213
-#define MENU_BEER_TEMP          2131
+#define MENU_BEER_TEMP_LO       2131
+#define	MENU_BEER_TEMP_HI	2132
 #define MENU_MODE_FRIDGE	214
-#define MENU_FRIDGE_TEMP	2141
+#define MENU_FRIDGE_TEMP_LO	2141
+#define	MENU_FRIDGE_TEMP_HI	2142
 #define MENU_MODE_PROFILE	215
 #define	MENU_PROFILE_START	2152
 #define	MENU_PROFILE_PAUSE	2153
@@ -191,8 +193,10 @@
     int			psu_state;		/* Power Supply status		*/
     int			psu_idx;		/* Domoticz idx			*/
     int			mode;			/* Unit mode			*/
-    float		beer_set;		/* Beer temperature setting	*/
-    float		fridge_set;		/* Fridge temperature setting	*/
+    float		beer_set_lo;		/* Beer temperature setting lo	*/
+    float		beer_set_hi;		/* Beer temperature setting hi	*/
+    float		fridge_set_lo;		/* Fridge temperature setting	*/
+    float		fridge_set_hi;		/* Fridge temperature setting	*/
     float		temp_set_min;		/* Minimum temperature		*/
     float		temp_set_max;		/* Maximum temperature		*/
     char		*profile_uuid;		/* Profile uuid or NULL		*/
--- a/www-thermferm/getstate.php	Mon Jan 21 17:11:50 2019 +0100
+++ b/www-thermferm/getstate.php	Thu Feb 07 14:59:47 2019 +0100
@@ -1,6 +1,6 @@
 <?php
 /*****************************************************************************
- * Copyright (C) 2014-2017
+ * Copyright (C) 2014-2019
  *   
  * Michiel Broek <mbroek at mbse dot eu>
  *
@@ -92,10 +92,14 @@
 		$psu = "yes";
 	if (($f[0] == "DOOR_ADDRESS") && (strcmp($f[1], "(null)")))
 		$door = "yes";
-	if (($f[0] == "BEER_SET") && ($mode == "BEER"))
-		$target_temperature_lo = $target_temperature_hi = $f[1];
-	if (($f[0] == "FRIDGE_SET") && ($mode == "FRIDGE"))
-		$target_temperature_lo = $target_temperature_hi = $f[1];
+	if (($f[0] == "BEER_SET_LO") && ($mode == "BEER"))
+		$target_temperature_lo = $f[1];
+	if (($f[0] == "BEER_SET_HI") && ($mode == "BEER"))
+		$target_temperature_hi = $f[1];
+	if (($f[0] == "FRIDGE_SET_LO") && ($mode == "FRIDGE"))
+		$target_temperature_lo = $f[1];
+	if (($f[0] == "FRIDGE_SET_HI") && ($mode == "FRIDGE"))
+		$target_temperature_hi = $f[1];
 	if (($f[0] == "PROF_TARGET_LO") && ($mode == "PROFILE"))
 		$target_temperature_lo = $f[1];
 	if (($f[0] == "PROF_TARGET_HI") && ($mode == "PROFILE"))
--- a/www-thermferm/index.php	Mon Jan 21 17:11:50 2019 +0100
+++ b/www-thermferm/index.php	Thu Feb 07 14:59:47 2019 +0100
@@ -62,23 +62,25 @@
 }
 
 
-if (isset($_POST['Fridge']) && isset($_POST['key']) && isset($_POST['UUID'])) {
+if (isset($_POST['Fridge_lo']) && isset($_POST['Fridge_hi']) && isset($_POST['key']) && isset($_POST['UUID'])) {
 
     if ($_POST['key'] == "Set") {
-	send_array(array('UNIT PUT '.$_POST['UUID'], 'FRIDGE_SET,'.$_POST['Fridge'], '.'));
+	send_array(array('UNIT PUT '.$_POST['UUID'], 'FRIDGE_SET_LO,'.$_POST['Fridge_lo'], 'FRIDGE_SET_HI,'.$_POST['Fridge_hi'], '.'));
     }
-    unset($_POST['Fridge']);
+    unset($_POST['Fridge_lo']);
+    unset($_POST['Fridge_hi']);
     unset($_POST['key']);
     unset($_POST['UUID']);
 }
 
 
-if (isset($_POST['Beer']) && isset($_POST['key']) && isset($_POST['UUID'])) {
+if (isset($_POST['Beer_lo']) && isset($_POST['Beer_hi']) && isset($_POST['key']) && isset($_POST['UUID'])) {
 
     if ($_POST['key'] == "Set") {
-	send_array(array('UNIT PUT '.$_POST['UUID'], 'BEER_SET,'.$_POST['Beer'], '.'));
+	send_array(array('UNIT PUT '.$_POST['UUID'], 'BEER_SET_LO,'.$_POST['Beer_lo'], 'BEER_SET_HI,'.$_POST['Beer_hi'], '.'));
     }
-    unset($_POST['Beer']);
+    unset($_POST['Beer_lo']);
+    unset($_POST['Beer_hi']);
     unset($_POST['key']);
     unset($_POST['UUID']);
 }
--- a/www-thermferm/liveview.php	Mon Jan 21 17:11:50 2019 +0100
+++ b/www-thermferm/liveview.php	Thu Feb 07 14:59:47 2019 +0100
@@ -109,11 +109,17 @@
 	    if (strcmp($vals[0], "PROF_STATE") == 0) {
 		$prof_state = $vals[1];
 	    }
-	    if (($vals[0] == "BEER_SET") && ($mode == "BEER")) {
-		$set_temperature_lo = $set_temperature_hi = $vals[1];
+	    if (($vals[0] == "BEER_SET_LO") && ($mode == "BEER")) {
+		$set_temperature_lo = $vals[1];
+	    }
+	    if (($vals[0] == "BEER_SET_HI") && ($mode == "BEER")) {
+		$set_temperature_hi = $vals[1];
 	    }
-	    if (($vals[0] == "FRIDGE_SET") && ($mode == "FRIDGE")) {
-		$set_temperature_lo = $set_temperature_hi = $vals[1];
+	    if (($vals[0] == "FRIDGE_SET_LO") && ($mode == "FRIDGE")) {
+		$set_temperature_lo = $vals[1];
+	    }
+	    if (($vals[0] == "FRIDGE_SET_HI") && ($mode == "FRIDGE")) {
+		$set_temperature_hi = $vals[1];
 	    }
 	    if (($vals[0] == "PROF_TARGET_LO") && ($mode == "PROFILE")) {
 		$set_temperature_lo = $vals[1];
@@ -266,14 +272,16 @@
 	$outstr .= '      <div id="fermentor_mode_control">'.PHP_EOL;
 	if ($mode == "FRIDGE") {
 	    $outstr .= '       <form id="set_fridge_'.$unr.'" action="index.php" method="post">'.PHP_EOL;
-	    $outstr .= '        <input type="text" name="Fridge" size="5" value="'.$set_temperature_lo.'"><br>'.PHP_EOL;
+	    $outstr .= '        <input type="text" name="Fridge_lo" size="5" value="'.$set_temperature_lo.'"><br>'.PHP_EOL;
+	    $outstr .= '        <input type="text" name="Fridge_hi" size="5" value="'.$set_temperature_hi.'"><br>'.PHP_EOL;
 	    $outstr .= '        <input type="submit" value="Set" name="key">'.PHP_EOL;
 	    $outstr .= '        <input type="hidden" value="'.$unit.'" name="UUID">'.PHP_EOL;
 	    $outstr .= '       </form>'.PHP_EOL;
 	}
 	if ($mode == "BEER") {
 	    $outstr .= '       <form id="set_beer_'.$unr.'" action="index.php" method="post">'.PHP_EOL;
-	    $outstr .= '        <input type="text" name="Beer" size="5" value="'.$set_temperature_lo.'">'.PHP_EOL;
+	    $outstr .= '        <input type="text" name="Beer_lo" size="5" value="'.$set_temperature_lo.'">'.PHP_EOL;
+	    $outstr .= '        <input type="text" name="Beer_hi" size="5" value="'.$set_temperature_hi.'">'.PHP_EOL;
 	    $outstr .= '        <input type="submit" value="Set" name="key">'.PHP_EOL;
 	    $outstr .= '        <input type="hidden" value="'.$unit.'" name="UUID">'.PHP_EOL;
 	    $outstr .= '       </form>'.PHP_EOL;

mercurial