diff --git a/core/site.go b/core/site.go index 2f7d90dd1..deec3d416 100644 --- a/core/site.go +++ b/core/site.go @@ -549,7 +549,7 @@ func (site *Site) updateBatteryMeters() { mm[i].Controllable = lo.ToPtr(controllable) } - site.batterySoc = lo.SumBy(mm, func(m measurement) float64 { + batterySocAcc := lo.SumBy(mm, func(m measurement) float64 { // weigh soc by capacity if *m.Capacity > 0 { return *m.Soc * *m.Capacity @@ -564,7 +564,7 @@ func (site *Site) updateBatteryMeters() { if totalCapacity == 0 { totalCapacity = float64(len(site.batteryMeters)) } - site.batterySoc /= totalCapacity + site.batterySoc = batterySocAcc / totalCapacity site.batteryPower = lo.SumBy(mm, func(m measurement) float64 { return m.Power