chore: debug solar production jump (#22888)

This commit is contained in:
andig 2025-08-10 17:01:32 +02:00 • committed by GitHub
parent 003573f076
commit eda1ced3aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View file

@ -590,11 +590,13 @@ func (site *Site) updatePvMeters() {
// use stored devices, not ui-updated instances!
name := dev.Config().Name
prev := site.pvEnergy[name].AccumulatedEnergy()
if mm[i].Energy > 0 {
site.pvEnergy[name].AddMeterTotal(mm[i].Energy)
} else {
site.pvEnergy[name].AddPower(mm[i].Power)
}
site.log.DEBUG.Printf("accumulated solar yield: %s moved from %.3f to %.3f", name, prev, site.pvEnergy[name].AccumulatedEnergy())
}
// store

View file

@ -149,12 +149,16 @@ func (site *Site) solarDetails(solar api.Rates) solarDetails {
}
// accumulate forecasted energy since last update
site.fcstEnergy.AddEnergy(solarEnergy(solar, site.fcstEnergy.updated, time.Now()) / 1e3)
energy := solarEnergy(solar, site.fcstEnergy.updated, time.Now()) / 1e3
site.log.DEBUG.Printf("solar forecast: accumulated %.3f from %v to %v", energy, site.fcstEnergy.updated, time.Now())
site.fcstEnergy.AddEnergy(energy)
settings.SetFloat(keys.SolarAccForecast, site.fcstEnergy.Accumulated)
produced := lo.SumBy(slices.Collect(maps.Values(site.pvEnergy)), func(v *meterEnergy) float64 {
return v.AccumulatedEnergy()
})
site.log.DEBUG.Printf("solar forecast: produced %.3f", produced)
if fcst := site.fcstEnergy.AccumulatedEnergy(); fcst > 0 {
scale := produced / fcst