MCPcopy Create free account
hub / github.com/evcc-io/evcc / finalizeSessionEnergy

Method finalizeSessionEnergy

core/loadpoint_session.go:134–156  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

132}
133
134func (lp *Loadpoint) finalizeSessionEnergy() {
135 s := lp.session
136 if lp.db == nil || s == nil || s.Created.IsZero() {
137 return
138 }
139
140 f, err := lp.chargeRater.ChargedEnergy()
141 if err != nil {
142 lp.log.ERROR.Printf("session energy: %v", err)
143 return
144 }
145
146 chargedKWh := f - lp.chargedAtStartup
147 if chargedKWh <= s.ChargedEnergy {
148 return
149 }
150
151 lp.log.DEBUG.Printf("session energy: %.3f -> %.3fkWh", s.ChargedEnergy, chargedKWh)
152
153 lp.energyMetrics.Update(chargedKWh)
154
155 lp.applyEnergyMetrics(s)
156}
157
158func (lp *Loadpoint) resetHeatingSession() {
159 if lp.session == nil || !lp.chargerHasFeature(api.Heating) || !lp.chargerHasFeature(api.IntegratedDevice) {

Callers 2

Calls 5

applyEnergyMetricsMethod · 0.95
PrintfMethod · 0.80
ChargedEnergyMethod · 0.65
UpdateMethod · 0.65
IsZeroMethod · 0.45

Tested by 1