fix 12hr early Sunset/Sunrise (xdrv_09_timers.ino ) #7174
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
Fix a small web/configuration issue causing the Sunset/Sunrise timer activates 12 hours early when accidentally using an negative zero offset (-00:00 time). In case the user enters "-" (minus) 00:00. The web-script sees this as an delta, subtracts 720 minutes (12 hours) before adding the delta time. This causes that the subset/sunrise will go off , 12 hours early.
If and in case users really want 12 hours before, it is more logical they enter a real time-offset as intended.
The fix is small, but prevent a problem that the SunSet (or SunRise) timer (at timer mode 2 or 1), will otherwise trigger 12 hours early or later then intended.
Without the change: the configuration will read: ... "mode": 2, "power": 1, "repeat": 1, "time": 720, "window": 0},
After the proposed correction (and of course a configuration save), the configuration will result into: "mode": 2, "power": 1, "repeat": 1, "time": 0, "window": 0 ...
Note: this is my first active contribution in the steeple chase what is required. It is quite an experience to have things sorted out and I'm open to improvements. TIA for your considerations.
Related issue (if applicable): fixes #
Checklist: