Skip to content

Add sun event scheduling (e.g. RunAtSunrise() )#1358

Merged
helto4real merged 2 commits intonet-daemon:mainfrom
duanemck:main
Mar 22, 2026
Merged

Add sun event scheduling (e.g. RunAtSunrise() )#1358
helto4real merged 2 commits intonet-daemon:mainfrom
duanemck:main

Conversation

@duanemck
Copy link
Copy Markdown
Contributor

Proposed change

In home automation it is often useful to trigger automations based off sun events such as sunrise or sunset. This feature extends the scheduling extension and wraps the SolarCalculator Nuget library to add a service with methods such as RunAtSunset(). I've only added sunrise, sunset, dusk and dawn though the underlying library supports other events.

As the SolarCalculator requires latitude, longitude and a Solar calculator to work, the new methods could not be added as extensions methods on IScheduler, so instead, a new service was introduced.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • The code compiles without warnings (code quality check)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration are added/changed:

@helto4real
Copy link
Copy Markdown
Collaborator

Thanks, good job. Sorry for the late merge. Life been busy.

@helto4real helto4real merged commit 99b2af6 into net-daemon:main Mar 22, 2026
5 checks passed
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 22, 2026

Codecov Report

❌ Patch coverage is 56.25000% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 82%. Comparing base (035ee37) to head (87be3c6).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...n.Extensions.Scheduling/SunEvents/SolarCalendar.cs 0% 9 Missing ⚠️
....Extensions.Scheduling/DependencyInjectionSetup.cs 0% 4 Missing ⚠️
...mon.Extensions.Scheduling/SunEvents/Coordinates.cs 0% 1 Missing ⚠️
Additional details and impacted files
@@         Coverage Diff          @@
##           main   #1358   +/-   ##
====================================
- Coverage    82%     82%   -1%     
====================================
  Files       199     202    +3     
  Lines      3910    3941   +31     
  Branches    443     444    +1     
====================================
+ Hits       3222    3239   +17     
- Misses      518     532   +14     
  Partials    170     170           
Flag Coverage Δ
unittests 82% <56%> (-1%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants