Open BabyCakes13 opened 1 year ago
Finished implementing the reconnection on values updated from the web interface. The only problem which I still have is that the callback function for reconnection is called for each entry:
Resulting in reconnecting four times, in this case:
I have to update the logic to only reconnect ONCE after its values are all updated.
This will be a bit tricky as each value is updated via a callback. There is no knowledge on when the "last" time this function is called, such that the reconnection has a green flag to go.
Done. I implemented an object timer (for each section) which is reset every time a section update happens in the configuration. When the timer is not reset any more, that means that the sequence of entry updates for that section has finished and the callback function can be safely called:
With this implementation, there is no need to check which entry is updated for which section. When there are a sequence of multiple entry updates for a section, the timer simply resets, blocking the call of the callback function:
Done in 93f22c2.
When the broker url and port are updated from the web app, the mqtt connection should stop and reconnect to the new values.