[MQTT] Optional message retain flag (#1534)

* Define optional sensor_Retain

...with default : false to preserve current behaviour

* Support optional sensor message retaining
This commit is contained in:
ilgrank authored and GitHub committed 2023-03-15 13:20:08 -05:00
1 parent 3ceb19f7be
commit dbba1bdaf7
2 files changed
+4 -1

No files matched your search

+3
View File
@@ -359,6 +359,9 @@ int lowpowermode = DEFAULT_LOW_POWER_MODE;
#ifndef will_Retain
# define will_Retain true
#endif
#ifndef sensor_Retain
# define sensor_Retain false
#endif
#ifndef will_Message
# define will_Message "offline"
#endif
+1 -1
View File
@@ -462,7 +462,7 @@ void pub_custom_topic(const char* topic, JsonObject& data, boolean retain) {
* @param payload the payload
*/
void pubMQTT(const char* topic, const char* payload) {
pubMQTT(topic, payload, false);
pubMQTT(topic, payload, sensor_Retain);
}
/**