thermferm/mqtt.c

changeset 548
2924fe4911d9
parent 547
0e4d4b45249f
child 549
ee1bcad035f0
--- a/thermferm/mqtt.c	Thu Jul 19 14:08:32 2018 +0200
+++ b/thermferm/mqtt.c	Fri Jul 20 21:37:45 2018 +0200
@@ -422,14 +422,19 @@
     /*
      * Loaded profile and state
      */
-    if (unit->mode == UNITMODE_PROFILE && unit->profile) {
+    if (unit->profile) {
 	for (profile = Config.profiles; profile; profile = profile->next) {
 	    if (strcmp(unit->profile, profile->uuid) == 0) {
 		payload = xstrcat(payload, (char *)",\"profile\":{\"uuid\":\"");
 		payload = xstrcat(payload, unit->profile);
-		payload = xstrcat(payload, (char *)",\"name\":\"");
+		payload = xstrcat(payload, (char *)"\",\"name\":\"");
 		payload = xstrcat(payload, profile->name);
-		payload = xstrcat(payload, (char *)"\",\"inittemp\":{\"low\":");
+		payload = xstrcat(payload, (char *)"\",\"state\":\"");
+		payload = xstrcat(payload, (char *)PROFSTATE[unit->prof_state]);
+		payload = xstrcat(payload, (char *)"\",\"percent\":");
+		sprintf(buf, "%d", unit->prof_percent);
+		payload = xstrcat(payload, buf);
+		payload = xstrcat(payload, (char *)",\"inittemp\":{\"low\":");
 		sprintf(buf, "%.1f", profile->inittemp_lo);
 		payload = xstrcat(payload, buf);
 		payload = xstrcat(payload, (char *)",\"high\":");

mercurial