Version 0.6.1 added support for domoticz mqtt sensors.

Wed, 07 Jun 2017 23:06:47 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 07 Jun 2017 23:06:47 +0200
changeset 513
a2732027afb3
parent 512
fd1354e2a045
child 514
f5a00ad53329

Version 0.6.1 added support for domoticz mqtt sensors.

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.h file | annotate | diff | comparison | revisions
www-thermferm/global.php file | annotate | diff | comparison | revisions
www-thermferm/units.php file | annotate | diff | comparison | revisions
--- a/configure	Wed May 31 16:29:52 2017 +0200
+++ b/configure	Wed Jun 07 23:06:47 2017 +0200
@@ -2035,7 +2035,7 @@
 
 
 PACKAGE="mbsePi-apps"
-VERSION="0.6.0"
+VERSION="0.6.1"
 COPYRIGHT="Copyright (C) 2014-2017 Michiel Broek, All Rights Reserved"
 CYEARS="2014-2017"
 
--- a/configure.ac	Wed May 31 16:29:52 2017 +0200
+++ b/configure.ac	Wed Jun 07 23:06:47 2017 +0200
@@ -8,7 +8,7 @@
 dnl General settings
 dnl After changeing the version number, run autoconf!
 PACKAGE="mbsePi-apps"
-VERSION="0.6.0"
+VERSION="0.6.1"
 COPYRIGHT="Copyright (C) 2014-2017 Michiel Broek, All Rights Reserved"
 CYEARS="2014-2017"
 AC_SUBST(PACKAGE)
--- a/thermferm/mqtt.c	Wed May 31 16:29:52 2017 +0200
+++ b/thermferm/mqtt.c	Wed Jun 07 23:06:47 2017 +0200
@@ -178,6 +178,27 @@
 
 
 
+void pub_domoticz_temp(int idx, char *value) {
+    char	*dload = NULL;
+    char	sidx[10];
+
+    if (idx == 0)
+	return;
+
+    sprintf(sidx, "%d", idx);
+
+    dload = xstrcpy((char *)"{\"command\":\"udevice\",\"idx\":");
+    dload = xstrcat(dload, sidx);
+    dload = xstrcat(dload, (char *)",\"nvalue\":0,\"svalue\":\"");
+    dload = xstrcat(dload, value);
+    dload = xstrcat(dload, (char *)"\"}");
+    publisher(mosq, (char *)"domoticz/in", dload, false);
+    free(dload);
+    dload = NULL;
+}
+
+
+
 char *unit_data(units_list *unit, bool birth)
 {
     char		*payload = NULL;
@@ -206,6 +227,7 @@
         sprintf(buf, "%.3f", unit->air_temperature / 1000.0);
         payload = xstrcat(payload, buf);
 	payload = xstrcat(payload, (char *)"}");
+	pub_domoticz_temp(unit->air_idx, buf);      
     } else {
 	payload = xstrcat(payload, (char *)"\",\"air\":null");
     }
@@ -219,6 +241,7 @@
         sprintf(buf, "%.3f", unit->beer_temperature / 1000.0);
         payload = xstrcat(payload, buf);
 	payload = xstrcat(payload, (char *)"}");
+	pub_domoticz_temp(unit->beer_idx, buf);
     } else {
 	payload = xstrcat(payload, (char *)",\"beer\":null");
     }
@@ -230,6 +253,7 @@
 	sprintf(buf, "%d", unit->heater_state);
 	payload = xstrcat(payload, buf);
 	payload = xstrcat(payload, (char *)"}");
+	pub_domoticz_temp(unit->heater_idx, buf);
     } else {
 	payload = xstrcat(payload, (char *)",\"heater\":null");
     }
@@ -241,6 +265,7 @@
 	sprintf(buf, "%d", unit->cooler_state);
 	payload = xstrcat(payload, buf);
 	payload = xstrcat(payload, (char *)"}");
+	pub_domoticz_temp(unit->cooler_idx, buf);
     } else {
 	payload = xstrcat(payload, (char *)",\"cooler\":null");
     }
@@ -252,6 +277,7 @@
 	sprintf(buf, "%d", unit->fan_state);
 	payload = xstrcat(payload, buf);
 	payload = xstrcat(payload, (char *)"}");
+	pub_domoticz_temp(unit->fan_idx, buf);
     } else {
 	payload = xstrcat(payload, (char *)",\"fan\":null");
     }
@@ -263,6 +289,7 @@
 	sprintf(buf, "%d", unit->door_state);
 	payload = xstrcat(payload, buf);
 	payload = xstrcat(payload, (char *)"}");
+	pub_domoticz_temp(unit->door_idx, buf);
     } else {
 	payload = xstrcat(payload, (char *)",\"door\":null");
     }
@@ -274,6 +301,7 @@
 	sprintf(buf, "%d", unit->light_state);
 	payload = xstrcat(payload, buf);
 	payload = xstrcat(payload, (char *)"}");
+	pub_domoticz_temp(unit->light_idx, buf);
     } else {
 	payload = xstrcat(payload, (char *)",\"light\":null");
     }
@@ -285,6 +313,7 @@
 	sprintf(buf, "%d", unit->psu_state);
 	payload = xstrcat(payload, buf);
 	payload = xstrcat(payload, (char *)"}");
+	pub_domoticz_temp(unit->psu_idx, buf);
     } else {
 	payload = xstrcat(payload, (char *)",\"psu\":null");
     }
@@ -406,7 +435,7 @@
 void publishNData(bool birth, int flag)
 {
 #ifdef HAVE_MOSQUITTO_H
-    char		*payload = NULL, buf[64];
+    char		*payload = NULL, sidx[10], buf[64];
     struct utsname	ubuf;
     bool		comma = false;
 
@@ -469,6 +498,20 @@
 
     free(payload);
     payload = NULL;
+
+    if ((Config.temp_address || Config.hum_address) && Config.temp_hum_idx) {
+	sprintf(sidx, "%d", Config.temp_hum_idx);
+	sprintf(buf, "%.1f;%.1f;0", Config.temp_value / 1000.0, Config.hum_value / 1000.0);
+
+	payload = xstrcpy((char *)"{\"command\":\"udevice\",\"idx\":");
+	payload = xstrcat(payload, sidx);
+	payload = xstrcat(payload, (char *)",\"nvalue\":0,\"svalue\":\"");
+	payload = xstrcat(payload, buf);
+	payload = xstrcat(payload, (char *)"\"}");
+	publisher(mosq, (char *)"domoticz/in", payload, false);
+	free(payload);
+	payload = NULL;
+    }
 #endif
 }
 
