nebulous / infinitude

Open control of Carrier/Bryant thermostats
MIT License
225 stars 50 forks source link

Don't update profile/schedule data while user is editing #136

Closed mamarley closed 2 years ago

mamarley commented 2 years ago

This fixes the issue where a timed (or manual) data update from the server would clobber any changes the user had made to the profile or schedule pages, which is very annoying while attempting to set up a schedule or make multiple changes to the profiles. It works by keeping a copy of the system data that is used for the profile and schedule pages. If the user has not edited anything, the copy is refreshed on every update to match the existing behavior. If the user does make a change, the updates to the copy stop until the user either saves the changes or reverts them. The color of the globe icon is changed to magenta to indicate this condition. Clicking the globe icon to do a refresh while there are pending changes displays a confirmation message to indicate that this action will overwrite the changes. The updating of the status and other data continues unchanged even when edits to the system data have been made. Additionally, the debounce logic has been removed and the Save buttons have been reconfigured to only allow saving when there is actually data to save.

nebulous commented 2 years ago

Sorry about the delay in reviewing this and thanks for the contribution! The update cycle is sufficiently twisty that it makes me more nervous than usual, but this method of comparing structures rather than brute force does seem better.

mamarley commented 2 years ago

Thanks! As before, I will be around to handle any bugs that pop up.