You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not a JS guy, but from a general clean-code-perspective, I think that the whole setStates-function would benefit from braking it up into smaller functions. Especially the case 'extra-cntrlswitch' could be put in something like handleExtraCntrlSwitch() and use a switch instead of the ifs to switch on Central, Shedule, Boost and Off, or at the very least use "else if" there - this would make the intention of the code more clear ("it's either this or that..."). With the existing "if (target !== 'Central')" at the end, it would be more clear that the intention is to run this on all the cases EXCEPT when target is Central.
Maybe it would be even more readable to have a resetSwitchState() and call this explicitly in all the relevant cases...
The text was updated successfully, but these errors were encountered:
Yes I have noticed this too it would be great if this switch reacted as should so once a manual override has been do this switch should be turned off automatically allowing you to know it's been changed
I take it the schedule-switch should act as a toggle? When I tested it, it just stayed on. From reading the code, my guess is that this return here...
homebridge-tado-platform/src/helper/handler.js
Line 317 in 610be01
... shouldn't be there?!
I'm not a JS guy, but from a general clean-code-perspective, I think that the whole setStates-function would benefit from braking it up into smaller functions. Especially the case 'extra-cntrlswitch' could be put in something like handleExtraCntrlSwitch() and use a switch instead of the ifs to switch on Central, Shedule, Boost and Off, or at the very least use "else if" there - this would make the intention of the code more clear ("it's either this or that..."). With the existing "if (target !== 'Central')" at the end, it would be more clear that the intention is to run this on all the cases EXCEPT when target is Central.
Maybe it would be even more readable to have a resetSwitchState() and call this explicitly in all the relevant cases...
The text was updated successfully, but these errors were encountered: