Repository navigation
Sun events - #57
Closed
Dnovak043 wants to merge 2 commits into
Closed
Sun events#57Dnovak043 wants to merge 2 commits into
Dnovak043 wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add local sun events (sunrise, sunset, dusk, dawn…) as schedule times
Lets any
from,toorschedulevalue be a sun event instead of a cron expression, so modules can follow daylight through the seasons:suncalcevent, including sunrise/sunset, civil, nautical and astronomical dawn/dusk, golden hour and solar noon. Custom events can be added by sun angle (sun.events).dusk+15,dawn-1.5h.suncalc(new dependency,^2.0.2) fromsun.lat/sun.lon. No network or other modules involved.sun.recalculate(default daily at 00:05), overridable per schedule entry with recalculate.Most of the logic is in a new
sun_scheduler.js.node_helper.jschanges are small:createCronJobreturns a cron-compatibleSunCronJobfor sun expressions, so the startup-state check and job cleanup work unchanged. The README has a new “Sun Event Schedules” section covering options, event names, offsets and recalculation.Existing unit tests, ESLint and Prettier all pass. I also tested it on MagicMirror 2.38: global, module and notification schedules, page reloads, daylight-saving days and polar day/night.