mirror of
https://github.com/wled/WLED.git
synced 2025-07-09 11:56:35 +00:00
Reverted retained MQTT messages.
This commit is contained in:
parent
a5a25f02e3
commit
3a8caa15b9
@ -122,18 +122,18 @@ void publishMqtt()
|
|||||||
sprintf_P(s, PSTR("%u"), bri);
|
sprintf_P(s, PSTR("%u"), bri);
|
||||||
strcpy(subuf, mqttDeviceTopic);
|
strcpy(subuf, mqttDeviceTopic);
|
||||||
strcat_P(subuf, PSTR("/g"));
|
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]));
|
sprintf_P(s, PSTR("#%06X"), (col[3] << 24) | (col[0] << 16) | (col[1] << 8) | (col[2]));
|
||||||
strcpy(subuf, mqttDeviceTopic);
|
strcpy(subuf, mqttDeviceTopic);
|
||||||
strcat_P(subuf, PSTR("/c"));
|
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);
|
strcpy(subuf, mqttDeviceTopic);
|
||||||
strcat_P(subuf, PSTR("/status"));
|
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);
|
XML_response(nullptr, apires);
|
||||||
strcpy(subuf, mqttDeviceTopic);
|
strcpy(subuf, mqttDeviceTopic);
|
||||||
strcat_P(subuf, PSTR("/v"));
|
strcat_P(subuf, PSTR("/v"));
|
||||||
@ -167,7 +167,7 @@ bool initMqtt()
|
|||||||
|
|
||||||
strcpy(mqttStatusTopic, mqttDeviceTopic);
|
strcpy(mqttStatusTopic, mqttDeviceTopic);
|
||||||
strcat_P(mqttStatusTopic, PSTR("/status"));
|
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->setKeepAlive(MQTT_KEEP_ALIVE_TIME);
|
||||||
mqtt->connect();
|
mqtt->connect();
|
||||||
return true;
|
return true;
|
||||||
|
@ -3,12 +3,12 @@
|
|||||||
/*
|
/*
|
||||||
Main sketch, global variable declarations
|
Main sketch, global variable declarations
|
||||||
@title WLED project sketch
|
@title WLED project sketch
|
||||||
@version 0.12.1-a1
|
@version 0.12.2-bl2
|
||||||
@author Christian Schwinne
|
@author Christian Schwinne
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// version code in format yymmddb (b = daily build)
|
// 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
|
//uncomment this if you have a "my_config.h" file you'd like to use
|
||||||
//#define WLED_USE_MY_CONFIG
|
//#define WLED_USE_MY_CONFIG
|
||||||
|
Loading…
x
Reference in New Issue
Block a user