Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.

Wed, 16 Sep 2015 22:05:05 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 16 Sep 2015 22:05:05 +0200
changeset 397
00ca08f5a6f8
parent 396
66d4e137b99d
child 398
efdfef1677d1

Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.

configure file | annotate | diff | comparison | revisions
configure.ac file | annotate | diff | comparison | revisions
thermferm/logger.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/archives.php file | annotate | diff | comparison | revisions
www-thermferm/css/style.css file | annotate | diff | comparison | revisions
www-thermferm/devices.php file | annotate | diff | comparison | revisions
www-thermferm/getalog.php file | annotate | diff | comparison | revisions
www-thermferm/getlog.php file | annotate | diff | comparison | revisions
www-thermferm/getstate.php file | annotate | diff | comparison | revisions
www-thermferm/global.php file | annotate | diff | comparison | revisions
www-thermferm/liveview.php file | annotate | diff | comparison | revisions
www-thermferm/maintenance.php file | annotate | diff | comparison | revisions
www-thermferm/profiles.php file | annotate | diff | comparison | revisions
www-thermferm/simulator.php file | annotate | diff | comparison | revisions
www-thermferm/units.php file | annotate | diff | comparison | revisions
www-thermferm/utilities.php file | annotate | diff | comparison | revisions
--- a/configure	Tue Sep 15 17:29:15 2015 +0200
+++ b/configure	Wed Sep 16 22:05:05 2015 +0200
@@ -2034,7 +2034,7 @@
 
 
 PACKAGE="mbsePi-apps"
-VERSION="0.4.1"
+VERSION="0.4.2"
 COPYRIGHT="Copyright (C) 2014-2015 Michiel Broek, All Rights Reserved"
 CYEARS="2014-2015"
 
--- a/configure.ac	Tue Sep 15 17:29:15 2015 +0200
+++ b/configure.ac	Wed Sep 16 22:05:05 2015 +0200
@@ -8,7 +8,7 @@
 dnl General settings
 dnl After changeing the version number, run autoconf!
 PACKAGE="mbsePi-apps"
-VERSION="0.4.1"
+VERSION="0.4.2"
 COPYRIGHT="Copyright (C) 2014-2015 Michiel Broek, All Rights Reserved"
 CYEARS="2014-2015"
 AC_SUBST(PACKAGE)
--- a/thermferm/logger.c	Tue Sep 15 17:29:15 2015 +0200
+++ b/thermferm/logger.c	Wed Sep 16 22:05:05 2015 +0200
@@ -30,7 +30,7 @@
 {
     char	buf[128], *filename;
 
-    snprintf(buf, 127, "Mode,Air,Beer,Target,S_Heater,S_Cooler,S_Fan,S_Door,U_Heater,U_Cooler,U_Fan,Room");
+    snprintf(buf, 127, "Mode,Air,Beer,Target_L,S_Heater,S_Cooler,S_Fan,S_Door,U_Heater,U_Cooler,U_Fan,Room,Target_H");
     filename = xstrcpy(unit);
     filename = xstrcat(filename, (char *)".log");
     logger(filename, buf);
--- a/thermferm/rdconfig.c	Tue Sep 15 17:29:15 2015 +0200
+++ b/thermferm/rdconfig.c	Wed Sep 16 22:05:05 2015 +0200
@@ -640,7 +640,15 @@
 		syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
 		return 1;
 	    }
-	    if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "INITTEMP", "%.1f", tmp4->inittemp)) < 0) {
+	    if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "INITTEMP_LO", "%.1f", tmp4->inittemp_lo)) < 0) {
+		syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
+		return 1;
+	    }
+	    if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "INITTEMP_HI", "%.1f", tmp4->inittemp_hi)) < 0) {
+		syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
+		return 1;
+	    }
+	    if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FRIDGE_MODE", "%d", tmp4->fridge_mode)) < 0) {
 		syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
 		return 1;
 	    }
@@ -666,10 +674,18 @@
 			syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
 			return 1;
 		    }
-		    if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TARGET", "%.1f", tmp5->target)) < 0) {
+		    if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TARGET_LO", "%.1f", tmp5->target_lo)) < 0) {
 		        syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
 			return 1;
 		    }
