fix: do not publish sensor updates with RETAIN#229
fix: do not publish sensor updates with RETAIN#229Suxsem wants to merge 1 commit intoLaxilef:masterfrom
Conversation
… on old values for sensors
|
Hi @Suxsem, Thank you for your contribution! Indeed, I've noticed something similar and I think I've already made the appropriate changes to the async branch. Can you test it? Removing the |
|
hi @Laxilef, |
|
@Laxilef |
Background and motivation
I have some sensors configured as manual (update via API/MQTT) in OTGateway and recently I found a boring issue: after booting OTGateway always reported a strange sensor value in dashboard and the sensor was considered as connected despite no updates where pushed via API/MQTT. After some digging I found that I had a retained value in the sensor mqtt topic that on boot would trick the gateway into thinking that a new update was pushed.
I deleted that retained message and restarted the board but after a few seconds the retained message came back. I then discovered that OTGateway is publishing sensor values with the retain flag set. In my option this is not correct and should only be used for configuration values and not for real-time ones.
The change
This PR simply changes sensor publishing function in MqttTask to publish update messages without the retain flag set.
I'm testing the change for a couple of days not without any side effect.
I hope this could be useful for others!