[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
2023-03-15 19:20:08 +01:00
committed by GitHub
parent 3ceb19f7be
commit dbba1bdaf7
2 changed files with 4 additions and 1 deletions

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

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);
}
/**