+		    if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TARGET_HI", "%.1f", tmp5->target_hi)) < 0) {
+			syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
+			return 1;
+		    }
+		    if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FRIDGE_MODE", "%d", tmp5->fridge_mode)) < 0) {
+			syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
+			return 1;
+		    }
 		    if ((rc = xmlTextWriterEndElement(writer)) < 0) {
 			syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement");
 			return 1;
@@ -1436,8 +1452,8 @@
     step = (prof_step *)malloc(sizeof(prof_step));
     step->next = NULL;
     step->version = 1;
-    step->steptime = step->resttime = 0;
-    step->target = 20.0;
+    step->steptime = step->resttime = step->fridge_mode = 0;
+    step->target_lo = step->target_hi = 20.0;
 
     cur = cur->xmlChildrenNode;
     while (cur != NULL) {
@@ -1462,10 +1478,30 @@
 		step->steptime = ival;
 	    xmlFree(key);
 	}
-	if ((!xmlStrcmp(cur->name, (const xmlChar *)"TARGET"))) {
+	if ((!xmlStrcmp(cur->name, (const xmlChar *)"TARGET"))) {	/* Upgrade from single values */
+	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
+	    if (sscanf((const char *)key, "%f", &val) == 1) {
+		step->target_lo = val - 0.2;
+		step->target_hi = val + 0.2;
+	    }
+	    xmlFree(key);
+	}
+	if ((!xmlStrcmp(cur->name, (const xmlChar *)"TARGET_LO"))) {
 	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
 	    if (sscanf((const char *)key, "%f", &val) == 1)
-		step->target = val;
+		step->target_lo = val;
+	    xmlFree(key);
+	}
+	if ((!xmlStrcmp(cur->name, (const xmlChar *)"TARGET_HI"))) {
+	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
+	    if (sscanf((const char *)key, "%f", &val) == 1)
+		step->target_hi = val;
+	    xmlFree(key);   
+	}
+	if ((!xmlStrcmp(cur->name, (const xmlChar *)"FRIDGE_MODE"))) {
+	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
+	    if (sscanf((const char *)key, "%d", &ival) == 1)
+		step->fridge_mode = ival;
 	    xmlFree(key);
 	}
 	cur = cur->next;
@@ -1511,8 +1547,8 @@
     profile->next = NULL;
     profile->version = 1;
     profile->uuid = profile->name = NULL;
-    profile->busy = 0;
-    profile->inittemp = 20.0;
+    profile->busy = profile->fridge_mode = 0;
+    profile->inittemp_lo = profile->inittemp_hi = 20.0;
     profile->steps = NULL;
 
     cur = cur->xmlChildrenNode;
@@ -1538,10 +1574,30 @@
 		profile->busy = ival;
 	    xmlFree(key);
 	}
-	if ((!xmlStrcmp(cur->name, (const xmlChar *)"INITTEMP"))) {
+	if ((!xmlStrcmp(cur->name, (const xmlChar *)"INITTEMP"))) {	/* Upgrade from single temp */
+	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
+	    if (sscanf((const char *)key, "%f", &fval) == 1) {
+		profile->inittemp_lo = fval - 0.2;
+		profile->inittemp_hi = fval + 0.2;
+	    }
+	    xmlFree(key);
+	}
+	if ((!xmlStrcmp(cur->name, (const xmlChar *)"INITTEMP_LO"))) {
 	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
 	    if (sscanf((const char *)key, "%f", &fval) == 1)
-		profile->inittemp = fval;
+		profile->inittemp_lo = fval;
+	    xmlFree(key);
+	}
+	if ((!xmlStrcmp(cur->name, (const xmlChar *)"INITTEMP_HI"))) {
+	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
+	    if (sscanf((const char *)key, "%f", &fval) == 1)
+		profile->inittemp_hi = fval;
+	    xmlFree(key);
+	}
+	if ((!xmlStrcmp(cur->name, (const xmlChar *)"FRIDGE_MODE"))) {
+	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
+	    if (sscanf((const char *)key, "%d", &ival) == 1)
+		profile->fridge_mode = ival;
 	    xmlFree(key);
 	}
 	if ((!xmlStrcmp(cur->name, (const xmlChar *)"STEPS"))) {
--- a/thermferm/server.c	Tue Sep 15 17:29:15 2015 +0200
+++ b/thermferm/server.c	Wed Sep 16 22:05:05 2015 +0200
@@ -477,7 +477,7 @@
 
 	if ((fp = fopen(name, "r"))) {
 	    char        buffer[256], outbuf[256], q[5], hr[3];
-	    char	*date_n, *mode_n, *air_n, *beer_n, *target_n, *heater_n, *cooler_n, *room_n;
+	    char	*date_n, *mode_n, *air_n, *beer_n, *target_lo_n, *target_hi_n, *heater_n, *cooler_n, *room_n;
 	    char	*heater_u, *cooler_u;
 	    int		lines = 0, heater_l = 0, cooler_l = 0, h = 0, c = 0, heat_used = 0, cool_used = 0, graphstep = 0;
 	    float	room_t = 0.0;
@@ -504,21 +504,22 @@
 
 	    while (fgets(buffer, sizeof(buffer)-1, fp) != NULL) {
 		/*
-		 * 2014-11-15 18:39,BEER,20.312,19.750,20.0,0,NA,NA,NA,78105,NA,NA,18.000
-		 *       |           |     |      |     |   | |  |  |    |   |  |    |
-		 *  date_n           |     |      |     |   | |  |  |    |   |  |    |
-		 *  mode_n ----------+     |      |     |   | |  |  |    |   |  |    |
-		 *  air_n -----------------+      |     |   | |  |  |    |   |  |    |
-		 *  beer_n -----------------------+     |   | |  |  |    |   |  |    |
-		 *  target_n ---------------------------+   | |  |  |    |   |  |    |
-		 *  heater_n -------------------------------+ |  |  |    |   |  |    |
-		 *  cooler_n ---------------------------------+  |  |    |   |  |    |
-		 *  not used ------------------------------------+  |    |   |  |    |
-		 *  not used ---------------------------------------+    |   |  |    |
-		 *  heater_u --------------------------------------------+   |  |    |
-		 *  cooler_u ------------------------------------------------+  |    |
-		 *  not used ---------------------------------------------------+    |
-		 *  room_n ----------------------------------------------------------+
+		 * 2014-11-15 18:39,BEER,20.312,19.750,20.0,0,NA,NA,NA,78105,NA,NA,18.000,20.1
+		 *       |           |     |      |     |   | |  |  |    |   |  |    |     |
+		 *  date_n           |     |      |     |   | |  |  |    |   |  |    |     |
+		 *  mode_n ----------+     |      |     |   | |  |  |    |   |  |    |     |
+		 *  air_n -----------------+      |     |   | |  |  |    |   |  |    |     |
+		 *  beer_n -----------------------+     |   | |  |  |    |   |  |    |     |
+		 *  target_lo_n ------------------------+   | |  |  |    |   |  |    |     |
+		 *  heater_n -------------------------------+ |  |  |    |   |  |    |     |
+		 *  cooler_n ---------------------------------+  |  |    |   |  |    |     |
+		 *  not used ------------------------------------+  |    |   |  |    |     |
+		 *  not used ---------------------------------------+    |   |  |    |     |
+		 *  heater_u --------------------------------------------+   |  |    |     |
+		 *  cooler_u ------------------------------------------------+  |    |     |
+		 *  not used ---------------------------------------------------+    |     |
+		 *  room_n ----------------------------------------------------------+     |
+		 *  target_hi_n -----------------------------------------------------------+
 		 */
 		hr[0] = q[0] = buffer[11];
 		hr[1] = q[1] = buffer[12];
@@ -526,19 +527,20 @@
 		q[3] = buffer[15];
 		hr[2] = '\0';
 		buffer[strlen(buffer) -1] = '\0';
-		date_n = strtok(buffer, ",\0"); /* timestamp            */
-		mode_n = strtok(NULL, ",\0");   /* unit mode            */
-		air_n = strtok(NULL, ",\0");    /* air temp             */
-		beer_n = strtok(NULL, ",\0");   /* beer temp            */
-		target_n = strtok(NULL, ",\0"); /* target temp          */
-		heater_n = strtok(NULL, ",\0"); /* current heater state */
-		cooler_n = strtok(NULL, ",\0"); /* current cooler state */
-		heater_u = strtok(NULL, ",\0"); /* current fan state    */
-		heater_u = strtok(NULL, ",\0"); /* current door state   */
-		heater_u = strtok(NULL, ",\0"); /* heater use counter   */
-		cooler_u = strtok(NULL, ",\0"); /* cooler use counter   */
-		room_n = strtok(NULL, ",\0");	/* fan use counter	*/
-		room_n = strtok(NULL, ",\0");	/* room temperature	*/
+		date_n = strtok(buffer, ",\0"); 	/* timestamp            */
+		mode_n = strtok(NULL, ",\0");   	/* unit mode            */
+		air_n = strtok(NULL, ",\0");    	/* air temp             */
+		beer_n = strtok(NULL, ",\0");   	/* beer temp            */
+		target_lo_n = strtok(NULL, ",\0");	/* target low temp	*/
+		heater_n = strtok(NULL, ",\0"); 	/* current heater state */
+		cooler_n = strtok(NULL, ",\0"); 	/* current cooler state */
+		heater_u = strtok(NULL, ",\0"); 	/* current fan state    */
+		heater_u = strtok(NULL, ",\0"); 	/* current door state   */
+		heater_u = strtok(NULL, ",\0"); 	/* heater use counter   */
+		cooler_u = strtok(NULL, ",\0"); 	/* cooler use counter   */
+		room_n = strtok(NULL, ",\0");		/* fan use counter	*/
+		room_n = strtok(NULL, ",\0");		/* room temperature	*/
+		target_hi_n = strtok(NULL, ",\0");	/* target high temp	*/
 
 		if (strncmp(mode_n, (char *)"Mode", 4)) {
 		    /*
@@ -566,8 +568,10 @@
 			}
 			if (room_n)
 			    sscanf(room_n, "%f", &room_t);
-			snprintf(outbuf, 255, "%s,%s,%s,%s,%s,%s,%s,%d,%d,%.1f", 
-				date_n, mode_n, air_n, beer_n, target_n, heater_n, cooler_n, heat_used, cool_used, room_t);
+			if (target_hi_n == NULL)
+			    target_hi_n = target_lo_n;
+			snprintf(outbuf, 255, "%s,%s,%s,%s,%s,%s,%s,%d,%d,%.1f,%s", 
+				date_n, mode_n, air_n, beer_n, target_lo_n, heater_n, cooler_n, heat_used, cool_used, room_t,target_hi_n);
 			srv_send(outbuf);
 			if (heater_u && h && strcmp(heater_u, "NA"))
 			    heater_l = h;
@@ -1104,7 +1108,7 @@
 int cmd_list(char *buf)
 {
     char		*opt, *param, *filename, q[5], hr[3], buffer[256], outbuf[256];
-    char		*date_n, *mode_n, *air_n, *beer_n, *target_n, *heater_n, *cooler_n, *room_n;
+    char		*date_n, *mode_n, *air_n, *beer_n, *target_lo_n, *target_hi_n, *heater_n, *cooler_n, *room_n;
     char		*heater_u, *cooler_u;
     int			heater_l = 0, cooler_l = 0, h = 0, c = 0, heat_used = 0, cool_used = 0, lines = 0, graphstep = 0;
     units_list		*unit;
@@ -1191,19 +1195,20 @@
 		q[3] = buffer[15];
 		hr[2] = '\0';
 		buffer[strlen(buffer) -1] = '\0';
-		date_n = strtok(buffer, ",\0");	/* timestamp		*/
-		mode_n = strtok(NULL, ",\0");	/* unit mode		*/
-		air_n = strtok(NULL, ",\0");	/* air temp		*/
-		beer_n = strtok(NULL, ",\0");	/* beer temp		*/
-		target_n = strtok(NULL, ",\0"); /* target temp		*/
-		heater_n = strtok(NULL, ",\0");	/* current heater state	*/
-		cooler_n = strtok(NULL, ",\0");	/* current cooler state	*/
-		heater_u = strtok(NULL, ",\0");	/* current fan state	*/
-		heater_u = strtok(NULL, ",\0");	/* current door state	*/
-		heater_u = strtok(NULL, ",\0");	/* heater use counter	*/
-		cooler_u = strtok(NULL, ",\0");	/* cooler use counter	*/
-		room_n = strtok(NULL, ",\0");	/* fan use counter	*/
-		room_n = strtok(NULL, ",\0");	/* room temperature	*/
+		date_n = strtok(buffer, ",\0");		/* timestamp		*/
+		mode_n = strtok(NULL, ",\0");		/* unit mode		*/
+		air_n = strtok(NULL, ",\0");		/* air temp		*/
+		beer_n = strtok(NULL, ",\0");		/* beer temp		*/
+		target_lo_n = strtok(NULL, ",\0");	/* target low temp	*/
+		heater_n = strtok(NULL, ",\0");		/* current heater state	*/
+		cooler_n = strtok(NULL, ",\0");		/* current cooler state	*/
+		heater_u = strtok(NULL, ",\0");		/* current fan state	*/
+		heater_u = strtok(NULL, ",\0");		/* current door state	*/
+		heater_u = strtok(NULL, ",\0");		/* heater use counter	*/
+		cooler_u = strtok(NULL, ",\0");		/* cooler use counter	*/
+		room_n = strtok(NULL, ",\0");		/* fan use counter	*/
+		room_n = strtok(NULL, ",\0");		/* room temperature	*/
+		target_hi_n = strtok(NULL, ",\0");	/* target high temp	*/
 
 		if (strncmp(mode_n, (char *)"Mode", 4)) {
 		    /*
@@ -1233,8 +1238,10 @@
 			    sscanf(room_n, "%f", &room_t);
 			else
 			    room_t = 0.0;
-			snprintf(outbuf, 255, "%s,%s,%s,%s,%s,%s,%s,%d,%d,%.1f", 
-					    date_n, mode_n, air_n, beer_n, target_n, heater_n, cooler_n, heat_used, cool_used, room_t);
+			if (target_hi_n == NULL)
+			    target_hi_n = target_lo_n;
+			snprintf(outbuf, 255, "%s,%s,%s,%s,%s,%s,%s,%d,%d,%.1f,%s", 
+					    date_n, mode_n, air_n, beer_n, target_lo_n, heater_n, cooler_n, heat_used, cool_used, room_t, target_hi_n);
 		    	srv_send(outbuf);
 			if (h && strcmp(heater_u, "NA"))
 			    heater_l = h;
@@ -1267,9 +1274,9 @@
  */
 int cmd_profile(char *buf)
 {
-    char                ibuf[SS_BUFSIZE], *sstep, *rest, *targ, *param, *kwd, *val;
-    int                 j, rlen, istep, irest;
-    float		ftarg, fval;
+    char                ibuf[SS_BUFSIZE], *sstep, *rest, *tlarg, *tharg, *frarg, *param, *kwd, *val;
+    int                 j, ival, rlen, istep, irest, ifrarg;
+    float		ftlarg, ftharg, fval;
     char		*opt;
     profiles_list	*profile, *tmpp;
     prof_step		*step, *olds;
@@ -1327,8 +1334,9 @@
 	uuid_generate(uu);
 	uuid_unparse(uu, profile->uuid);
 	profile->name = xstrcpy(param);
-	profile->busy = 0;
-	profile->inittemp = 20.0;
+	profile->busy = profile->fridge_mode = 0;
+	profile->inittemp_lo = 19.8;
+	profile->inittemp_hi = 20.2;
 	profile->steps = NULL;
 	if (Config.profiles == NULL) {
 	    Config.profiles = profile;
@@ -1362,7 +1370,9 @@
 		srv_send((char *)"213 Profile record follows:");
 		srv_send((char *)"UUID,%s", profile->uuid);
 		srv_send((char *)"NAME,%s", profile->name);
-		srv_send((char *)"INITTEMP,%.1f", profile->inittemp);
+		srv_send((char *)"INITTEMP_LO,%.1f", profile->inittemp_lo);
+		srv_send((char *)"INITTEMP_HI,%.1f", profile->inittemp_hi);
+		srv_send((char *)"FRIDGE_MODE,%d", profile->fridge_mode);
 		srv_send((char *)".");
 		return 0;
 	    }
@@ -1393,11 +1403,23 @@
 				    free(profile->name);
 				}
 				profile->name = xstrcpy(val);
-			    } else if (strcmp(kwd, (char *)"INITTEMP") == 0) {
+			    } else if (strcmp(kwd, (char *)"INITTEMP_LO") == 0) {
+				if (sscanf(val, "%f", &fval) == 1) {
+				    if (profile->inittemp_lo != fval)
+					syslog(LOG_NOTICE, "Profile %s initial temperature low %.1f to %.1f", profile->uuid, profile->inittemp_lo, fval);
+				    profile->inittemp_lo = fval;
+				}
+			    } else if (strcmp(kwd, (char *)"INITTEMP_HI") == 0) {
 				if (sscanf(val, "%f", &fval) == 1) {
-				    if (profile->inittemp != fval)
-					syslog(LOG_NOTICE, "Profile %s initial temperature %.1f to %.1f", profile->uuid, profile->inittemp, fval);
-				    profile->inittemp = fval;
+				    if (profile->inittemp_hi != fval)
+					syslog(LOG_NOTICE, "Profile %s initial temperature high %.1f to %.1f", profile->uuid, profile->inittemp_hi, fval);
+				    profile->inittemp_hi = fval;
+				}
+			    } else if (strcmp(kwd, (char *)"FRIDGE_MODE") == 0) {
+				if (sscanf(val, "%d", &ival) == 1) {
+				    if (profile->fridge_mode != ival)
+					syslog(LOG_NOTICE, "Profile %s fridge mode %d to %d", profile->uuid, profile->fridge_mode, ival);
+				    profile->fridge_mode = ival;
 				}
 			    }
 			}
@@ -1414,7 +1436,7 @@
 	    if (strcmp(profile->uuid, param) == 0) {
 		srv_send((char *)"215 Profile steps follow:");
 		for (step = profile->steps; step; step = step->next) {
-		    srv_send((char *)"%d,%d,%.1f", step->steptime, step->resttime, step->target);
+		    srv_send((char *)"%d,%d,%.1f,%.1f,%d", step->steptime, step->resttime, step->target_lo, step->target_hi, step->fridge_mode);
 		}
 		srv_send((char *)".");
 		return 0;
@@ -1452,21 +1474,27 @@
 		    	    }
 			    sstep = strtok(ibuf, ",\0");
 			    rest = strtok(NULL, ",\0");
-			    targ = strtok(NULL, "\0");
+			    tlarg = strtok(NULL, ",\0");
+			    tharg = strtok(NULL, ",\0");
+			    frarg = strtok(NULL, "\0");
 
 			    if ((sscanf(sstep, "%d", &istep) == 1) &&
 				(sscanf(rest, "%d", &irest) == 1) &&
-				(sscanf(targ, "%f", &ftarg) == 1)) {
+				(sscanf(tlarg, "%f", &ftlarg) == 1) && 
+				(sscanf(tharg, "%f", &ftharg) == 1) &&
+				(sscanf(frarg, "%d", &ifrarg) == 1)) {
 
 				j++;
-				syslog(LOG_NOTICE, "PROFILE PUTS %s add step %d: steptime=%d resttime=%d target=%.1f", 
-						profile->uuid, j, istep, irest, ftarg);
+				syslog(LOG_NOTICE, "PROFILE PUTS %s add step %d: steptime=%d resttime=%d target=%.1f..%.1f fridge_mode=%d", 
+						profile->uuid, j, istep, irest, ftlarg, ftharg, ifrarg);
 				step = (prof_step *)malloc(sizeof(prof_step));
 				step->next = NULL;
 				step->version = 1;
 				step->steptime = istep;
 				step->resttime = irest;
-				step->target = ftarg;
+				step->target_lo = ftlarg;
+				step->target_hi = ftharg;
+				step->fridge_mode = ifrarg;
 
 				if (profile->steps == NULL) {
 				    profile->steps = step;
@@ -2102,7 +2130,9 @@
 		} else {
 		    srv_send((char *)"PROF_STATE,%s", PROFSTATE[unit->prof_state]);
 		}
-		srv_send((char *)"PROF_TARGET,%.3f", unit->prof_target);
+		srv_send((char *)"PROF_TARGET_LO,%.3f", unit->prof_target_lo);
+		srv_send((char *)"PROF_TARGET_HI,%.3f", unit->prof_target_hi);
+		srv_send((char *)"PROF_FRIDGE_MODE,%.3f", unit->prof_fridge_mode);
 		srv_send((char *)"PROF_PEAK_ABS,%.3f", unit->prof_peak_abs);
 		srv_send((char *)"PROF_PEAK_REL,%.3f", unit->prof_peak_rel);
 		srv_send((char *)"PROF_PRIMARY_DONE,%d", (int)unit->prof_primary_done);
@@ -2346,7 +2376,8 @@
 					     * Set a sane default until it will be overruled by the
 					     * main processing loop.
 					     */
-					    unit->prof_target = 20.0;
+					    unit->prof_target_lo = unit->prof_target_hi = 20.0;
+					    unit->prof_fridge_mode = 0;
 					}
 					break;
 				    }
--- a/thermferm/thermferm.c	Tue Sep 15 17:29:15 2015 +0200
+++ b/thermferm/thermferm.c	Wed Sep 16 22:05:05 2015 +0200
@@ -811,7 +811,7 @@
 
 int server(void)
 {
-    char                buf[1024], *filename, target[40], heater[40], cooler[40], fan[40], door[40];
+    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;
     units_list		*unit;
@@ -826,7 +826,7 @@
     long		t = 0;
 #endif
     int			current_step, valid_step, time_until_now;
-    float		previous_target;
+    float		previous_target_lo, previous_target_hi;
 
 
     if (lockprog((char *)"thermferm")) {
@@ -1144,7 +1144,9 @@
 
 			    switch (unit->prof_state) {
 				case PROFILE_OFF:
-						unit->prof_target = profile->inittemp;
+						unit->prof_target_lo = profile->inittemp_lo;
+						unit->prof_target_hi = profile->inittemp_hi;
+						unit->prof_fridge_mode = 0;
 						unit->prof_percent = 0;
 						break;
 				case PROFILE_PAUSE:
@@ -1158,7 +1160,8 @@
 						 * Calculate current profile step and desired temperature.
 						 * When all steps are done, set state to PROFILE_DONE.
 						 */
-						previous_target = profile->inittemp;
+						previous_target_lo = profile->inittemp_lo;
+						previous_target_hi = profile->inittemp_hi;
 						time_until_now = current_step = 0;
 						run_seconds = (int)(now - unit->prof_started - unit->prof_paused);
 						run_minutes = run_seconds / 60;
@@ -1216,24 +1219,31 @@
 							 * This is our current step
 							 */
 							valid_step = TRUE;
+							unit->prof_fridge_mode = step->fridge_mode;
 							if (debug)
-							    fprintf(stdout, "step=%d step_pos=%d step=%d/%d target=%.1f ", 
+							    fprintf(stdout, "step=%d step_pos=%d step=%d/%d target=%.1f..%.1f ", 
 									    current_step, run_hours - time_until_now,
-									    step->steptime, step->resttime, step->target);
+									    step->steptime, step->resttime, step->target_lo, step->target_hi);
 							if ((run_hours - time_until_now) < step->steptime) {
-							    unit->prof_target = previous_target + (((run_minutes - (time_until_now * 60.0)) / (step->steptime * 60.0)) * (step->target - previous_target));
+							    unit->prof_target_lo = previous_target_lo + (((run_minutes - (time_until_now * 60.0)) / (step->steptime * 60.0)) * (step->target_lo - previous_target_lo));
+							    unit->prof_target_hi = previous_target_hi + (((run_minutes - (time_until_now * 60.0)) / (step->steptime * 60.0)) * (step->target_hi - previous_target_hi));
 							    if (debug)
-								fprintf(stdout, "tempshift=%.1f  minutes=%d duration=%d temp_move=%.3f ", 
-										step->target - previous_target, run_minutes - (time_until_now * 60), 
-										step->steptime * 60, unit->prof_target);
+								fprintf(stdout, "tempshift=%.1f..%.1f  minutes=%d duration=%d temp_move=%.3f..%.3f ", 
+										step->target_lo - previous_target_lo,
+										step->target_hi - previous_target_hi,
+										run_minutes - (time_until_now * 60), 
+										step->steptime * 60, unit->prof_target_lo, unit->prof_target_hi);
 							} else {
-							    unit->prof_target = step->target;
-							    fprintf(stdout, "resting target=%.1f ", step->target);
+							    unit->prof_target_lo = step->target_lo;
+							    unit->prof_target_hi = step->target_hi;
+							    if (debug)
+							    	fprintf(stdout, "resting target=%.1f..%.1f ", step->target_lo, step->target_hi);
 							}
 							break;
 						    }
 						    time_until_now += step->steptime + step->resttime;
-						    previous_target = step->target;
+						    previous_target_lo = step->target_lo;
+						    previous_target_hi = step->target_hi;
 						}
 						if (debug)
 						    fprintf(stdout, " %s %02d:%02d\n", valid_step ? "TRUE":"FALSE", minutes, seconds);
@@ -1241,9 +1251,10 @@
 						if (valid_step == TRUE) {
 						    unit->prof_percent = (100 * run_minutes) / tot_minutes;
 						    if (((minutes == 10) || (minutes == 40)) && (seconds == 1)) {
-						    	syslog(LOG_NOTICE, "Profile `%s' running %dd %02d:%02d in step %d, %d%% done, target %.3f degrees", 
+						    	syslog(LOG_NOTICE, "Profile `%s' running %dd %02d:%02d in step %d, %d%% done, target %s %.3f..%.3f degrees", 
 								profile->name, run_hours / 24, run_hours % 24, run_minutes % 60, current_step, 
-								unit->prof_percent, unit->prof_target);
+								unit->prof_percent, unit->prof_fridge_mode ? (char *)"air":(char *)"beer",
+								unit->prof_target_lo, unit->prof_target_hi);
 						    }
 						} else {
 						    /*
@@ -1259,13 +1270,20 @@
 						/*
 						 * Keep this state, set target temperature to the last step.
 						 */
-						previous_target = profile->inittemp;
+						previous_target_lo = profile->inittemp_lo;
+						previous_target_hi = profile->inittemp_hi;
+						unit->prof_fridge_mode = profile->fridge_mode;
 						for (step = profile->steps; step; step = step->next) {
 						    if (step->steptime == 0)
 							break;
-						    previous_target = step->target;
+						    previous_target_lo = step->target_lo;
+						    previous_target_hi = step->target_hi;
+						    unit->prof_fridge_mode = step->fridge_mode;
+
 						}
-						unit->prof_target = previous_target;
+						unit->prof_target_lo = previous_target_lo;
+						unit->prof_target_hi = previous_target_hi;
+						unit->prof_fridge_mode = step->fridge_mode;
 						unit->prof_percent = 100;
 						break;
 			    } /* switch */
@@ -1369,8 +1387,12 @@
 			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) {
-			unit->PID_cool->SetP = unit->PID_heat->SetP = unit->prof_target;
-			unit->PID_cool->Input = unit->PID_heat->Input = unit->beer_temperature / 1000.0;
+			unit->PID_cool->SetP = unit->prof_target_hi;
+			unit->PID_heat->SetP = unit->prof_target_lo;
+			if (unit->prof_fridge_mode)
+			    unit->PID_cool->Input = unit->PID_heat->Input = unit->air_temperature / 1000.0;
+			else
+			    unit->PID_cool->Input = unit->PID_heat->Input = unit->beer_temperature / 1000.0;
 			unit->PID_cool->Mode = unit->PID_heat->Mode = PID_MODE_AUTO;
 		    }
 
@@ -1517,7 +1539,8 @@
 		for (unit = Config.units; unit; unit = unit->next) {
 		    if (unit->mode != UNITMODE_OFF) {
 
-			snprintf(target, 39, "NA");
+			snprintf(target_lo, 39, "NA");
+			snprintf(target_hi, 39, "NA");
 			snprintf(heater, 39, "NA");
 			snprintf(cooler, 39, "NA");
 			snprintf(fan, 39, "NA");
@@ -1527,12 +1550,16 @@
 			snprintf(use_fan, 39, "NA");
 			snprintf(room_temp, 39, "NA");
 
-			if (unit->mode == UNITMODE_BEER)
-			    snprintf(target, 39, "%.1f", unit->beer_set);
-			else if (unit->mode == UNITMODE_FRIDGE)
-			    snprintf(target, 39, "%.1f", unit->fridge_set);
-			else if (unit->mode == UNITMODE_PROFILE)
-			    snprintf(target, 39, "%.1f", unit->prof_target);
+			if (unit->mode == UNITMODE_BEER) {
+			    snprintf(target_lo, 39, "%.1f", unit->beer_set);
+			    snprintf(target_hi, 39, "%.1f", unit->beer_set);
+			} else if (unit->mode == UNITMODE_FRIDGE) {
+			    snprintf(target_lo, 39, "%.1f", unit->fridge_set);
+			    snprintf(target_hi, 39, "%.1f", unit->fridge_set);
+			} else if (unit->mode == UNITMODE_PROFILE) {
+			    snprintf(target_lo, 39, "%.1f", unit->prof_target_lo);
+			    snprintf(target_hi, 39, "%.1f", unit->prof_target_hi);
+			}
 
 			if (unit->heater_address) {
 			    snprintf(heater, 39, "%d", unit->heater_state);
@@ -1553,9 +1580,10 @@
 			    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", 
+			snprintf(buf, 1023, "%s,%.3f,%.3f,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s", 
 					UNITMODE[unit->mode], unit->air_temperature / 1000.0, 
-					unit->beer_temperature / 1000.0, target, heater, cooler, fan, door, use_heater, use_cooler, use_fan, room_temp);
+					unit->beer_temperature / 1000.0, 
+					target_lo, heater, cooler, fan, door, use_heater, use_cooler, use_fan, room_temp, target_hi);
 			filename = xstrcpy(unit->name);
 			filename = xstrcat(filename, (char *)".log");
 			logger(filename, buf);
--- a/thermferm/thermferm.h	Tue Sep 15 17:29:15 2015 +0200
+++ b/thermferm/thermferm.h	Wed Sep 16 22:05:05 2015 +0200
@@ -164,12 +164,14 @@
     char		*profile;		/* Active profile uuid		*/
     time_t		prof_started;		/* Profile start time		*/
     int			prof_state;		/* Profile OFF|PAUSE|RUN|DONE	*/
-    float		prof_target;		/* Profile current target temp	*/
+    float		prof_target_lo;		/* Profile current target low	*/
+    float		prof_target_hi;		/* Profile current target high	*/
     time_t		prof_paused;		/* Profile total pause time	*/
     int			prof_percent;		/* Profile percentage done	*/
     float		prof_peak_abs;		/* Profile absolute peak temp	*/
     float		prof_peak_rel;		/* Profile relative peak temp	*/
     time_t		prof_primary_done;	/* Profile primary is done	*/
+    int			prof_fridge_mode;	/* Profile fridge/beer mode	*/
     pid_var		*PID_cool;		/* PID cooler			*/
     pid_var		*PID_heat;		/* PID heater			*/
 } units_list;
@@ -189,7 +191,9 @@
     int			version;		/* Version 1			*/
     int			steptime;		/* Step time to target in hours	*/
     int			resttime;		/* Rest time on target in hours	*/
-    float		target;			/* Target temperature		*/
+    float		target_lo;		/* Low Target temperature	*/
+    float		target_hi;		/* High target temperature	*/
+    int			fridge_mode;		/* Fridge or beer mode		*/
 } prof_step;
 
 /*
@@ -201,7 +205,9 @@
     char		*uuid;			/* Profile uuid			*/
     char		*name;			/* Profile name			*/
     int			busy;			/* Profile busy == 1, free == 0	*/
-    float		inittemp;		/* Temp target before start	*/
+    float		inittemp_lo;		/* Low target before start	*/
+    float		inittemp_hi;		/* High target before start	*/
+    int			fridge_mode;		/* Fridge or beer mode		*/
     prof_step		*steps;			/* Profile steps		*/
 } profiles_list;
 
--- a/www-thermferm/archives.php	Tue Sep 15 17:29:15 2015 +0200
+++ b/www-thermferm/archives.php	Wed Sep 16 22:05:05 2015 +0200
@@ -113,7 +113,8 @@
     $outstr .= '             { name: "Mode" },'.PHP_EOL;
     $outstr .= '             { name: "Air", type: "float" },'.PHP_EOL;
     $outstr .= '             { name: "Beer", type: "float" },'.PHP_EOL;
-    $outstr .= '             { name: "Target", type: "float" },'.PHP_EOL;
+    $outstr .= '             { name: "Target_lo", type: "float" },'.PHP_EOL;
+    $outstr .= '             { name: "Target_hi", type: "float" },'.PHP_EOL;
     $outstr .= '             { name: "Heater", type: "int" },'.PHP_EOL;
     $outstr .= '             { name: "Cooler", type: "int" },'.PHP_EOL;
     $outstr .= '             { name: "HeatUse", type: "int" },'.PHP_EOL;
@@ -180,7 +181,8 @@
     $outstr .= '             series: ['.PHP_EOL;
     $outstr .= '               { dataField: "Air", lineWidth: 1, displayText: "Air" },'.PHP_EOL;
     $outstr .= '               { dataField: "Beer", lineWidth: 2, displayText: "Beer" },'.PHP_EOL;
-    $outstr .= '               { dataField: "Target", lineWidth: 1, displayText: "Target", opacity: 0.7 },'.PHP_EOL;
+    $outstr .= '               { dataField: "Target_lo", lineWidth: 1, displayText: "Target Lo", opacity: 0.7 },'.PHP_EOL;
+    $outstr .= '               { dataField: "Target_hi", lineWidth: 1, displayText: "Target Hi", opacity: 0.7 },'.PHP_EOL;
     $outstr .= '               { dataField: "Room", lineWidth: 1, displayText: "Room", opacity: 0.5 }'.PHP_EOL;
     $outstr .= '             ]'.PHP_EOL;
     $outstr .= '           }]'.PHP_EOL;
@@ -309,6 +311,11 @@
 
     $outstr .= '     </table>'.PHP_EOL;
     $outstr .= '    </div> <!-- etable -->'.PHP_EOL;
+    $outstr .= '    <script type="text/javascript">'.PHP_EOL;
+    $outstr .= '     $(document).ready(function () {'.PHP_EOL;
+    $outstr .= '      $("#maintenance").jqxButton({ width: 150, height: 25, theme: \'ui-redmond\' });'.PHP_EOL;
+    $outstr .= '     });'.PHP_EOL;
+    $outstr .= '    </script>'.PHP_EOL;
     $outstr .= build_footer();
     echo $outstr;
 }
--- a/www-thermferm/css/style.css	Tue Sep 15 17:29:15 2015 +0200
+++ b/www-thermferm/css/style.css	Wed Sep 16 22:05:05 2015 +0200
@@ -315,6 +315,18 @@
     color: blue;
 }
 
+.ltemp {
+    font-weight: bold;
+    font-size: 1.2em;
+    color: green;
+}
+
+.htemp {
+    font-weight: bold;
+    font-size: 1.2em;
+    color: red;
+}
+
 #fermentor_toggle1 {
     width: 79px;
     height: 70px;
--- a/www-thermferm/devices.php	Tue Sep 15 17:29:15 2015 +0200
+++ b/www-thermferm/devices.php	Wed Sep 16 22:05:05 2015 +0200
@@ -443,6 +443,11 @@
     $outstr .= '      </table>'.PHP_EOL;
     $outstr .= '     </form>'.PHP_EOL;
     $outstr .= '    </div> <!-- etable -->'.PHP_EOL;
+    $outstr .= '    <script type="text/javascript">'.PHP_EOL;
+    $outstr .= '     $(document).ready(function () {'.PHP_EOL;
+    $outstr .= '      $("#maintenance").jqxButton({ width: 150, height: 25, theme: \'ui-redmond\' });'.PHP_EOL;
+    $outstr .= '     });'.PHP_EOL;
+    $outstr .= '    </script>'.PHP_EOL;
     $outstr .= build_footer();
     echo $outstr;
 }
