Most of the time updates on MQTT topics will only be sent if values are actually changed. But if the Wifi or MQTT connection is lost, all values will be resent when a new connection is made.
As the MQTT server will notify all clients of the change (even if the values is not changed), this can be a bit annoying. I.e. if you monitor the battery level and get an email when it is below a certain level, you will get notified each time a re-connection occur.
The solution is to read values from the MQTT server on connection, so that only updates will be sent.
Most of the time updates on MQTT topics will only be sent if values are actually changed. But if the Wifi or MQTT connection is lost, all values will be resent when a new connection is made.
As the MQTT server will notify all clients of the change (even if the values is not changed), this can be a bit annoying. I.e. if you monitor the battery level and get an email when it is below a certain level, you will get notified each time a re-connection occur.
The solution is to read values from the MQTT server on connection, so that only updates will be sent.