Skip to content

Commit

Permalink
OCPP: allow phase key in Energy.Active.Import.Register (#19405)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfuchs1984 authored Mar 4, 2025
1 parent f26786c commit 9a94d16
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions charger/ocpp/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 9a94d16

Please sign in to comment.