@@ -548,6 +553,11 @@
     $outstr .= '     </form>'.PHP_EOL;
     $outstr .= '    </div> <!-- atable -->'.PHP_EOL;
 
+    $outstr .= '    <script type="text/javascript">'.PHP_EOL;
+    $outstr .= '     $(document).ready(function () {'.PHP_EOL;
+    $outstr .= '      $("#maintenance").jqxButton({ width: 150, height: 25, theme: \'ui-redmond\' });'.PHP_EOL;
+    $outstr .= '     });'.PHP_EOL;
+    $outstr .= '    </script>'.PHP_EOL;
     $outstr .= build_footer();
 
     echo $outstr;
--- a/www-thermferm/getalog.php	Tue Sep 15 17:29:15 2015 +0200
+++ b/www-thermferm/getalog.php	Wed Sep 16 22:05:05 2015 +0200
@@ -41,8 +41,8 @@
 	$f = explode(",", $arr[$j]);
 	$heater   = $f[5] / 100;
 	$cooler   = $f[6] / 100;
-	$row .= '{"Date":"'.$f[0].'","Mode":"'.$f[1].'","Air":"'.$f[2].'","Beer":"'.$f[3].'","Target":"'.$f[4].'",';
-        $row .= '"Heater":'.$heater.',"Cooler":'.$cooler.',"HeatUse":'.$f[7].',"CoolUse":"'.$f[8].'","Room":"'.$f[9].'"}';
+	$row .= '{"Date":"'.$f[0].'","Mode":"'.$f[1].'","Air":"'.$f[2].'","Beer":"'.$f[3].'","Target_lo":"'.$f[4].'",';
+        $row .= '"Heater":'.$heater.',"Cooler":'.$cooler.',"HeatUse":'.$f[7].',"CoolUse":"'.$f[8].'","Room":"'.$f[9].'","Target_hi":"'.$f[10].'"}';
 	$j++;
     }
 }
