diff -r 6cabc02f4c8d -r 825210ba2707 thermferm/rdconfig.c --- a/thermferm/rdconfig.c Thu Apr 11 15:58:49 2024 +0200 +++ b/thermferm/rdconfig.c Sat Apr 13 16:50:26 2024 +0200 @@ -238,6 +238,7 @@ xmlTextWriterWriteFormatElement(writer, BAD_CAST "MQTT_USER", "%s", Config.mqtt_username); xmlTextWriterWriteFormatElement(writer, BAD_CAST "MQTT_PASS", "%s", Config.mqtt_password); } + xmlTextWriterWriteFormatElement(writer, BAD_CAST "WS_PORT", "%d", Config.websocket_port); /* * Start an element named "LCDS" as child of THERMFERM. @@ -1568,6 +1569,7 @@ Config.mqtt_host = xstrcpy((char *)"localhost"); Config.mqtt_port = 1883; Config.next_unit = 1; + Config.websocket_port = 8020; if ((cur = xmlDocGetRootElement(doc)) == NULL) { syslog(LOG_NOTICE, "XML file %s empty.", mypath); @@ -1635,8 +1637,14 @@ Config.mqtt_password = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); } if ((!xmlStrcmp(cur->name, (const xmlChar *)"UUID"))) { - Config.uuid= (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); + Config.uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); } + if ((!xmlStrcmp(cur->name, (const xmlChar *)"WS_PORT"))) { + key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); + if (sscanf((const char *)key, "%d", &ival) == 1) + Config.websocket_port = ival; + xmlFree(key); + } if ((!xmlStrcmp(cur->name, (const xmlChar *)"LCDS"))) { parseLCDs(doc, cur); }