Commit Graph
4 Commits
Author SHA1 Message Date
Bobby NoelteandClaude Opus 5.5 f441759dfa fix(measurement): use quality-aware meter energy for load and PV
Additional fixes
Measurement.meter_energy_kwh converts meter energy over the whole period in one read; the 31-day and 10000-interval limits apply to the public energy queries only.
Load intervals a meter does not fully cover are NaN and the load adjustment skips them; load_total_kwh returns an empty array for an empty store and keeps full last intervals.
The load adjustment compares over the period the load meters report, skips a stale load meter period and says when no load meter is configured.
PV calibration, snow feedback and the load adjustment fall back without measurements when a conversion fails, logged as error once per failure streak and consumer.
Measurement.keys_first_datetime and keys_last_datetime find each meter's first and last valid reading in bounded scans, keep each meter's newest reading and return stamps in the configured zone.
Measurement.keys_common_period derives the common meter period for PV calibration and the load adjustment and names the meter that ends it, also when meters share no period.
PV calibration warns once per stale period when a stopped PV meter holds it on old data; snow feedback warns once about a stale feedback meter.
Lasting meter conditions (silent, reset, gap, replaced meter, no shared period) are warned once per condition and consumer through one helper and warned again when they recur.
A replaced meter whose readings touch the new one is reported; a single reading is not; a meter group waiting for its second reading is an info once.
The PV meter resolution is detected from valid readings only (pre-existing), using one shared valid-reading rule in energy.py.
Stale meter stamps are compared with compare_datetimes; new meter tests create durations with datetimeutil.
The unused legacy Measurement._energy_from_meter_readings is removed; its test scenarios cover meter_energy_kwh.
The converter's range error no longer mentions the API's 31-day limit, and its duplicate interval check is gone.
Measurement and prediction docs describe the meter coverage rule, even gap spreading and when the load forecast stays unadjusted.
Tests reset the warn-once state of the shared measurement store and restore the EMS start they change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Assisted-by: Claude Code (claude-opus-5-5)
2026-11-15 18:30:00 +01:00
Bobby NoelteandClaude Opus 5.5 2bfb6eafab fix(pvforecast): align the calibration window to the UTC slot grid
Additional fixes
PV meter energy comes from the quality-aware conversion.
Calibration rows are binned by interval start with end-stamped rows.
The fit covers only the period every PV meter covers and stays inside its lookback.
The meter resolution is judged only where every PV meter reports.
Snow feedback derives its window from the same slot window helper and shares one PV meter read per forecast with calibration.
Window bounds and pandas timestamps are converted in one place, always to UTC; fit days are counted in the configured zone.
Calibration tests write meters in bulk, stamp them in the configured zone and check every azimuth bin; snow feedback has its own slot window test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Assisted-by: Claude Code (claude-opus-5-5)
2026-11-15 18:30:00 +01:00
AndreasandAndreas 5a3a3bf07e style(pvforecast): apply CI import formatting 2026-09-17 13:53:54 +02:00
AndreasandAndreas 6529c39df4 feat(pvforecast): add calibrated local Akkudoktor backend
Port local PV modeling and outage calibration from feature commits f976335, 6dc58c3 and faed0fd by Andreas. Keep PVForecastAkkudoktor identity and remote default, adapt to async storage, and migrate legacy provider settings.
2026-09-17 13:53:54 +02:00