--- a/www-thermferm/getlog.php	Tue Sep 15 17:29:15 2015 +0200
+++ b/www-thermferm/getlog.php	Wed Sep 16 22:05:05 2015 +0200
@@ -1,6 +1,6 @@
 <?php
 /*****************************************************************************
- * Copyright (C) 2014
+ * Copyright (C) 2014-2015
  *   
  * Michiel Broek <mbroek at mbse dot eu>
  *
@@ -28,7 +28,6 @@
 $arr = explode("\r\n", $answer);
 
 
-//$data[] = array('Date','Mode','Air','Beer','Target','Heater','Cooler','Fan','Door');
 $row = '[';
 
 /* We don't use json_encode because it doesn't work for our purpose */
@@ -42,8 +41,8 @@
 	$f = explode(",", $arr[$j]);
 	$heater   = $f[5] / 100;
 	$cooler   = $f[6] / 100;
-	$row .= '{"Date":"'.$f[0].'","Mode":"'.$f[1].'","Air":"'.$f[2].'","Beer":"'.$f[3].'","Target":"'.$f[4].'",';
-        $row .= '"Heater":'.$heater.',"Cooler":'.$cooler.',"HeatUse":'.$f[7].',"CoolUse":"'.$f[8].'","Room":"'.$f[9].'"}';
+	$row .= '{"Date":"'.$f[0].'","Mode":"'.$f[1].'","Air":"'.$f[2].'","Beer":"'.$f[3].'","Target_lo":"'.$f[4].'",';
+        $row .= '"Heater":'.$heater.',"Cooler":'.$cooler.',"HeatUse":'.$f[7].',"CoolUse":"'.$f[8].'","Room":"'.$f[9].'","Target_hi":"'.$f[10].'"}';
 	$j++;
     }
 }
