Skip to content

Commit

Permalink
Fix invalid time displayed without sending message
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Jan 24, 2021
1 parent 39f5bde commit b54aabb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion core/loadpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ func (lp *LoadPoint) evVehicleConnectHandler() {

// duration
lp.connectedTime = lp.clock.Now()
lp.publish("connectedDuration", 0)
lp.publish("connectedDuration", time.Duration(0))

// soc estimation reset
lp.socUpdated = time.Time{}
Expand Down Expand Up @@ -616,6 +616,12 @@ func (lp *LoadPoint) updateChargerStatus() error {
if prevStatus := lp.status; status != prevStatus {
lp.status = status

// changed from empty (initial startup) - set connected without sending message
if prevStatus == api.StatusNone {
lp.connectedTime = lp.clock.Now()
lp.publish("connectedDuration", time.Duration(0))
}

// changed from A - connected
if prevStatus == api.StatusA {
lp.bus.Publish(evVehicleConnect)
Expand Down

0 comments on commit b54aabb

Please sign in to comment.