Repository navigation
feat(alerts): send daily summary at sunset instead of fixed hour - #8
Merged
Merged
Conversation
Schedule the daily production summary at sunset (sun.sun next_setting + 10 min offset to let the last production interval settle) instead of a fixed 21:00. Falls back to 21:00 fixed when solar data is unavailable (HAOS down) or today's sunset already passed, so no day is ever skipped or double-sent. Stop promising a fixed hour in the user-facing label. Closes #6
gnacho
force-pushed
the
feat/helios-sunset-summary
branch
from
August 8, 2026 20:11
c301dd2 to
0c39760
Compare
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.
Closes #6.
What
The daily production summary is now scheduled at sunset + 10 min (from
sun.sunnext_setting) instead of a fixed 21:00, so it lands right when the production day ends — year-round, not just in summer when 21:00 happens to approximate dusk.How
proximoEnvioResumen(ha, ahora)returns the next fire time:sun.sun.next_setting + RESUMEN_OFFSET_MINwhen solar data is available (always the next sunset, today or tomorrow), falling back to the existing fixed hourHORA_RESUMEN_DIARIO(21:00) only when HAOS is down and there's no sunset data.ejecutarResumenSiTocaadds a same-day guard persisted in kv (resumen_ultimo_envio, survives restarts) so the summary is never sent twice on the same calendar day. This is required because the fallback (21:00) and the sunset path can both fall on the same day (summer: fallback before sunset; winter: sunset before fallback); without the guard the fallback would preempt sunset in steady state.scheduleResumenDiarioretries briefly (30 s) ifsun.sunisn't cached yet at boot — thesubscribe_entitiesack arrives before the state dump, so without this the first scheduling after every restart would incorrectly commit to the fallback. Falls back to the fixed hour only if sunset data genuinely never arrives (HAOS down all day).ajustes.notif.tipos.resumen_diario): "Resumen diario al anochecer" / "Daily summary at sunset" / "每日总结(日落时)".Verification
alerts.jsmd5 local == CT; front bundle hash local == CT == HTTPS. Service active, NRestarts 0, HAOS connected,/healthok.resumen diario programado para <sunset-tomorrow + 10min>.Notes
RESUMEN_OFFSET_MIN(10 min) lets the last production interval of the day settle before the KPIs are read. It's an exported constant; making it user-configurable is left for a follow-up if needed.kvstore.