--- a/www-thermferm/getstate.php	Tue Sep 15 17:29:15 2015 +0200
+++ b/www-thermferm/getstate.php	Wed Sep 16 22:05:05 2015 +0200
@@ -35,7 +35,8 @@
 $air_state = "NA";
 $beer_temperature = "NA";
 $beer_state = "NA";
-$target_temperature = "NA";
+$target_temperature_lo = "NA";
+$target_temperature_hi = "NA";
 $led1 = $led2 = $led3 = $sw1 = $sw2 = $sw3 = "";
 $fridge_set = "NA";
 $beer_set = "NA";
@@ -87,11 +88,13 @@
 	if (($f[0] == "DOOR_ADDRESS") && (strcmp($f[1], "(null)")))
 		$door = "yes";
 	if (($f[0] == "BEER_SET") && ($mode == "BEER"))
-		$target_temperature = $f[1];
+		$target_temperature_lo = $target_temperature_hi = $f[1];
 	if (($f[0] == "FRIDGE_SET") && ($mode == "FRIDGE"))
-		$target_temperature = $f[1];
-	if (($f[0] == "PROF_TARGET") && ($mode == "PROFILE"))
-		$target_temperature = $f[1];
+		$target_temperature_lo = $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"))
+		$target_temperature_hi = $f[1];
 	if (($f[0] == "PROF_STATE") && ($mode == "PROFILE"))
 		$prof_state = 'State: '.$f[1];
 	$j++;
@@ -139,17 +142,18 @@
 
 
 $reply = array (
-    'air_temperature'     => $air_temperature,
-    'beer_temperature'    => $beer_temperature,
-    'target_temperature'  => $target_temperature,
-    'mode'                => $modestr,
-    'led1'                => $led1,
-    'led2'                => $led2,
-    'led3'                => $led3,
-    'sw1'                 => $sw1,
-    'sw2'                 => $sw2,
-    'sw3'                 => $sw3,
-    'profile_state'       => $prof_state
+    'air_temperature'       => $air_temperature,
+    'beer_temperature'      => $beer_temperature,
+    'target_temperature_lo' => $target_temperature_lo,
+    'target_temperature_hi' => $target_temperature_hi,
+    'mode'                  => $modestr,
+    'led1'                  => $led1,
+    'led2'                  => $led2,
+    'led3'                  => $led3,
+    'sw1'                   => $sw1,
+    'sw2'                   => $sw2,
+    'sw3'                   => $sw3,
+    'profile_state'         => $prof_state
 );
 
 
--- a/www-thermferm/global.php	Tue Sep 15 17:29:15 2015 +0200
+++ b/www-thermferm/global.php	Wed Sep 16 22:05:05 2015 +0200
@@ -227,6 +227,11 @@
     $outstr .= '      </table>'.PHP_EOL;
     $outstr .= '     </form>'.PHP_EOL;
     $outstr .= '    </div> <!-- etable -->'.PHP_EOL;
+    $outstr .= '    <script type="text/javascript">'.PHP_EOL;
+    $outstr .= '     $(document).ready(function () {'.PHP_EOL;
+    $outstr .= '      $("#maintenance").jqxButton({ width: 150, height: 25, theme: \'ui-redmond\' });'.PHP_EOL;
+    $outstr .= '     });'.PHP_EOL;
+    $outstr .= '    </script>'.PHP_EOL;
     $outstr .= build_footer();
 
     echo $outstr;
--- a/www-thermferm/liveview.php	Tue Sep 15 17:29:15 2015 +0200
+++ b/www-thermferm/liveview.php	Wed Sep 16 22:05:05 2015 +0200
@@ -37,7 +37,8 @@
 
     if (startsWith($arr[0], "213")) {
 
-	$set_temperature = "NA";
+	$set_temperature_lo = "NA";
+	$set_temperature_hi = "NA";
 	$air_temperature = "NA";
 	$beer_temperature = "NA";
 	$profile = "";
@@ -90,13 +91,16 @@
 		$prof_state = $vals[1];
 	    }
 	    if (($vals[0] == "BEER_SET") && ($mode == "BEER")) {
-		$set_temperature = $vals[1];
+		$set_temperature_lo = $set_temperature_hi = $vals[1];
 	    }
 	    if (($vals[0] == "FRIDGE_SET") && ($mode == "FRIDGE")) {
-		$set_temperature = $vals[1];
+		$set_temperature_lo = $set_temperature_hi = $vals[1];
 	    }
-	    if (($vals[0] == "PROF_TARGET") && ($mode == "PROFILE")) {
-		$set_temperature = $vals[1];
+	    if (($vals[0] == "PROF_TARGET_LO") && ($mode == "PROFILE")) {
+		$set_temperature_lo = $vals[1];
+	    }
+	    if (($vals[0] == "PROF_TARGET_HI") && ($mode == "PROFILE")) {
+		$set_temperature_hi = $vals[1];
 	    }
 	}
 
@@ -114,7 +118,8 @@
 	$outstr .= '             { name: "Mode" },'.PHP_EOL;
 	$outstr .= '             { name: "Air", type: "float" },'.PHP_EOL;
 	$outstr .= '             { name: "Beer", type: "float" },'.PHP_EOL;
-	$outstr .= '             { name: "Target", type: "float" },'.PHP_EOL;
+	$outstr .= '             { name: "Target_lo", type: "float" },'.PHP_EOL;
+	$outstr .= '             { name: "Target_hi", type: "float" },'.PHP_EOL;
 	$outstr .= '             { name: "Heater", type: "int" },'.PHP_EOL;
 	$outstr .= '             { name: "Cooler", type: "int" },'.PHP_EOL;
 	$outstr .= '             { name: "HeatUse", type: "int" },'.PHP_EOL;
@@ -181,7 +186,8 @@
 	$outstr .= '             series: ['.PHP_EOL;
 	$outstr .= '               { dataField: "Air", lineWidth: 1, displayText: "Air" },'.PHP_EOL;
 	$outstr .= '               { dataField: "Beer", lineWidth: 2, displayText: "Beer" },'.PHP_EOL;
-	$outstr .= '               { dataField: "Target", lineWidth: 1, displayText: "Target", opacity: 0.7 },'.PHP_EOL;
+	$outstr .= '               { dataField: "Target_lo", lineWidth: 1, displayText: "Target Lo", opacity: 0.7 },'.PHP_EOL;
+	$outstr .= '               { dataField: "Target_hi", lineWidth: 1, displayText: "Target Hi", opacity: 0.7 },'.PHP_EOL;
 	$outstr .= '               { dataField: "Room", lineWidth: 1, displayText: "Room", opacity: 0.5 }'.PHP_EOL;
 	$outstr .= '             ]'.PHP_EOL;
 	$outstr .= '           }]'.PHP_EOL;