--- a/thermferm/rdconfig.c	Wed May 31 16:29:52 2017 +0200
+++ b/thermferm/rdconfig.c	Wed Jun 07 23:06:47 2017 +0200
@@ -60,6 +60,7 @@
 	free(Config.temp_address);
     if (Config.hum_address)
 	free(Config.hum_address);
+    Config.temp_hum_idx = 0;
     Config.temp_address = Config.hum_address = NULL;
     Config.temp_value = 20000;
     Config.temp_state = Config.hum_state = 1;	// missing
@@ -244,6 +245,10 @@
 	syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
 	return 1;
     }
+    if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "TEMP_HUM_IDX", "%d", Config.temp_hum_idx)) < 0) {
+	syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
+	return 1;
+    }
     if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "NEXT_UNIT", "%d", Config.next_unit)) < 0) {
 	syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
 	return 1;
@@ -355,6 +360,10 @@
 		    syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
 		    return 1;
 		}
+		if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "AIR_IDX", "%d", tmp3->air_idx)) < 0)) {
+		    syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
+		    return 1;
+		}
 	    }
 	    if (tmp3->beer_address) {
 	    	if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_ADDRESS", "%s", tmp3->beer_address)) < 0)) {
@@ -369,6 +378,10 @@
 		    syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
 		    return 1;
 		}
+		if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_IDX", "%d", tmp3->beer_idx)) < 0)) {
+		    syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
+		    return 1;
+		}
 	    }
 	    if (tmp3->heater_address) {
 		if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_ADDRESS", "%s", tmp3->heater_address)) < 0)) {
@@ -387,6 +400,10 @@
 		    syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
 		    return 1;
 		}
+		if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_IDX", "%d", tmp3->heater_idx)) < 0)) {
+		   syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
+		   return 1;
+		}
 	    }
 	    if (tmp3->cooler_address) {
 		if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_ADDRESS", "%s", tmp3->cooler_address)) < 0)) {
@@ -405,6 +422,10 @@
 		    syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
 		    return 1;
 		}
+		if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_IDX", "%d", tmp3->cooler_idx)) < 0)) {
+		    syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
+		    return 1;
+		}
 	    }
 	    if (tmp3->fan_address) {
 		if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_ADDRESS", "%s", tmp3->fan_address)) < 0)) {
@@ -423,6 +444,10 @@
 		    syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
 		    return 1;
 		}
+		if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_IDX", "%d", tmp3->fan_idx)) < 0)) {
+		    syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
+		    return 1;
+		}
 	    }
 	    if (tmp3->light_address) {
 		if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "LIGHT_ADDRESS", "%s", tmp3->light_address)) < 0)) {
@@ -441,6 +466,10 @@
 		    syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
 		    return 1;
 		}
+		if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "LIGHT_IDX", "%d", tmp3->light_idx)) < 0)) {
+		    syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
+		    return 1;
+		}
 	    }
 	    if (tmp3->door_address) {
 		if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "DOOR_ADDRESS", "%s", tmp3->door_address)) < 0)) {
@@ -451,6 +480,10 @@
 		    syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
 		return 1;
 		}
+		if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "DOOR_IDX", "%d", tmp3->door_idx)) < 0)) {
+		    syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
+		    return 1;
+		}
 	    }
 	    if (tmp3->psu_address) {
 		if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PSU_ADDRESS", "%s", tmp3->psu_address)) < 0)) {
@@ -461,6 +494,10 @@
 		    syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
 		    return 1;
 		}
+		if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PSU_IDX", "%d", tmp3->psu_idx)) < 0)) {
+		    syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
+		    return 1;
+		}
 	    }
 	    if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MODE", "%s", UNITMODE[tmp3->mode] )) < 0) {
 		syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
@@ -1040,6 +1077,8 @@
     unit->air_state = unit->beer_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 = 0;
+    unit->air_idx = unit->beer_idx = unit->heater_idx = unit->cooler_idx = unit->fan_idx = \
+		    unit->door_idx = unit->light_idx = unit->psu_idx = 0;
     unit->heater_delay = unit->cooler_delay = unit->fan_delay = 20;	/* 5 minutes delay */
     unit->light_delay = 1;						/* 15 seconds delay	*/
     unit->heater_wait = unit->cooler_wait = unit->fan_wait = unit->light_wait = 0;
@@ -1088,6 +1127,12 @@
 		unit->air_state = ival;
 	    xmlFree(key);
 	}
+	if ((!xmlStrcmp(cur->name, (const xmlChar *)"AIR_IDX"))) {
+	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
+	    if (sscanf((const char *)key, "%d", &ival) == 1)
+		unit->air_idx = ival;
+	    xmlFree(key);
+	}
 	if ((!xmlStrcmp(cur->name, (const xmlChar *)"AIR_TEMPERATURE"))) {
 	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
 	    if (sscanf((const char *)key, "%d", &ival) == 1)
@@ -1103,6 +1148,12 @@
 		unit->beer_state = ival;
 	    xmlFree(key);
 	}
+	if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEER_IDX"))) {
+	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
+	    if (sscanf((const char *)key, "%d", &ival) == 1)
+		unit->beer_idx = ival;
+	    xmlFree(key);
+	}
 	if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEER_TEMPERATURE"))) {
 	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
 	    if (sscanf((const char *)key, "%d", &ival) == 1)
@@ -1118,6 +1169,12 @@
 		unit->heater_delay = ival;
 	    xmlFree(key);
 	}
