added workaround for suncalc bug #11 #2
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.
For me, suncron only worked on the first day. On the second day, no events happened.
I added some debug code, and found this:
25 Sep 00:00:05 - [warn] [suncron:Sonne] calcScheduleForToday()
25 Sep 00:00:05 - [warn] [suncron:Sonne] today: 2019-09-24T22:00:05.300Z
25 Sep 00:00:05 - [warn] [suncron:Sonne] event at 2019-09-24T04:17:27.766Z
25 Sep 00:00:05 - [warn] [suncron:Sonne] event at 2019-09-24T15:18:09.241Z
25 Sep 00:00:05 - [warn] [suncron:Sonne] 1 msg crons deleted
25 Sep 00:00:05 - [warn] [suncron:Sonne] sunriseEnd: WARNING: Date in past. Will never be fired.
25 Sep 00:00:05 - [warn] [suncron:Sonne] sunsetStart: WARNING: Date in past. Will never be fired.
25 Sep 00:00:05 - [warn] [suncron:Sonne] 2 msg crons installed
The cron-job ran on September 25 00:00:05 local time. 'today' is in UTC, still September 24. And suncalc calculates events for September 24.
I believe this is due to this issue in suncalc:
mourner/suncalc#11
I added the workaround, and it works for me.