This commit resolves #17. To fix the timing issue, a more accurate timing system was implemented, and delays in running functions is taken into account when calculating sleep periods. With this new code, the script runs on time within a tolerance of ~15 seconds as of testing.
The new code was tested in a controlled shortened test, and the timing was accurate for both when the bulbs are responsive and when they are not. Further tests in deployed environment will take place over the next few days.
I also cleaned up getSun.py and added code to set default values for the bulbs if for some reason values.target gets deleted.
This commit resolves #17. To fix the timing issue, a more accurate timing system was implemented, and delays in running functions is taken into account when calculating sleep periods. With this new code, the script runs on time within a tolerance of ~15 seconds as of testing.
The new code was tested in a controlled shortened test, and the timing was accurate for both when the bulbs are responsive and when they are not. Further tests in deployed environment will take place over the next few days.
I also cleaned up getSun.py and added code to set default values for the bulbs if for some reason values.target gets deleted.