Skip to content

Commit

Permalink
chore: add more session logging
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed May 7, 2024
1 parent 81ba7dc commit 8ba04a6
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions core/loadpoint_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ func (lp *Loadpoint) stopSession() {
}

if chargedEnergy := lp.getChargedEnergy() / 1e3; chargedEnergy > s.ChargedEnergy {
{ // TODO remove
lp.log.DEBUG.Printf("session: chargedEnergy=%.1f", s.ChargedEnergy)
}
lp.sessionEnergy.Update(chargedEnergy)
}

Expand All @@ -74,6 +77,17 @@ func (lp *Loadpoint) stopSession() {
s.ChargedEnergy = lp.sessionEnergy.TotalWh() / 1e3
s.ChargeDuration = &lp.chargeDuration

{ // TODO remove
var meterStart, meterStop float64
if s.MeterStart != nil {
meterStart = *s.MeterStart
}
if s.MeterStop != nil {
meterStop = *s.MeterStop
}
lp.log.DEBUG.Printf("session: start=%.3f stop=%.3f chargedEnergy=%.3f", meterStart, meterStop, s.ChargedEnergy)
}

lp.db.Persist(s)
}

Expand Down

0 comments on commit 8ba04a6

Please sign in to comment.