From 3a8caa15b976a1a3e69dc39a108a423de1b5ff07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Kristan?= Date: Wed, 19 May 2021 08:22:41 +0200 Subject: [PATCH] Reverted retained MQTT messages. --- wled00/mqtt.cpp | 12 ++++++------ wled00/wled.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/wled00/mqtt.cpp b/wled00/mqtt.cpp index a6104b1c9..ce06242d1 100644 --- a/wled00/mqtt.cpp +++ b/wled00/mqtt.cpp @@ -122,22 +122,22 @@ void publishMqtt() sprintf_P(s, PSTR("%u"), bri); strcpy(subuf, mqttDeviceTopic); strcat_P(subuf, PSTR("/g")); - mqtt->publish(subuf, 0, false, s); // do not retain message + mqtt->publish(subuf, 0, true, s); // retain message sprintf_P(s, PSTR("#%06X"), (col[3] << 24) | (col[0] << 16) | (col[1] << 8) | (col[2])); strcpy(subuf, mqttDeviceTopic); strcat_P(subuf, PSTR("/c")); - mqtt->publish(subuf, 0, false, s); // do not retain message + mqtt->publish(subuf, 0, true, s); // retain message strcpy(subuf, mqttDeviceTopic); strcat_P(subuf, PSTR("/status")); - mqtt->publish(subuf, 0, false, "online"); // do not retain message + mqtt->publish(subuf, 0, true, "online"); // retain message for a LWT - char apires[1024]; + char apires[1024]; // allocating 1024 bytes from stack can be risky XML_response(nullptr, apires); strcpy(subuf, mqttDeviceTopic); strcat_P(subuf, PSTR("/v")); - mqtt->publish(subuf, 0, false, apires); // do not retain message + mqtt->publish(subuf, 0, false, apires); // do not retain message } @@ -167,7 +167,7 @@ bool initMqtt() strcpy(mqttStatusTopic, mqttDeviceTopic); strcat_P(mqttStatusTopic, PSTR("/status")); - mqtt->setWill(mqttStatusTopic, 0, true, "offline"); + mqtt->setWill(mqttStatusTopic, 0, true, "offline"); // LWT message mqtt->setKeepAlive(MQTT_KEEP_ALIVE_TIME); mqtt->connect(); return true; diff --git a/wled00/wled.h b/wled00/wled.h index c19c8eac7..cbb6d1f41 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -3,12 +3,12 @@ /* Main sketch, global variable declarations @title WLED project sketch - @version 0.12.1-a1 + @version 0.12.2-bl2 @author Christian Schwinne */ // version code in format yymmddb (b = daily build) -#define VERSION 2105181 +#define VERSION 2105191 //uncomment this if you have a "my_config.h" file you'd like to use //#define WLED_USE_MY_CONFIG