@@ -226,7 +232,8 @@
 	$outstr .= '         $.getJSON("getstate.php?uuid='.$unit.'", function(data) {'.PHP_EOL;
 	$outstr .= '           $("#load_air_'.$unr.'").html(data.air_temperature);'.PHP_EOL;
 	$outstr .= '           $("#load_beer_'.$unr.'").html(data.beer_temperature);'.PHP_EOL;
-	$outstr .= '           $("#load_target_'.$unr.'").html(data.target_temperature);'.PHP_EOL;
+	$outstr .= '           $("#load_target_lo_'.$unr.'").html(data.target_temperature_lo);'.PHP_EOL;
+	$outstr .= '           $("#load_target_hi_'.$unr.'").html(data.target_temperature_hi);'.PHP_EOL;
 	$outstr .= '           $("#load_select_'.$unr.'").html(data.mode);'.PHP_EOL;
 	$outstr .= '           $("#load_led1_'.$unr.'").html(data.led1);'.PHP_EOL;
 	$outstr .= '           $("#load_led2_'.$unr.'").html(data.led2);'.PHP_EOL;
@@ -270,14 +277,14 @@
 	$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.'"><br>'.PHP_EOL;
+	    $outstr .= '        <input type="text" name="Fridge" size="5" value="'.$set_temperature_lo.'"><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.'">'.PHP_EOL;
+	    $outstr .= '        <input type="text" name="Beer" size="5" value="'.$set_temperature_lo.'">'.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;
@@ -354,7 +361,8 @@
 
 	$outstr .= '     <div id="fermentor_panel_display">'.PHP_EOL;
 	$outstr .= '      <div id="fermentor_display1">'.PHP_EOL;
-	$outstr .= '       <div id="load_target_'.$unr.'" class="dtemp">'.$set_temperature.'</div>Set'.PHP_EOL;
+	$outstr .= '       <div id="load_target_hi_'.$unr.'" class="htemp">'.$set_temperature_hi.'</div>'.PHP_EOL;
+	$outstr .= '       <div id="load_target_lo_'.$unr.'" class="ltemp">'.$set_temperature_lo.'</div>'.PHP_EOL;
 	$outstr .= '      </div>'.PHP_EOL;
 	$outstr .= '      <div id="fermentor_display2">'.PHP_EOL;
 	$outstr .= '       <div id="load_air_'.$unr.'" class="dtemp">'.$air_temperature.'</div>Air'.PHP_EOL;
--- a/www-thermferm/maintenance.php	Tue Sep 15 17:29:15 2015 +0200
+++ b/www-thermferm/maintenance.php	Wed Sep 16 22:05:05 2015 +0200
@@ -1,6 +1,6 @@
 <?php
 /*****************************************************************************
- * Copyright (C) 2014
+ * Copyright (C) 2014-2015
  *   
  * Michiel Broek <mbroek at mbse dot eu>
  *
@@ -50,6 +50,12 @@
 $outstr .= '  <meta http-equiv="content-type" content="text/html; charset=utf-8" />'.PHP_EOL;
 $outstr .= '  <title>ThermFerm - Maintenance Menu</title>'.PHP_EOL;
 $outstr .= '  <link type="text/css" href="css/style.css" rel="stylesheet" media="all" />'.PHP_EOL;
+$outstr .= '  <link type="text/css" href="jqwidgets/styles/jqx.base.css" rel="stylesheet" />'.PHP_EOL;
+$outstr .= '  <link type="text/css" href="jqwidgets/styles/jqx.'.$my_style.'.css" rel="stylesheet" />'.PHP_EOL;
+$outstr .= '  <script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>'.PHP_EOL;
+$outstr .= '  <script type="text/javascript" src="jqwidgets/jqxcore.js"></script>'.PHP_EOL;
+$outstr .= '  <script type="text/javascript" src="jqwidgets/jqxwindow.js"></script>'.PHP_EOL;
+$outstr .= '  <script type="text/javascript" src="jqwidgets/jqxbuttons.js"></script>'.PHP_EOL;
 $outstr .= ' </head>'.PHP_EOL;
 $outstr .= ' <body class="default">'.PHP_EOL;
 $outstr .= '  <div id="jqxWidget">'.PHP_EOL;
@@ -58,7 +64,7 @@
 $outstr .= '     ThermFerm '.$version.PHP_EOL;
 $outstr .= '    </div>'.PHP_EOL;
 $outstr .= '    <form action="index.php" style="margin:30px; float:right">'.PHP_EOL;
-$outstr .= '     <input type="submit" style="width: 150px; height: 25px;" value="Dashboard" />'.PHP_EOL;
+$outstr .= '     <input type="submit" id="maintenance" value="Dashboard" />'.PHP_EOL;
 $outstr .= '    </form>'.PHP_EOL;
 $outstr .= '   </div> <!-- header -->'.PHP_EOL;
 $outstr .= '   <div id="content">'.PHP_EOL;
@@ -94,6 +100,11 @@
 }
 $outstr .= '     </div>'.PHP_EOL;
 $outstr .= '    </div>'.PHP_EOL;
+$outstr .= '    <script type="text/javascript">'.PHP_EOL;
+$outstr .= '     $(document).ready(function () {'.PHP_EOL;
+$outstr .= '      $("#maintenance").jqxButton({ width: 150, height: 25, theme: \'ui-redmond\' });'.PHP_EOL;
+$outstr .= '     });'.PHP_EOL;
+$outstr .= '    </script>'.PHP_EOL;
 $outstr .= build_footer();
 
 echo $outstr;
--- a/www-thermferm/profiles.php	Tue Sep 15 17:29:15 2015 +0200
+++ b/www-thermferm/profiles.php	Wed Sep 16 22:05:05 2015 +0200
@@ -22,6 +22,8 @@
  *****************************************************************************/
 
 require_once('utilities.php');
+$my_style = 'ui-redmond';
+
 
 /*
  * Each time this page is loaded, get the profiles from the server.
@@ -68,14 +70,14 @@
      * $steps contains all steps of a profile
      */
     $steps = array (
-	1  => array("steptime" => 0, "resttime" => 0, "target" => 20.0 ),
-	2  => array("steptime" => 0, "resttime" => 0, "target" => 20.0 ),
-	3  => array("steptime" => 0, "resttime" => 0, "target" => 20.0 ),
-	4  => array("steptime" => 0, "resttime" => 0, "target" => 20.0 ),
-	5  => array("steptime" => 0, "resttime" => 0, "target" => 20.0 ),
-	6  => array("steptime" => 0, "resttime" => 0, "target" => 20.0 ),
-	7  => array("steptime" => 0, "resttime" => 0, "target" => 20.0 ),
-	8  => array("steptime" => 0, "resttime" => 0, "target" => 20.0 ),
+	1  => array("steptime" => 0, "resttime" => 0, "target_lo" => 19.8, "target_hi" => 20.2, "fridge_mode" => 0 ),
+	2  => array("steptime" => 0, "resttime" => 0, "target_lo" => 19.8, "target_hi" => 20.2, "fridge_mode" => 0 ),
+	3  => array("steptime" => 0, "resttime" => 0, "target_lo" => 19.8, "target_hi" => 20.2, "fridge_mode" => 0 ),
+	4  => array("steptime" => 0, "resttime" => 0, "target_lo" => 19.8, "target_hi" => 20.2, "fridge_mode" => 0 ),
+	5  => array("steptime" => 0, "resttime" => 0, "target_lo" => 19.8, "target_hi" => 20.2, "fridge_mode" => 0 ),
+	6  => array("steptime" => 0, "resttime" => 0, "target_lo" => 19.8, "target_hi" => 20.2, "fridge_mode" => 0 ),
+	7  => array("steptime" => 0, "resttime" => 0, "target_lo" => 19.8, "target_hi" => 20.2, "fridge_mode" => 0 ),
+	8  => array("steptime" => 0, "resttime" => 0, "target_lo" => 19.8, "target_hi" => 20.2, "fridge_mode" => 0 ),
     );
 
     $answer = send_cmd("PROFILE GETS ".$UUID);
@@ -89,7 +91,9 @@
 	    $f = explode(",", $psteps[$j]);
 	    $steps[$j]["steptime"] = $f[0];
 	    $steps[$j]["resttime"] = $f[1];
-	    $steps[$j]["target"] = $f[2];
+	    $steps[$j]["target_lo"] = $f[2];
+	    $steps[$j]["target_hi"] = $f[3];
+	    $steps[$j]["fridge_mode"] = $f[4];
 	    $j++;
 	}
     }
@@ -111,7 +115,9 @@
     $outstr .= '        <td>Step</td>'.PHP_EOL;
     $outstr .= '        <td>Steptime</td>'.PHP_EOL;
     $outstr .= '        <td>Resttime</td>'.PHP_EOL;
-    $outstr .= '        <td>Temperature</td>'.PHP_EOL;
+    $outstr .= '        <td>Temp low</td>'.PHP_EOL;
+    $outstr .= '        <td>Temp high</td>'.PHP_EOL;
+    $outstr .= '        <td>Fridge mode</td>'.PHP_EOL;
     $outstr .= '       </tr>'.PHP_EOL;
 
     for ($i = 1; $i <= 8; $i++) {
@@ -119,7 +125,12 @@
     	$outstr .= '        <td>Step '.$i.'</td>'.PHP_EOL;
     	$outstr .= '        <td><input type="text" name="steptime'.$i.'" size="4" value="'.$steps[$i]["steptime"].'"></td>'.PHP_EOL;
     	$outstr .= '        <td><input type="text" name="resttime'.$i.'" size="4" value="'.$steps[$i]["resttime"].'"></td>'.PHP_EOL;
-    	$outstr .= '        <td><input type="text" name="target'.$i.'" size="4" value="'.$steps[$i]["target"].'"></td>'.PHP_EOL;
+	$outstr .= '        <td><input type="text" name="target_lo'.$i.'" size="4" value="'.$steps[$i]["target_lo"].'"></td>'.PHP_EOL;
+	$outstr .= '        <td><input type="text" name="target_hi'.$i.'" size="4" value="'.$steps[$i]["target_hi"].'"></td>'.PHP_EOL;
+	$outstr .= '        <td><input type="hidden" name="fridge_mode'.$i.'" value="0"><input type="checkbox" name="fridge_mode'.$i.'" value="1"';
+	if ($steps[$i]["fridge_mode"] == 1)
+	    $outstr .= ' checked';
+	$outstr .= '></td>'.PHP_EOL;
     	$outstr .= '       </tr>'.PHP_EOL;
     }
 