+	if ((!xmlStrcmp(cur->name, (const xmlChar *)"HEATER_IDX"))) {
+	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
+	    if (sscanf((const char *)key, "%d", &ival) == 1)
+		unit->heater_idx = ival;
+	    xmlFree(key);
+	}
 	if ((!xmlStrcmp(cur->name, (const xmlChar *)"HEATER_USAGE"))) {
 	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
 	    if (sscanf((const char *)key, "%d", &ival) == 1)
@@ -1133,6 +1190,12 @@
 		unit->cooler_delay = ival;
 	    xmlFree(key);
 	}
+	if ((!xmlStrcmp(cur->name, (const xmlChar *)"COOLER_IDX"))) {
+	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
+	    if (sscanf((const char *)key, "%d", &ival) == 1)
+		unit->cooler_idx = ival;
+	    xmlFree(key);
+	}
 	if ((!xmlStrcmp(cur->name, (const xmlChar *)"COOLER_USAGE"))) {
 	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
 	    if (sscanf((const char *)key, "%d", &ival) == 1)
@@ -1148,6 +1211,12 @@
 		unit->fan_delay = ival;
 	    xmlFree(key);                           
 	}
+	if ((!xmlStrcmp(cur->name, (const xmlChar *)"FAN_IDX"))) {
+	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
+	    if (sscanf((const char *)key, "%d", &ival) == 1)
+		unit->fan_idx = ival;
+	    xmlFree(key);
+	}
 	if ((!xmlStrcmp(cur->name, (const xmlChar *)"FAN_USAGE"))) {
 	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
 	    if (sscanf((const char *)key, "%d", &ival) == 1)
@@ -1163,6 +1232,12 @@
 		unit->light_delay = ival;
 	    xmlFree(key);
 	}
