--- a/thermferm/rdconfig.c Wed Oct 29 14:41:00 2014 +0100 +++ b/thermferm/rdconfig.c Wed Oct 29 20:27:37 2014 +0100 @@ -358,6 +358,10 @@ syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); return 1; } + if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_USAGE", "%d", tmp3->heater_usage)) < 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)) { @@ -372,6 +376,10 @@ syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); return 1; } + if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_USAGE", "%d", tmp3->cooler_usage)) < 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)) { @@ -386,6 +394,10 @@ syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); return 1; } + if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_USAGE", "%d", tmp3->fan_usage)) < 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)) { @@ -867,6 +879,7 @@ unit->heater_state = unit->cooler_state = unit->fan_state = unit->door_state = unit->mode = unit->prof_state = 0; unit->heater_delay = unit->cooler_delay = unit->fan_delay = 20; /* 5 minutes delay */ unit->heater_wait = unit->cooler_wait = unit->fan_wait = 0; + unit->heater_usage = unit->cooler_usage = unit->fan_usage = 0; unit->temp_set_min = 1.0; unit->temp_set_max = 30.0; unit->idle_rangeH = 1.0; @@ -937,6 +950,12 @@ unit->heater_delay = 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) + unit->heater_usage = ival; + xmlFree(key); + } if ((!xmlStrcmp(cur->name, (const xmlChar *)"COOLER_ADDRESS"))) { unit->cooler_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); } @@ -946,6 +965,12 @@ unit->cooler_delay = 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) + unit->cooler_usage = ival; + xmlFree(key); + } if ((!xmlStrcmp(cur->name, (const xmlChar *)"FAN_ADDRESS"))) { unit->fan_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); } @@ -955,6 +980,12 @@ unit->fan_delay = 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) + unit->fan_usage = ival; + xmlFree(key); + } if ((!xmlStrcmp(cur->name, (const xmlChar *)"DOOR_ADDRESS"))) { unit->door_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); }