@@ -143,6 +154,11 @@
     $outstr .= '    Lines with a zero steptime and zero resttime are ignored.'.PHP_EOL;
     $outstr .= '    The step- and resttimes are in hours.'.PHP_EOL;
     $outstr .= '    </div> <!-- atable -->'.PHP_EOL;
+    $outstr .= '    <script type="text/javascript">'.PHP_EOL;
+    $outstr .= '     $(document).ready(function () {'.PHP_EOL;
+    $outstr .= '      $("#maintenance").jqxButton({ width: 150, height: 25, theme: \'ui-redmond\' });'.PHP_EOL;
+    $outstr .= '     });'.PHP_EOL;
+    $outstr .= '    </script>'.PHP_EOL;
     $outstr .= build_footer();
     echo $outstr;
 }
@@ -175,7 +191,9 @@
  *
  * @param string $_POST['UUID'] The profile UUID
  * @param string $_POST['Name'] The profile name
- * @param string $_POST['Inittemp'] The profile initial temperature
+ * @param string $_POST['Inittemp_lo'] The profile initial temperature low
+ * @param string $_POST['Inittemp_hi'] The profile initial temperature high
+ * @param string $_POST['Fridge_mode'] The profile fridge/beer mode
  * @param string $_POST['key'] The button pressed.
  */
 function profile_update() {
@@ -189,14 +207,18 @@
     if ($_POST['key'] == 'Save') {
 	$cmd = array("PROFILE PUT ".$_POST['UUID']);
 	$cmd[] = "NAME,".$_POST['Name'];
-	$cmd[] = "INITTEMP,".$_POST['Inittemp'];
+	$cmd[] = "INITTEMP_LO,".$_POST['Inittemp_lo'];
+	$cmd[] = "INITTEMP_HI,".$_POST['Inittemp_hi'];
+	$cmd[] = "FRIDGE_MODE,".$_POST['Fridge_mode'];
 	$cmd[] = ".";
 	send_array($cmd);
     }
 
     unset($_POST['UUID']);
     unset($_POST['Name']);
-    unset($_POST['Inittemp']);
+    unset($_POST['Inittemp_lo']);
+    unset($_POST['Inittemp_hi']);
+    unset($_POST['Fridge_mode']);
     unset($_POST['key']);
     unset($_POST['command']);
     load('profiles.php');
@@ -210,7 +232,9 @@
  * @param string $_POST['UUID'] Unique record UUID
  * @param int $_POST['steptime'n] Profile steptime
  * @param int $_POST['resttime'n] Profile resttime
- * @param float $_POST['target'n] Profile target temperature
+ * @param float $_POST['target_lo'n] Profile target temperature low
+ * @param float $_POST['target_hi'n] Profile target temperature high
+ * @param int $_POST['fridge_mode'n] Profile fridge mode
  * @param string $_POST['key'] Key choice, Save or Cancel
  *
  * Return: 0 = Ok
@@ -223,9 +247,9 @@
     global $arr;
 
     for ($i = 1; $i <= 8; $i++) {
-	if ((! isset($_POST['steptime'.$i])) || (! isset($_POST['resttime'.$i])) || (! isset($_POST['target'.$i])))
+	if ((! isset($_POST['steptime'.$i])) || (! isset($_POST['resttime'.$i])) || (! isset($_POST['target_lo'.$i])) || (! isset($_POST['target_hi'.$i])) || (! isset($_POST['fridge_mode'.$i])))
 		return 1;
-	if ((strlen($_POST['steptime'.$i]) == 0) || (strlen($_POST['resttime'.$i]) == 0) || (strlen($_POST['target'.$i]) == 0))
+	if ((strlen($_POST['steptime'.$i]) == 0) || (strlen($_POST['resttime'.$i]) == 0) || (strlen($_POST['target_lo'.$i]) == 0) || (strlen($_POST['target_hi'.$i]) == 0) || (strlen($_POST['fridge_mode'.$i]) == 0))
 		return 1;
     }
 
@@ -236,8 +260,12 @@
 
 	for ($i = 1; $i <= 8; $i++) {
 
-	    if (($_POST['target'.$i] < -5) || ($_POST['target'.$i] > 30))
-		return 3;
+	    if (($_POST['target_lo'.$i] < -5) || ($_POST['target_lo'.$i] > 30))
+		    return 3;
+	    if (($_POST['target_hi'.$i] < -5) || ($_POST['target_hi'.$i] > 30))
+		    return 3;
+	    if ($_POST['target_lo'.$i] > $_POST['target_hi'.$i])
+		    return 3;
 	}
     } else {
         return 1;
@@ -260,11 +288,13 @@
         case 0: $cmd = array("PROFILE PUTS ".$_POST['UUID']);
 		for ($i = 1; $i <= 8; $i++) {
 			if (($_POST['steptime'.$i] > 0) || ($_POST['resttime'.$i] > 0)) {
-			    $cmd[] = $_POST['steptime'.$i].','.$_POST['resttime'.$i].','.$_POST['target'.$i];
+			    $cmd[] = $_POST['steptime'.$i].','.$_POST['resttime'.$i].','.$_POST['target_lo'.$i].','.$_POST['target_hi'.$i].','.$_POST['fridge_mode'.$i];
 		    }
 		    unset($_POST['steptime'.$i]);
 		    unset($_POST['resttime'.$i]);
-		    unset($_POST['target'.$i]);
+		    unset($_POST['target_lo'.$i]);
+		    unset($_POST['target_hi'.$i]);
+		    unset($_POST['fridge_mode'.$i]);
 		}
 		$cmd[] = ".";
 		send_array($cmd);
@@ -285,14 +315,14 @@
     }
 
     $steps = array (
-	1  => array("steptime" => $_POST['steptime1'], "resttime" => $_POST['resttime1'], "target" => $_POST['target1'] ),
-	2  => array("steptime" => $_POST['steptime2'], "resttime" => $_POST['resttime2'], "target" => $_POST['target2'] ),
-	3  => array("steptime" => $_POST['steptime3'], "resttime" => $_POST['resttime3'], "target" => $_POST['target3'] ),
-	4  => array("steptime" => $_POST['steptime4'], "resttime" => $_POST['resttime4'], "target" => $_POST['target4'] ),
-	5  => array("steptime" => $_POST['steptime5'], "resttime" => $_POST['resttime5'], "target" => $_POST['target5'] ),
-	6  => array("steptime" => $_POST['steptime6'], "resttime" => $_POST['resttime6'], "target" => $_POST['target6'] ),
-	7  => array("steptime" => $_POST['steptime7'], "resttime" => $_POST['resttime7'], "target" => $_POST['target7'] ),
-	8  => array("steptime" => $_POST['steptime8'], "resttime" => $_POST['resttime8'], "target" => $_POST['target8'] ),
+	1  => array("steptime" => $_POST['steptime1'], "resttime" => $_POST['resttime1'], "target_lo" => $_POST['target_lo1'], "target_hi" => $_POST['target_hi1'], "fridge_mode" => $_POST['mode_fridge1'] ),
+	2  => array("steptime" => $_POST['steptime2'], "resttime" => $_POST['resttime2'], "target_lo" => $_POST['target_lo2'], "target_hi" => $_POST['target_hi2'], "fridge_mode" => $_POST['mode_fridge2'] ),
+	3  => array("steptime" => $_POST['steptime3'], "resttime" => $_POST['resttime3'], "target_lo" => $_POST['target_lo3'], "target_hi" => $_POST['target_hi3'], "fridge_mode" => $_POST['mode_fridge3'] ),
+	4  => array("steptime" => $_POST['steptime4'], "resttime" => $_POST['resttime4'], "target_lo" => $_POST['target_lo4'], "target_hi" => $_POST['target_hi4'], "fridge_mode" => $_POST['mode_fridge4'] ),
+	5  => array("steptime" => $_POST['steptime5'], "resttime" => $_POST['resttime5'], "target_lo" => $_POST['target_lo5'], "target_hi" => $_POST['target_hi5'], "fridge_mode" => $_POST['mode_fridge5'] ),
+	6  => array("steptime" => $_POST['steptime6'], "resttime" => $_POST['resttime6'], "target_lo" => $_POST['target_lo6'], "target_hi" => $_POST['target_hi6'], "fridge_mode" => $_POST['mode_fridge6'] ),
+	7  => array("steptime" => $_POST['steptime7'], "resttime" => $_POST['resttime7'], "target_lo" => $_POST['target_lo7'], "target_hi" => $_POST['target_hi7'], "fridge_mode" => $_POST['mode_fridge7'] ),
+	8  => array("steptime" => $_POST['steptime8'], "resttime" => $_POST['resttime8'], "target_lo" => $_POST['target_lo8'], "target_hi" => $_POST['target_hi8'], "fridge_mode" => $_POST['mode_fridge8'] ),
     );
     
     edit_steps($_POST['UUID'], $steps, $error, "ThermFerm - Edit Profile Steps");
@@ -305,7 +335,9 @@
  *
  * @param string $_POST['UUID'] Unique record UUID
  * @param string $_POST['Name'] Profile name
- * @param float $_POST['Inittemp'] Profile initial temperature
+ * @param float $_POST['Inittemp_lo'] Profile initial temperature
+ * @param float $_POST['Inittemp_hi'] Profile initial temperature
+ * @param float $_POST['Fridge_mode'] Profile fridge mode
  * @param string $_POST['key'] Key choice, Save or Cancel
  * @param string $_POST['command'] Command used, 'add' or 'update'
  *
@@ -319,7 +351,7 @@
 
     global $arr;
 
