OCPP: allow phase key in Energy.Active.Import.Register (#19405)

This commit is contained in:
mfuchs1984 2025-03-04 14:51:13 +01:00 • committed by GitHub
parent f26786ca9d
commit 9a94d1625d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -321,6 +321,13 @@ func (conn *Connector) TotalEnergy() (float64, error) {
return scale(f, m.Unit) / 1e3, err
}
// fallback for missing total energy
for _, suffix := range []types.Measurand{"", "-N"} {
if res, found, err := conn.phaseMeasurements(types.MeasurandEnergyActiveImportRegister, suffix); found {
return res[0] + res[1] + res[2], err
}
}
return 0, api.ErrNotAvailable
}