+	if ((!xmlStrcmp(cur->name, (const xmlChar *)"LIGHT_IDX"))) {
+	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
+	    if (sscanf((const char *)key, "%d", &ival) == 1)
+		unit->light_idx = ival;
+	    xmlFree(key);
+	}
 	if ((!xmlStrcmp(cur->name, (const xmlChar *)"LIGHT_USAGE"))) {
 	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
 	    if (sscanf((const char *)key, "%d", &ival) == 1)
@@ -1172,9 +1247,21 @@
 	if ((!xmlStrcmp(cur->name, (const xmlChar *)"DOOR_ADDRESS"))) {
 	    unit->door_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
 	}
+	if ((!xmlStrcmp(cur->name, (const xmlChar *)"DOOR_IDX"))) {
+	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
+	    if (sscanf((const char *)key, "%d", &ival) == 1)
+		unit->door_idx = ival;
+	    xmlFree(key);
+	}
 	if ((!xmlStrcmp(cur->name, (const xmlChar *)"PSU_ADDRESS"))) {
 	    unit->psu_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
 	}
+	if ((!xmlStrcmp(cur->name, (const xmlChar *)"PSU_IDX"))) {
+	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
+	    if (sscanf((const char *)key, "%d", &ival) == 1)
+		unit->psu_idx = ival;
+	    xmlFree(key);
+	}
 	if ((!xmlStrcmp(cur->name, (const xmlChar *)"MODE"))) {
 	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
 	    for (i = 0; i < 5; i++) {
@@ -1413,15 +1500,6 @@
 	cur = cur->next;
     }
 
-    /*
-     * If there is no alias name, create it.
-     */
-//    if (unit->alias == NULL) {
-//	char	an[128];
-//	sprintf(an, "unit%d", number);
-//	unit->alias = xstrcpy(an);
-//    }
-
     if (Config.units == NULL) {
 	Config.units = unit;
     } else {
@@ -1443,8 +1521,7 @@
     cur = cur->xmlChildrenNode;
     while (cur != NULL) {
         if ((!xmlStrcmp(cur->name, (const xmlChar *)"UNIT"))) {
-            parseUnit(doc, cur/* , Config.next_unit*/);
-//	    Config.next_unit++;
+            parseUnit(doc, cur);
         }
         cur = cur->next;
     }
@@ -2064,6 +2141,12 @@
 	if ((!xmlStrcmp(cur->name, (const xmlChar *)"HUM_ADDRESS"))) {
 	    Config.hum_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
 	}
+	if ((!xmlStrcmp(cur->name, (const xmlChar *)"TEMP_HUM_IDX"))) {
+	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
+	    if (sscanf((const char *)key, "%d", &ival) == 1)
+		Config.temp_hum_idx = ival;
+	    xmlFree(key);
+	}
 	if ((!xmlStrcmp(cur->name, (const xmlChar *)"NEXT_UNIT"))) {
 	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
 	    if (sscanf((const char *)key, "%d", &ival) == 1)
--- a/thermferm/server.c	Wed May 31 16:29:52 2017 +0200
+++ b/thermferm/server.c	Wed Jun 07 23:06:47 2017 +0200
@@ -1003,6 +1003,7 @@
 	srv_send((char *)"HUM_ADDRESS,%s", Config.hum_address);
 	srv_send((char *)"HUM_STATE,%s", TEMPSTATE[Config.hum_state]);
 	srv_send((char *)"HUM_VALUE,%.0f", Config.hum_value / 1000.0);
+	srv_send((char *)"TEMP_HUM_IDX,%d", Config.temp_hum_idx);
 	srv_send((char *)"LCD_COLS,%d", Config.lcd_cols);
 	srv_send((char *)"LCD_ROWS,%d", Config.lcd_rows);
 	srv_send((char *)"NEXT_UNIT,%d", Config.next_unit);
@@ -1078,6 +1079,13 @@
 			} else
 			    Config.hum_address = NULL;
 
+		    } else if (val && (strcmp(kwd, (char *)"TEMP_HUM_IDX") == 0)) {
+			if (sscanf(val, "%d", &ival) == 1) {
+			    if (Config.temp_hum_idx != ival)
+				syslog(LOG_NOTICE, "Global Temp/Humidity idx %d to %d", Config.temp_hum_idx, ival);
+			    Config.temp_hum_idx = ival;
+			}
+
 		    } else if (val && (strcmp(kwd, (char *)"LCD_COLS") == 0)) {
 			if (sscanf(val, "%d", &ival) == 1) {
 			    if (Config.lcd_cols != ival)
@@ -2004,6 +2012,8 @@
 	unit->air_address = unit->beer_address = unit->heater_address = unit->cooler_address = \
 			    unit->fan_address = unit->door_address = unit->light_address = \
 			    unit->psu_address = unit->profile = NULL;
+	unit->air_idx = unit->beer_idx = unit->heater_idx = unit->cooler_idx = unit->fan_idx = \
+			unit->door_idx = unit->light_idx = unit->psu_idx = 0;
 	unit->volume = unit->prof_peak_abs = unit->prof_peak_rel = 0.0;
 	unit->air_state = unit->beer_state = 1;
 	unit->air_temperature = unit->beer_temperature = 20000;
@@ -2087,13 +2097,16 @@
 		srv_send((char *)"AIR_ADDRESS,%s", unit->air_address);
 		srv_send((char *)"AIR_STATE,%s", TEMPSTATE[unit->air_state]);
 		srv_send((char *)"AIR_TEMPERATURE,%.3f", unit->air_temperature / 1000.0);
+		srv_send((char *)"AIR_IDX,%d", unit->air_idx);
 		srv_send((char *)"BEER_ADDRESS,%s", MBSE_SS(unit->beer_address));
 		srv_send((char *)"BEER_STATE,%s", TEMPSTATE[unit->beer_state]);
 		srv_send((char *)"BEER_TEMPERATURE,%.3f", unit->beer_temperature / 1000.0);
+		srv_send((char *)"BEER_IDX,%d", unit->beer_idx);
 		srv_send((char *)"HEATER_ADDRESS,%s", unit->heater_address);
 		srv_send((char *)"HEATER_STATE,%d", unit->heater_state);
 		srv_send((char *)"HEATER_DELAY,%d", unit->heater_delay);
 		srv_send((char *)"HEATER_USAGE,%d", unit->heater_usage);
+		srv_send((char *)"HEATER_IDX,%d", unit->heater_idx);
 		if (unit->PID_heat) {
 		    srv_send((char *)"PIDH_IMAX,%.1f", unit->PID_heat->iMax);
 		    srv_send((char *)"PIDH_IDLERANGE,%.2f", unit->PID_heat->idleRange);
@@ -2106,6 +2119,7 @@
 		srv_send((char *)"COOLER_STATE,%d", unit->cooler_state);
 		srv_send((char *)"COOLER_DELAY,%d", unit->cooler_delay);
 		srv_send((char *)"COOLER_USAGE,%d", unit->cooler_usage);
+		srv_send((char *)"COOLER_IDX,%d", unit->cooler_idx);
 		if (unit->PID_cool) {
 		    srv_send((char *)"PIDC_IMAX,%.1f", unit->PID_cool->iMax);
 		    srv_send((char *)"PIDC_IDLERANGE,%.2f", unit->PID_cool->idleRange);
@@ -2118,14 +2132,18 @@
 		srv_send((char *)"FAN_STATE,%d", unit->fan_state);
 		srv_send((char *)"FAN_DELAY,%d", unit->fan_delay);
 		srv_send((char *)"FAN_USAGE,%d", unit->fan_usage);
+		srv_send((char *)"FAN_IDX,%d", unit->fan_idx);
 		srv_send((char *)"LIGHT_ADDRESS,%s", unit->light_address);
 		srv_send((char *)"LIGHT_STATE,%d", unit->light_state);
 		srv_send((char *)"LIGHT_DELAY,%d", unit->light_delay);
 		srv_send((char *)"LIGHT_USAGE,%d", unit->light_usage);
+		srv_send((char *)"LIGHT_IDX,%d", unit->light_idx);
 		srv_send((char *)"DOOR_ADDRESS,%s", unit->door_address);
 		srv_send((char *)"DOOR_STATE,%d", unit->door_state);
+		srv_send((char *)"DOOR_IDX,%d", unit->door_idx);
 		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 *)"MODE,%s", UNITMODE[unit->mode]);
 		srv_send((char *)"FRIDGE_SET,%.1f", unit->fridge_set);
 		srv_send((char *)"BEER_SET,%.1f", unit->beer_set);
@@ -2218,6 +2236,13 @@
 				    unit->air_address  = NULL;
 				unit->mqtt_flag |= MQTT_FLAG_DATA;
 
+			    } else if (val && (strcmp(kwd, (char *)"AIR_IDX") == 0)) {
+				if (sscanf(val, "%d", &ival) == 1) {
+				    if (unit->air_idx != ival)
+					syslog(LOG_NOTICE, "Fermenter unit %s air idx %d to %d", unit->uuid, unit->air_idx, ival);
+				    unit->air_idx = ival;
+				}
+
 			    } else if (strcmp(kwd, (char *)"BEER_ADDRESS") == 0) {
 				if (val && unit->beer_address && (strcmp(val, unit->beer_address)))
 				    syslog(LOG_NOTICE, "Fermenter unit %s beer address `%s' to `%s'", unit->uuid, unit->beer_address, val);
@@ -2232,6 +2257,13 @@
 				    unit->beer_address = NULL;
 				unit->mqtt_flag |= MQTT_FLAG_DATA;
 
+			    } else if (val && (strcmp(kwd, (char *)"BEER_IDX") == 0)) {
+				if (sscanf(val, "%d", &ival) == 1) {
+				    if (unit->beer_idx != ival)
+					syslog(LOG_NOTICE, "Fermenter unit %s beer idx %d to %d", unit->uuid, unit->beer_idx, ival);
+				    unit->beer_idx = ival;
+				}
+
 			    } else if (strcmp(kwd, (char *)"HEATER_ADDRESS") == 0) {
 				if (val && unit->heater_address && (strcmp(val, unit->heater_address)))
 				    syslog(LOG_NOTICE, "Fermenter unit %s heater address `%s' to `%s'", unit->uuid, unit->heater_address, val);
@@ -2254,6 +2286,13 @@
 				    unit->mqtt_flag |= MQTT_FLAG_DATA;
 				}
 
+			    } else if (val && (strcmp(kwd, (char *)"HEATER_IDX") == 0)) {
+				if (sscanf(val, "%d", &ival) == 1) {
+				    if (unit->heater_idx != ival)
+					syslog(LOG_NOTICE, "Fermenter unit %s heater idx %d to %d", unit->uuid, unit->heater_idx, ival);
+				    unit->heater_idx = ival;
+				}
+
 			    } else if (val && (strcmp(kwd, (char *)"HEATER_DELAY") == 0)) {
 				if (sscanf(val, "%d", &ival) == 1) {
 				    if (unit->heater_delay != ival)
@@ -2290,6 +2329,13 @@
 				    unit->cooler_delay = ival;
 				}
 
+			    } else if (val && (strcmp(kwd, (char *)"COOLER_IDX") == 0)) {
+				if (sscanf(val, "%d", &ival) == 1) {
+				    if (unit->cooler_idx != ival)
+					syslog(LOG_NOTICE, "Fermenter unit %s cooler idx %d to %d", unit->uuid, unit->cooler_idx, ival);
+				    unit->cooler_idx = ival;
+				}
+
 			    } else if (strcmp(kwd, (char *)"FAN_ADDRESS") == 0) {
 				if (val && unit->fan_address && (strcmp(val, unit->fan_address)))
 				    syslog(LOG_NOTICE, "Fermenter unit %s fan address `%s' to `%s'", unit->uuid, unit->fan_address, val);
@@ -2319,6 +2365,13 @@
 				    unit->fan_delay = ival;
 				}
 
+			    } else if (val && (strcmp(kwd, (char *)"FAN_IDX") == 0)) {
+				if (sscanf(val, "%d", &ival) == 1) {
+				    if (unit->fan_idx != ival)
+					syslog(LOG_NOTICE, "Fermenter unit %s fan idx %d to %d", unit->uuid, unit->fan_idx, ival);
+				    unit->fan_idx = ival;
+				}
+
 			    } else if (strcmp(kwd, (char *)"LIGHT_ADDRESS") == 0) {
 				if (val && unit->light_address && (strcmp(val, unit->light_address)))
 				    syslog(LOG_NOTICE, "Fermenter unit %s light address `%s' to `%s'", unit->uuid, unit->light_address, val);
@@ -2348,6 +2401,13 @@
 				    unit->light_delay = ival;
 				}
 
+			    } else if (val && (strcmp(kwd, (char *)"LIGHT_IDX") == 0)) {
+				if (sscanf(val, "%d", &ival) == 1) {
+				    if (unit->light_idx != ival)
+					syslog(LOG_NOTICE, "Fermenter unit %s light idx %d to %d", unit->uuid, unit->light_idx, ival);
+				    unit->light_idx = ival;
+				}
+
 			    } else if (strcmp(kwd, (char *)"DOOR_ADDRESS") == 0) {
 				if (val && unit->door_address && (strcmp(val, unit->door_address)))
 				    syslog(LOG_NOTICE, "Fermenter unit %s door address `%s' to `%s'", unit->uuid, unit->door_address, val);
@@ -2361,6 +2421,13 @@
 				} else
 				    unit->door_address = NULL;
 
