feat: persist day curves in day_series for unlimited history - #115
Merged
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.
Closes #114
Qué hace
Guarda la curva de cada día (288 puntos de 5 min) en la tabla nueva
day_seriesde la BD propia de Helios, de modo que el histórico deje de depender de la
retención del recorder de HAOS (10 días por defecto). Los totales diarios ya
eran ilimitados (
dailydesde 2024); ahora las curvas también.Cambios
server/src/db.js: tabladay_series(date PK, points_json, estimated,source, updated_at) +
upsertDaySeries/getDaySeriesRow/daySeriesDates.server/src/solar.js:getDaySeriessirve días pasados desdeday_seriessi hay fila, ypersiste la curva de HOY en cada cómputo → ilimitado.
buildDaySeries(stats, dateStr, db)extrae el cómputo de lacurva (reutilizable para live y backup).
backfillDaySeries(ha, db, backupFilePath): backfill idempotente querellena desde HAOS vivo (ventana ~15 días) y desde un backup opcional de
HAOS (JSON de
statistics_during_period).server/src/index.js: backfill de curvas al conectar y en la consolidaciónnocturna.
server/test/backfill.test.js: 2 tests nuevos (backup → day_series,persistencia servida sin tocar HAOS). 105 tests OK.
CHANGELOG.md: entrada en Unreleased.Backfill aplicado en el CT 226
home-assistant_v2_prebackfill_20260728.db→
estimated=1(solis_potencia_actual no existía antes del 13-Ago; Solisestimado por heurístico, fox/consumo reales).
estimated=0./api/solar/day?date=2026-07-20devuelve 288 puntos(antes 0); heurístico exacto (solis 16.90 kWh estimado vs 16.9 real).