rjwats / esp8266-react

A framework for ESP8266 & ESP32 microcontrollers with a React UI
GNU Lesser General Public License v3.0
476 stars 147 forks source link

Retain flag on MQTT topic & Last will & Testament message #325

Closed spyflox closed 1 year ago

spyflox commented 1 year ago

Hi @rjwats ! I really enjoy using your framework, it's very well coded!

Actualy I can retain a message on the broker manualy with _mqttClient->publish(pubTopic.c_str(), 0, true, msg_buffer); but I would like to retain the messages automatically sent from the StatefulService. Is there a way to replace _mqttPubSub.configureTopics(pubTopic, subTopic); or _mqttPubSub(SensorSettings::mqttRead, SensorSettings::mqttUpdate, this, mqttClient), or anythings else to set retain = true on the PubTopic ?

Is there also a way to set a LWT message in the CONNECT message?

spyflox commented 1 year ago

Hi @rjwats ! I really enjoy using your framework, it's very well coded!

Actualy I can retain a message on the broker manualy with _mqttClient->publish(pubTopic.c_str(), 0, true, msg_buffer); but I would like to retain the messages automatically sent from the StatefulService. Is there a way to replace _mqttPubSub.configureTopics(pubTopic, subTopic); or _mqttPubSub(SensorSettings::mqttRead, SensorSettings::mqttUpdate, this, mqttClient), or anythings else to set retain = true on the PubTopic ?

Is there also a way to set a LWT message in the CONNECT message?