+			    } else if (val && (strcmp(kwd, (char *)"DOOR_IDX") == 0)) {
+				if (sscanf(val, "%d", &ival) == 1) {
+				    if (unit->door_idx != ival)
+					syslog(LOG_NOTICE, "Fermenter unit %s door idx %d to %d", unit->uuid, unit->door_idx, ival);
+				    unit->door_idx = ival;
+				}
+
 			    } else if (strcmp(kwd, (char *)"PSU_ADDRESS") == 0) {
 				if (val && unit->psu_address && (strcmp(val, unit->psu_address)))
 				    syslog(LOG_NOTICE, "Fermenter unit %s psu address `%s' to `%s'", unit->uuid, unit->psu_address, val);
@@ -2375,6 +2442,13 @@
 				    unit->psu_address = NULL;
 				unit->mqtt_flag |= MQTT_FLAG_DATA;
 
+			    } else if (val && (strcmp(kwd, (char *)"PSU_IDX") == 0)) {
+				if (sscanf(val, "%d", &ival) == 1) {
+				    if (unit->psu_idx != ival)
+					syslog(LOG_NOTICE, "Fermenter unit %s psu idx %d to %d", unit->uuid, unit->psu_idx, ival);
+				    unit->psu_idx = ival;
+				}
+
 			    } else if (val && (strcmp(kwd, (char *)"MODE") == 0)) {
 				for (i = 0; i < 5; i++) {
 				    if (strcmp(val, UNITMODE[i]) == 0) {
--- a/thermferm/thermferm.h	Wed May 31 16:29:52 2017 +0200
+++ b/thermferm/thermferm.h	Wed Jun 07 23:06:47 2017 +0200
@@ -137,33 +137,41 @@
     char		*air_address;		/* DS18B20 address		*/
     int			air_state;		/* 0=ok, 1=missing, 2=error	*/
     int			air_temperature;	/* Air temperature in C * 1000	*/
+    int			air_idx;		/* Domoticz idx			*/
     char		*beer_address;		/* DS18B20 address		*/
     int			beer_state;		/* 0=ok, 1=missing, 2=error 	*/
     int			beer_temperature;	/* Beer temperature in C * 1000	*/
+    int			beer_idx;		/* Domoticz idx			*/
     char		*heater_address;	/* Heater relay or PWM		*/
     int			heater_state;		/* Heater state 0..100		*/
     int			heater_delay;		/* Heater delay time /15 sec	*/
     int			heater_wait;		/* Heater wait counter		*/
     int			heater_usage;		/* Heater usage in seconds	*/
+    int			heater_idx;		/* Domoticz idx			*/
     char		*cooler_address;	/* Cooler relay or PWM		*/
     int			cooler_state;		/* Cooler state 0..100		*/
     int			cooler_delay;		/* Cooler delay time /15 sec	*/
     int			cooler_wait;		/* Cooler wait counter		*/
     int			cooler_usage;		/* Cooler usage in seconds	*/
+    int			cooler_idx;		/* Domoticz idx			*/
     char		*fan_address;		/* Fan relay or PWM 		*/
     int			fan_state;		/* Fan state 0..100		*/
     int			fan_delay;		/* Fan delay time /15 sec	*/
     int			fan_wait;		/* Fan wait counter		*/
     int			fan_usage;		/* Fan usage in seconds		*/
+    int			fan_idx;		/* Domoticz idx			*/
     char		*light_address;		/* Lights relay			*/
     int			light_state;		/* Lights state 0..100		*/
     int			light_delay;		/* Lights delay time /15 sec	*/
     int			light_wait;		/* Lights wait counter		*/
     int			light_usage;		/* Lights usage in seconds	*/
+    int			light_idx;		/* Domoticz idx			*/
     char		*door_address;		/* Door input address		*/
     int			door_state;		/* Door status			*/
+    int			door_idx;		/* Domoticz idx			*/
     char		*psu_address;		/* Power Supply input address	*/
     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	*/
@@ -328,6 +336,7 @@
     char		*hum_address;		/* Environment huminity		*/
     int			hum_state;		/* 0=ok, 1=missing, 2=error	*/
     int			hum_value;		/* Huminity in % * 1000		*/
+    int			temp_hum_idx;		/* Domoticz idx			*/
     int			lcd_cols;		/* LCD display columns		*/
     int			lcd_rows;		/* LCD display rows		*/
     int			lcd_address;		/* LCD display i2c address	*/
--- a/www-thermferm/global.php	Wed May 31 16:29:52 2017 +0200
+++ b/www-thermferm/global.php	Wed Jun 07 23:06:47 2017 +0200
@@ -48,6 +48,7 @@
 	$cmd[] = "PORT,".$_POST['Port'];
 	$cmd[] = "TEMP_ADDRESS,".$_POST['TempAddress'];
 	$cmd[] = "HUM_ADDRESS,".$_POST['HumAddress'];
+	$cmd[] = "TEMP_HUM_IDX,".$_POST['TempHumIdx'];
 	if (isset($_POST['LCDcols']))
 	    $cmd[] = "LCD_COLS,".$_POST['LCDcols'];
 	if (isset($_POST['LCDrows']))
@@ -60,6 +61,7 @@
     unset($_POST['Port']);
     unset($_POST['TempAddress']);
     unset($_POST['HumAddress']);
+    unset($_POST['TempHumIdx']);
     unset($_POST['LCDcols']);
     unset($_POST['LCDrows']);
     unset($_POST['key']);
@@ -72,7 +74,7 @@
 
     if (isset($_POST['Name']) && isset($_POST['Port']) &&
 	isset($_POST['TempAddress']) && isset($_POST['HumAddress']) &&
-	isset($_POST['key'])) {
+	isset($_POST['TempHumIdx']) && isset($_POST['key'])) {
 
 	if ($_POST['key'] == 'Cancel')
 	    return 99;
@@ -203,6 +205,12 @@
 		$outstr .= '        </select></td>'.PHP_EOL;
 		$outstr .= '       </tr>'.PHP_EOL;
 	    }
+	    if ($f[0] == "TEMP_HUM_IDX") {
+		$outstr .= '       <tr class="editor">'.PHP_EOL;
+		$outstr .= '        <td class="editname">Temp/Humidity domoticz index</td>'.PHP_EOL;
+		$outstr .= '        <td class="editfield"><input type="text" name="TempHumIdx" size="5" value="'.$f[1].'"></td>'.PHP_EOL;
+		$outstr .= '       </tr>'.PHP_EOL;
+	    }
 	    if ($f[0] == "LCD_COLS") {
 		$outstr .= '       <tr class="editor">'.PHP_EOL;
 		$outstr .= '        <td class="editname">LCD columns</td>'.PHP_EOL;
--- a/www-thermferm/units.php	Wed May 31 16:29:52 2017 +0200
+++ b/www-thermferm/units.php	Wed Jun 07 23:06:47 2017 +0200
@@ -1,6 +1,6 @@
 <?php
 /*****************************************************************************
- * Copyright (C) 2014-2015
+ * Copyright (C) 2014-2017
  *   
  * Michiel Broek <mbroek at mbse dot eu>
  *
@@ -93,17 +93,25 @@
 	$cmd[] = "NAME,".$_POST['Name'];
 	$cmd[] = "VOLUME,".$_POST['Volume'];
 	$cmd[] = "AIR_ADDRESS,".$_POST['AirAddress'];
+	$cmd[] = "AIR_IDX,".$_POST['AirIdx'];
 	$cmd[] = "BEER_ADDRESS,".$_POST['BeerAddress'];
+	$cmd[] = "BEER_IDX,".$_POST['BeerIdx'];
 	$cmd[] = "HEATER_ADDRESS,".$_POST['HeaterAddress'];
 	$cmd[] = "HEATER_DELAY,".$_POST['HeaterDelay'];
+	$cmd[] = "HEATER_IDX,".$_POST['HeaterIdx'];
 	$cmd[] = "COOLER_ADDRESS,".$_POST['CoolerAddress'];
 	$cmd[] = "COOLER_DELAY,".$_POST['CoolerDelay'];
+	$cmd[] = "COOLER_IDX,".$_POST['CoolerIdx'];
 	$cmd[] = "FAN_ADDRESS,".$_POST['FanAddress'];
 	$cmd[] = "FAN_DELAY,".$_POST['FanDelay'];
+	$cmd[] = "FAN_IDX,".$_POST['FanIdx'];
 	$cmd[] = "LIGHT_ADDRESS,".$_POST['LightAddress'];
 	$cmd[] = "LIGHT_DELAY,".$_POST['LightDelay'];
+	$cmd[] = "LIGHT_IDX,".$_POST['LightIdx'];
 	$cmd[] = "DOOR_ADDRESS,".$_POST['DoorAddress'];
+	$cmd[] = "DOOR_IDX,".$_POST['DoorIdx'];
 	$cmd[] = "PSU_ADDRESS,".$_POST['PSUAddress'];
+	$cmd[] = "PSU_IDX,".$_POST['PSUIdx'];
 	$cmd[] = "TEMP_SET_MIN,".$_POST['TempSetMin'];
 	$cmd[] = "TEMP_SET_MAX,".$_POST['TempSetMax'];
 	$cmd[] = "PIDC_IMAX,".$_POST['PIDC_iMax'];
@@ -126,17 +134,25 @@
     unset($_POST['key']);
     unset($_POST['command']);
     unset($_POST['AirAddress']);
+    unset($_POST['AirIdx']);
     unset($_POST['BeerAddress']);
+    unset($_POST['BeerIdx']);
     unset($_POST['HeaterAddress']);
     unset($_POST['HeaterDelay']);
+    unset($_POST['HeaterIdx']);
     unset($_POST['CoolerAddress']);
     unset($_POST['CoolerDelay']);
+    unset($_POST['CoolerIdx']);
     unset($_POST['LightAddress']);
     unset($_POST['LightDelay']);
+    unset($_POST['LightIdx']);
     unset($_POST['FanAddress']);
     unset($_POST['FanDelay']);
+    unset($_POST['FanIdx']);
     unset($_POST['DoorAddress']);
+    unset($_POST['DoorIdx']);
     unset($_POST['PSUAddress']);
+    unset($_POST['PSUIdx']);
     unset($_POST['TempSetMin']);
     unset($_POST['TempSetMax']);
     unset($_POST['PIDC_iMax']);
@@ -187,7 +203,9 @@
 	isset($_POST['FanAddress']) && isset($_POST['DoorAddress']) && isset($_POST['TempSetMin']) && isset($_POST['TempSetMax']) &&
 	isset($_POST['PIDC_pGain']) && isset($_POST['PIDC_iGain']) && isset($_POST['PIDC_dGain']) && isset($_POST['PIDC_idleRange']) &&
 	isset($_POST['PIDH_pGain']) && isset($_POST['PIDH_iGain']) && isset($_POST['PIDH_dGain']) && isset($_POST['PIDH_idleRange']) &&
-	isset($_POST['PIDC_iMax']) && isset($_POST['PIDH_iMax']) &&
+	isset($_POST['PIDC_iMax']) && isset($_POST['PIDH_iMax']) && isset($_POST['AirIdx']) && isset($_POST['BeerIdx']) &&
+	isset($_POST['HeaterIdx']) && isset($_POST['CoolerIdx']) && isset($_POST['LightIdx']) && isset($_POST['DoorIdx']) &&
+	isset($_POST['PSUIdx']) && isset($_POST['FanIdx']) &&
 	isset($_POST['FanDelay']) && isset($_POST['key']) && isset($_POST['command'])) {
 
 	if ($_POST['key'] == 'Cancel')
@@ -372,6 +390,12 @@
     		$outstr .= '        </select></td>'.PHP_EOL;
 		$outstr .= '       </tr>'.PHP_EOL;
 	    }
+	    if ($f[0] == "AIR_IDX") {
+		$outstr .= '       <tr class="editor">'.PHP_EOL;
+		$outstr .= '        <td class="editname">Air domoticz idx</td>'.PHP_EOL;
+		$outstr .= '        <td class="editfield"><input type="text" name="AirIdx" size="5" value="'.$f[1].'"></td>'.PHP_EOL;
+		$outstr .= '       </tr>'.PHP_EOL;
+	    }
 	    if ($f[0] == "BEER_ADDRESS") {
                 $outstr .= '       <tr class="editor">'.PHP_EOL;
                 $outstr .= '        <td class="editname">Beer Sensor Address</td>'.PHP_EOL;
@@ -393,6 +417,12 @@
 		$outstr .= '        </select></td>'.PHP_EOL;
 		$outstr .= '       </tr>'.PHP_EOL;
 	    }
+	    if ($f[0] == "BEER_IDX") {
+		$outstr .= '       <tr class="editor">'.PHP_EOL;
+		$outstr .= '        <td class="editname">Beer domoticz idx</td>'.PHP_EOL;
+		$outstr .= '        <td class="editfield"><input type="text" name="BeerIdx" size="5" value="'.$f[1].'"></td>'.PHP_EOL;
+		$outstr .= '       </tr>'.PHP_EOL;
+	    }
 	    if ($f[0] == "HEATER_ADDRESS") {
 		$outstr .= '       <tr class="editor">'.PHP_EOL;
 		$outstr .= '        <td class="editname">Heater Switch Address</td>'.PHP_EOL;
@@ -420,6 +450,12 @@
 		$outstr .= '        <td class="editfield"><input type="text" name="HeaterDelay" size="5" value="'.$f[1].'"> seconds (0..720)</td>'.PHP_EOL;
 		$outstr .= '       </tr>'.PHP_EOL;
 	    }
+	    if ($f[0] == "HEATER_IDX") {
+		$outstr .= '       <tr class="editor">'.PHP_EOL;
+		$outstr .= '        <td class="editname">Heater domoticz idx</td>'.PHP_EOL;
+		$outstr .= '        <td class="editfield"><input type="text" name="HeaterIdx" size="5" value="'.$f[1].'"></td>'.PHP_EOL;
+		$outstr .= '       </tr>'.PHP_EOL;
+	    }
 	    if ($f[0] == "PIDH_IMAX") {
 		$outstr .= '       <tr class="editor">'.PHP_EOL;
 		$outstr .= '        <td class="editname">PID Heat Maximum</td>'.PHP_EOL;
@@ -477,6 +513,12 @@
 		$outstr .= '        <td class="editfield"><input type="text" name="CoolerDelay" size="5" value="'.$f[1].'"> seconds (0..720)</td>'.PHP_EOL;
 		$outstr .= '       </tr>'.PHP_EOL;
 	    }
+	    if ($f[0] == "COOLER_IDX") {
+		$outstr .= '       <tr class="editor">'.PHP_EOL;
+		$outstr .= '        <td class="editname">Cooler domoticz idx</td>'.PHP_EOL;
+		$outstr .= '        <td class="editfield"><input type="text" name="CoolerIdx" size="5" value="'.$f[1].'"></td>'.PHP_EOL;
+		$outstr .= '       </tr>'.PHP_EOL;
+	    }
 	    if ($f[0] == "PIDC_IMAX") {
 		$outstr .= '       <tr class="editor">'.PHP_EOL;
 		$outstr .= '        <td class="editname">PID Cool Maximum</td>'.PHP_EOL;
@@ -534,6 +576,12 @@
 		$outstr .= '        <td class="editfield"><input type="text" name="FanDelay" size="5" value="'.$f[1].'"> seconds (0..720)</td>'.PHP_EOL;
 		$outstr .= '       </tr>'.PHP_EOL;
 	    }
+	    if ($f[0] == "FAN_IDX") {
+		$outstr .= '       <tr class="editor">'.PHP_EOL;
+		$outstr .= '        <td class="editname">Fan domoticz idx</td>'.PHP_EOL;
+		$outstr .= '        <td class="editfield"><input type="text" name="FanIdx" size="5" value="'.$f[1].'"></td>'.PHP_EOL;
+		$outstr .= '       </tr>'.PHP_EOL;
+	    }
 	    if ($f[0] == "LIGHT_ADDRESS") {
 		$outstr .= '       <tr class="editor">'.PHP_EOL;
 		$outstr .= '        <td class="editname">Lights Address</td>'.PHP_EOL;
@@ -561,6 +609,12 @@
 		$outstr .= '        <td class="editfield"><input type="text" name="LightDelay" size="5" value="'.$f[1].'"> seconds (0..720)</td>'.PHP_EOL;
 		$outstr .= '       </tr>'.PHP_EOL;
 	    }
+	    if ($f[0] == "LIGHT_IDX") {
+		$outstr .= '       <tr class="editor">'.PHP_EOL;
+		$outstr .= '        <td class="editname">Light domoticz idx</td>'.PHP_EOL;
+		$outstr .= '        <td class="editfield"><input type="text" name="LightIdx" size="5" value="'.$f[1].'"></td>'.PHP_EOL;
+		$outstr .= '       </tr>'.PHP_EOL;
+	    }
 	    if ($f[0] == "DOOR_ADDRESS") {
 		$outstr .= '       <tr class="editor">'.PHP_EOL;
 		$outstr .= '        <td class="editname">Door Sensor Address</td>'.PHP_EOL;
@@ -582,6 +636,12 @@
 		$outstr .= '        </select></td>'.PHP_EOL;                        
 		$outstr .= '       </tr>'.PHP_EOL;                                  
 	    }
+	    if ($f[0] == "DOOR_IDX") {
+		$outstr .= '       <tr class="editor">'.PHP_EOL;
+		$outstr .= '        <td class="editname">Door domoticz idx</td>'.PHP_EOL;
+		$outstr .= '        <td class="editfield"><input type="text" name="DoorIdx" size="5" value="'.$f[1].'"></td>'.PHP_EOL;
+		$outstr .= '       </tr>'.PHP_EOL;
+	    }
 	    if ($f[0] == "PSU_ADDRESS") {
 		$outstr .= '       <tr class="editor">'.PHP_EOL;
 		$outstr .= '        <td class="editname">Power Supply Sensor Address</td>'.PHP_EOL;
@@ -603,6 +663,12 @@
 		$outstr .= '        </select></td>'.PHP_EOL;
 		$outstr .= '       </tr>'.PHP_EOL;
 	    }
+	    if ($f[0] == "PSU_IDX") {
+		$outstr .= '       <tr class="editor">'.PHP_EOL;
+		$outstr .= '        <td class="editname">PSU domoticz idx</td>'.PHP_EOL;
+		$outstr .= '        <td class="editfield"><input type="text" name="PSUIdx" size="5" value="'.$f[1].'"></td>'.PHP_EOL;
+		$outstr .= '       </tr>'.PHP_EOL;
+	    }
 	    if ($f[0] == "TEMP_SET_MIN") {
 		$outstr .= '       <tr class="editor">'.PHP_EOL;
 		$outstr .= '        <td class="editname">Min. temp setting</td>'.PHP_EOL;
@@ -710,17 +776,25 @@
     $outstr .= '        <td class="editsub"><input type="submit" value="Add" name="key"></td>'.PHP_EOL;
     $outstr .= '<input type="hidden" value="0.0" name="Volume">';
     $outstr .= '<input type="hidden" value="" name="AirAddress">';
+    $outstr .= '<input type="hidden" value="0" name="AirIdx">';
     $outstr .= '<input type="hidden" value="" name="BeerAddress">';
+    $outstr .= '<input type="hidden" value="0" name="BeerIdx">';
     $outstr .= '<input type="hidden" value="" name="HeaterAddress">';
     $outstr .= '<input type="hidden" value="20" name="HeaterDelay">';
+    $outstr .= '<input type="hidden" value="0" name="HeaterIdx">';
     $outstr .= '<input type="hidden" value="" name="CoolerAddress">';
     $outstr .= '<input type="hidden" value="20" name="CoolerDelay">';
+    $outstr .= '<input type="hidden" value="0" name="CoolerIdx">';
     $outstr .= '<input type="hidden" value="" name="FanAddress">';
     $outstr .= '<input type="hidden" value="20" name="FanDelay">';
+    $outstr .= '<input type="hidden" value="0" name="FanIdx">';
     $outstr .= '<input type="hidden" value="" name="LightAddress">';
     $outstr .= '<input type="hidden" value="1" name="LightDelay">';
+    $outstr .= '<input type="hidden" value="0" name="LightIdx">';
     $outstr .= '<input type="hidden" value="" name="DoorAddress">';
+    $outstr .= '<input type="hidden" value="0" name="DoorIdx">';
     $outstr .= '<input type="hidden" value="" name="PSUAddress">';
+    $outstr .= '<input type="hidden" value="0" name="PSUIdx">';
     $outstr .= '<input type="hidden" value="1.0" name="TempSetMin">';
     $outstr .= '<input type="hidden" value="30.0" name="TempSetMax">';
     $outstr .= '<input type="hidden" value="100" name="PIDC_iMax">';

mercurial