-    if (isset($_POST['UUID']) && isset($_POST['Name']) && isset($_POST['Inittemp']) && isset($_POST['key']) && isset($_POST['command'])) {
+    if (isset($_POST['UUID']) && isset($_POST['Name']) && isset($_POST['Inittemp_lo']) && isset($_POST['Inittemp_hi']) && isset($_POST['key']) && isset($_POST['command'])) {
 
 	if ($_POST['key'] == 'Cancel')
 	    return 99;
@@ -426,12 +458,28 @@
     		$outstr .= '        <td class="editfield"><input type="text" name="Name" size="50" value="'.$f[1].'"></td>'.PHP_EOL;
     		$outstr .= '       </tr>'.PHP_EOL;
 	    }
-	    if ($f[0] == "INITTEMP") {
+	    if ($f[0] == "INITTEMP_LO") {
 		$outstr .= '       <tr class="editor">'.PHP_EOL;
-		$outstr .= '        <td class="editname">Initial temperature</td>'.PHP_EOL;
-		$outstr .= '        <td class="editfield"><input type="text" name="Inittemp" size="5" value="'.$f[1].'"></td>'.PHP_EOL;
+		$outstr .= '        <td class="editname">Initial temperature low</td>'.PHP_EOL;
+		$outstr .= '        <td class="editfield"><input type="text" name="Inittemp_lo" size="5" value="'.$f[1].'"></td>'.PHP_EOL;
 		$outstr .= '       </tr>'.PHP_EOL;
 	    }
+	    if ($f[0] == "INITTEMP_HI") {
+		$outstr .= '       <tr class="editor">'.PHP_EOL;
+		$outstr .= '        <td class="editname">Initial temperature high</td>'.PHP_EOL;
+		$outstr .= '        <td class="editfield"><input type="text" name="Inittemp_hi" size="5" value="'.$f[1].'"></td>'.PHP_EOL;
+		$outstr .= '       </tr>'.PHP_EOL;
+	    }
+	    if ($f[0] == "FRIDGE_MODE") {
+		$outstr .= '       <tr class="editor">'.PHP_EOL;
+		$outstr .= '        <td class="editname">Fridge mode</td>'.PHP_EOL;
+		$outstr .= '        <td class="editfield"><input type="hidden" name="Fridge_mode" value="0"><input type="checkbox" name="Fridge_mode" value="1"';
+		if ($f[1] == "1")
+		    $outstr .= " checked";
+		$outstr .= '></td>'.PHP_EOL;
+		$outstr .= '       </tr>'.PHP_EOL;
+	    }
+
 	    $i++;
 	}
     }
@@ -446,6 +494,11 @@
     $outstr .= '      </table>'.PHP_EOL;
     $outstr .= '     </form>'.PHP_EOL;
     $outstr .= '    </div> <!-- etable -->'.PHP_EOL;
+    $outstr .= '    <script type="text/javascript">'.PHP_EOL;
+    $outstr .= '     $(document).ready(function () {'.PHP_EOL;
+    $outstr .= '      $("#maintenance").jqxButton({ width: 150, height: 25, theme: \'ui-redmond\' });'.PHP_EOL;
+    $outstr .= '     });'.PHP_EOL;
+    $outstr .= '    </script>'.PHP_EOL;
     $outstr .= build_footer();
     echo $outstr;
 }
@@ -525,12 +578,18 @@
     $outstr .= '<input type="hidden" value="testdata" name="action">';
     $outstr .= '<input type="hidden" value="add" name="command">';
     $outstr .= '<input type="hidden" value="00000000-0000-0000-0000-000000000000" name="UUID">';
-    $outstr .= '<input type="hidden" value="20.0" name="Inittemp"></td>';
+    $outstr .= '<input type="hidden" value="19.8" name="Inittemp_lo"></td>';
+    $outstr .= '<input type="hidden" value="20.2" name="Inittemp_hi"></td>';
     $outstr .= '       </tr>'.PHP_EOL;
     $outstr .= '      </table>'.PHP_EOL;
     $outstr .= '     </form>'.PHP_EOL;
 
     $outstr .= '    </div> <!-- atable -->'.PHP_EOL;
+    $outstr .= '    <script type="text/javascript">'.PHP_EOL;
+    $outstr .= '     $(document).ready(function () {'.PHP_EOL;
+    $outstr .= '      $("#maintenance").jqxButton({ width: 150, height: 25, theme: \'ui-redmond\' });'.PHP_EOL;
+    $outstr .= '     });'.PHP_EOL;
+    $outstr .= '    </script>'.PHP_EOL;
     $outstr .= build_footer();
     echo $outstr;
 }
--- a/www-thermferm/simulator.php	Tue Sep 15 17:29:15 2015 +0200
+++ b/www-thermferm/simulator.php	Wed Sep 16 22:05:05 2015 +0200
@@ -339,6 +339,11 @@
     $outstr .= '      </table>'.PHP_EOL;
     $outstr .= '     </form>'.PHP_EOL;
     $outstr .= '    </div> <!-- etable -->'.PHP_EOL;
+    $outstr .= '    <script type="text/javascript">'.PHP_EOL;
+    $outstr .= '     $(document).ready(function () {'.PHP_EOL;
+    $outstr .= '      $("#maintenance").jqxButton({ width: 150, height: 25, theme: \'ui-redmond\' });'.PHP_EOL;
+    $outstr .= '     });'.PHP_EOL;
+    $outstr .= '    </script>'.PHP_EOL;
     $outstr .= build_footer();
     echo $outstr;
 }
@@ -424,6 +429,11 @@
     $outstr .= '     </form>'.PHP_EOL;
     $outstr .= '    </div> <!-- atable -->'.PHP_EOL;
 
+    $outstr .= '    <script type="text/javascript">'.PHP_EOL;
+    $outstr .= '     $(document).ready(function () {'.PHP_EOL;
+    $outstr .= '      $("#maintenance").jqxButton({ width: 150, height: 25, theme: \'ui-redmond\' });'.PHP_EOL;
+    $outstr .= '     });'.PHP_EOL;
+    $outstr .= '    </script>'.PHP_EOL;
     $outstr .= build_footer();
 
     echo $outstr;
--- a/www-thermferm/units.php	Tue Sep 15 17:29:15 2015 +0200
+++ b/www-thermferm/units.php	Wed Sep 16 22:05:05 2015 +0200
@@ -629,6 +629,11 @@
     $outstr .= '      </table>'.PHP_EOL;
     $outstr .= '     </form>'.PHP_EOL;
     $outstr .= '    </div> <!-- etable -->'.PHP_EOL;
+    $outstr .= '    <script type="text/javascript">'.PHP_EOL;
+    $outstr .= '     $(document).ready(function () {'.PHP_EOL;
+    $outstr .= '      $("#maintenance").jqxButton({ width: 150, height: 25, theme: \'ui-redmond\' });'.PHP_EOL;
+    $outstr .= '     });'.PHP_EOL;
+    $outstr .= '    </script>'.PHP_EOL;
     $outstr .= build_footer();
     echo $outstr;
 }
@@ -735,6 +740,11 @@
     $outstr .= '      </table>'.PHP_EOL;
     $outstr .= '     </form>'.PHP_EOL;
     $outstr .= '    </div> <!-- atable -->'.PHP_EOL;
+    $outstr .= '    <script type="text/javascript">'.PHP_EOL;
+    $outstr .= '     $(document).ready(function () {'.PHP_EOL;
+    $outstr .= '      $("#maintenance").jqxButton({ width: 150, height: 25, theme: \'ui-redmond\' });'.PHP_EOL;
+    $outstr .= '     });'.PHP_EOL;
+    $outstr .= '    </script>'.PHP_EOL;
     $outstr .= build_footer();
     echo $outstr;
 }
--- a/www-thermferm/utilities.php	Tue Sep 15 17:29:15 2015 +0200
+++ b/www-thermferm/utilities.php	Wed Sep 16 22:05:05 2015 +0200
@@ -21,6 +21,8 @@
  * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  *****************************************************************************/
 
+$my_style = 'ui-redmond';
+
 
 function open_socket()
 {
@@ -137,6 +139,8 @@
 
 function build_header($heading)
 {
+    global	$my_style;
+
     $answer = send_cmd('GLOBAL GET');
     $arr = explode("\r\n", $answer);
     $version = "?";
@@ -160,6 +164,12 @@
     $outstr .= '  <meta http-equiv="content-type" content="text/html; charset=utf-8" />'.PHP_EOL;
     $outstr .= '  <title>'.$heading.'</title>'.PHP_EOL;
     $outstr .= '  <link type="text/css" href="css/style.css" rel="stylesheet" media="all" />'.PHP_EOL;
+    $outstr .= '  <link type="text/css" href="jqwidgets/styles/jqx.base.css" rel="stylesheet" />'.PHP_EOL;
+    $outstr .= '  <link type="text/css" href="jqwidgets/styles/jqx.'.$my_style.'.css" rel="stylesheet" />'.PHP_EOL;
+    $outstr .= '  <script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>'.PHP_EOL;
+    $outstr .= '  <script type="text/javascript" src="jqwidgets/jqxcore.js"></script>'.PHP_EOL;
+    $outstr .= '  <script type="text/javascript" src="jqwidgets/jqxwindow.js"></script>'.PHP_EOL;
+    $outstr .= '  <script type="text/javascript" src="jqwidgets/jqxbuttons.js"></script>'.PHP_EOL;
     $outstr .= ' </head>'.PHP_EOL;
     $outstr .= ' <body class="default">'.PHP_EOL;
     $outstr .= '  <div id="jqxWidget">'.PHP_EOL;
@@ -168,7 +178,7 @@
     $outstr .= '     ThermFerm '.$version.PHP_EOL;
     $outstr .= '    </div>'.PHP_EOL;
     $outstr .= '    <form action="maintenance.php" style="margin:30px; float:right">'.PHP_EOL;
-    $outstr .= '     <input type="submit" style="width: 150px; height: 25px;" value="Maintenance Panel" />'.PHP_EOL;
+    $outstr .= '     <input type="submit" id="maintenance" value="Maintenance panel" />'.PHP_EOL;
     $outstr .= '    </form>'.PHP_EOL;
     $outstr .= '   </div> <!-- header -->'.PHP_EOL;
     $outstr .= '   <div id="content">'.PHP_EOL;

mercurial