nebulous / infinitude

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

Fix hold activity dropdown always resetting to "home" on load #137

Closed mamarley closed 2 years ago

mamarley commented 2 years ago

In https://github.com/nebulous/infinitude/commit/6dd47b6adca250c33606cc81d2d17b7a7d38f332 I added an ng-init on the hold activity dropdowns to make them default to the first option instead of displaying an empty option, which would yield unexpected results if saved. However, this introduced a bug whereby the dropdown would always be set to the first option whenever it was displayed, even if another value was already selected. This fixes that bug by checking to see if the hold activity has the default value ("none" for wholeHouse and {} for zones) and only setting it in that case.