# HG changeset patch # User Michiel Broek # Date 1531754602 -7200 # Node ID 5a26429abbf89608e3bac5feb54d478f660b377a # Parent 300b5c4cd9771f130d436f3df9073ea4b916be49 Versie 0.6.7. Globale uuid toegevoegd voor de NBIRTH payload. diff -r 300b5c4cd977 -r 5a26429abbf8 configure --- a/configure Mon Jul 16 11:41:46 2018 +0200 +++ b/configure Mon Jul 16 17:23:22 2018 +0200 @@ -2035,7 +2035,7 @@ PACKAGE="mbsePi-apps" -VERSION="0.6.6" +VERSION="0.6.7" COPYRIGHT="Copyright (C) 2014-2018 Michiel Broek, All Rights Reserved" CYEARS="2014-2018" diff -r 300b5c4cd977 -r 5a26429abbf8 configure.ac --- a/configure.ac Mon Jul 16 11:41:46 2018 +0200 +++ b/configure.ac Mon Jul 16 17:23:22 2018 +0200 @@ -8,7 +8,7 @@ dnl General settings dnl After changeing the version number, run autoconf! PACKAGE="mbsePi-apps" -VERSION="0.6.6" +VERSION="0.6.7" COPYRIGHT="Copyright (C) 2014-2018 Michiel Broek, All Rights Reserved" CYEARS="2014-2018" AC_SUBST(PACKAGE) diff -r 300b5c4cd977 -r 5a26429abbf8 thermferm/mqtt.c --- a/thermferm/mqtt.c Mon Jul 16 11:41:46 2018 +0200 +++ b/thermferm/mqtt.c Mon Jul 16 17:23:22 2018 +0200 @@ -530,7 +530,16 @@ payload = payload_header(); payload = xstrcat(payload, (char *)"{"); + if (birth) { + payload = xstrcat(payload, (char *)"\"uuid\":\""); + payload = xstrcat(payload, Config.uuid); + payload = xstrcat(payload, (char *)"\""); + comma = true; + } + if (birth || flag & MQTT_NODE_CONTROL) { + if (comma) + payload = xstrcat(payload, (char *)","); payload = xstrcat(payload, (char *)"\"nodecontrol\":{\"reboot\":false,\"rebirth\":false,\"nextserver\":false,\"scanrate\":3000}"); comma = true; } diff -r 300b5c4cd977 -r 5a26429abbf8 thermferm/rdconfig.c --- a/thermferm/rdconfig.c Mon Jul 16 11:41:46 2018 +0200 +++ b/thermferm/rdconfig.c Mon Jul 16 17:23:22 2018 +0200 @@ -75,6 +75,9 @@ if (Config.mqtt_password) free(Config.mqtt_password); Config.mqtt_password = NULL; + if (Config.uuid) + free(Config.uuid); + Config.uuid = NULL; for (tmp2 = Config.units; tmp2; tmp2 = tmp2->next) { if (tmp2->uuid) @@ -219,6 +222,10 @@ syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); return 1; } + if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "UUID", "%s", Config.uuid)) < 0) { + syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); + return 1; + } if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "LISTEN_PORT", "%d", Config.my_port)) < 0) { syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); return 1; @@ -2219,6 +2226,9 @@ if ((!xmlStrcmp(cur->name, (const xmlChar *)"MQTT_PASS"))) { Config.mqtt_password = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); } + if ((!xmlStrcmp(cur->name, (const xmlChar *)"UUID"))) { + Config.uuid= (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); + } if ((!xmlStrcmp(cur->name, (const xmlChar *)"LCDS"))) { parseLCDs(doc, cur); } @@ -2243,6 +2253,17 @@ free(mypath); mypath = NULL; + /* + * If the system uuid is not set, do it now. + */ + if (Config.uuid == NULL) { + uuid_t uu; + + Config.uuid = malloc(37); + uuid_generate(uu); + uuid_unparse(uu, Config.uuid); + } + return rc; } diff -r 300b5c4cd977 -r 5a26429abbf8 thermferm/thermferm.h --- a/thermferm/thermferm.h Mon Jul 16 11:41:46 2018 +0200 +++ b/thermferm/thermferm.h Mon Jul 16 17:23:22 2018 +0200 @@ -366,6 +366,7 @@ int mqtt_port; /* MQTT port to connect to */ char *mqtt_username; /* MQTT username */ char *mqtt_password; /* MQTT password */ + char *uuid; /* System uuid */ } sys_config;