I am a newbie.
I want to use the equivalent of the “Retained message” in C ++ (CayenneMQTT libray); Cayenne.virtualWrite functions do not allow it.
I need this feature to realize among others a thermometer Min / Max;
I wish, in case of redemarage of the device, to be able to recover the last known values (I don’t want to store them in the device). Normally this is possible (see https://www.hivemq.com/blog/mqtt-essentials-part-8-retained-messages/)
It seems that this feature is available in Pyton (example mqttc.publish (topic_dht12_temp, payload = temp12, retain = True)). How to do without rewriting everything in C ++?
Cayenne broker does not allow the retain flag to be set
True. you adding
retain = True in the code, wont have any effect on it.
Too bad to have to leave Cayenne, it seemed to me rather well
Thank you for your reply
an alternative is to store the data in EEPROM.
Yes, but if you make a software update of the device to add new functionality, you lose everything. That’s why I excluded this idea
this is not the best approach but if it is personal project then while doing the software update, you can just pass on the last value to EEPROM again. So this way the latest value is retain within the arduino and you can also send this value in setup to cayenne.