Site: add returnEnergy to aggregated battery state (#33241)
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Michael Geers <michael@geers.tv>
This commit is contained in:
parent
8ccd72e141
commit
ea8e2a72c0
6 changed files with 27 additions and 11 deletions
|
|
@ -867,6 +867,12 @@ func (site *Site) updateBatteryMeters() {
|
|||
}
|
||||
return *m.Energy
|
||||
})
|
||||
site.battery.ReturnEnergy = lo.SumBy(mm, func(m types.Measurement) float64 {
|
||||
if m.ReturnEnergy == nil {
|
||||
return 0
|
||||
}
|
||||
return *m.ReturnEnergy
|
||||
})
|
||||
site.battery.Devices = mm
|
||||
|
||||
battery := site.battery
|
||||
|
|
|
|||
|
|
@ -56,10 +56,11 @@ func (m Measurement) GetTitle() string {
|
|||
}
|
||||
|
||||
type BatteryState struct {
|
||||
Power float64 `json:"power"`
|
||||
Energy float64 `json:"energy,omitempty"`
|
||||
Capacity float64 `json:"capacity,omitempty"`
|
||||
Soc float64 `json:"soc"`
|
||||
Devices []Measurement `json:"devices,omitempty" influxdb:"battery"`
|
||||
Forecast *BatteryForecast `json:"forecast,omitempty"`
|
||||
Power float64 `json:"power"`
|
||||
Energy float64 `json:"energy,omitempty"`
|
||||
ReturnEnergy float64 `json:"returnEnergy,omitempty"`
|
||||
Capacity float64 `json:"capacity,omitempty"`
|
||||
Soc float64 `json:"soc"`
|
||||
Devices []Measurement `json:"devices,omitempty" influxdb:"battery"`
|
||||
Forecast *BatteryForecast `json:"forecast,omitempty"`
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue