Loadpoint: reset energy metrics when creating session (#22126)
This commit is contained in:
parent
01ae739413
commit
57f59ca703
2 changed files with 6 additions and 5 deletions
|
|
@ -473,11 +473,6 @@ func (lp *Loadpoint) evChargeStopHandler() {
|
|||
func (lp *Loadpoint) evVehicleConnectHandler() {
|
||||
lp.log.INFO.Printf("car connected")
|
||||
|
||||
// energy
|
||||
lp.energyMetrics.Reset()
|
||||
lp.energyMetrics.Publish("session", lp)
|
||||
lp.publish(keys.ChargedEnergy, lp.GetChargedEnergy())
|
||||
|
||||
// duration
|
||||
lp.connectedTime = lp.clock.Now()
|
||||
lp.publish(keys.ConnectedDuration, time.Duration(0))
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package core
|
|||
|
||||
import (
|
||||
"github.com/evcc-io/evcc/api"
|
||||
"github.com/evcc-io/evcc/core/keys"
|
||||
"github.com/evcc-io/evcc/core/session"
|
||||
"github.com/jinzhu/now"
|
||||
"github.com/samber/lo"
|
||||
|
|
@ -45,6 +46,11 @@ func (lp *Loadpoint) createSession() {
|
|||
lp.session.Identifier = id
|
||||
}
|
||||
}
|
||||
|
||||
// energy
|
||||
lp.energyMetrics.Reset()
|
||||
lp.energyMetrics.Publish("session", lp)
|
||||
lp.publish(keys.ChargedEnergy, lp.GetChargedEnergy())
|
||||
}
|
||||
|
||||
// stopSession ends a charging session segment and persists the session.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue