@@ -324,7 +324,7 @@ func (lp *LoadPoint) maxCurrent(mode api.ChargeMode, sitePower float64) int64 {
324
324
if mode == api .ModePV && enabled && targetCurrent < lp .MinCurrent {
325
325
// kick off disable sequence
326
326
if sitePower >= lp .Disable .Threshold {
327
- lp .log .DEBUG .Printf ("site power %.0f >= disable threshold %.0f " , sitePower , lp .Disable .Threshold )
327
+ lp .log .DEBUG .Printf ("site power %.0fW >= disable threshold %.0fW " , sitePower , lp .Disable .Threshold )
328
328
329
329
if lp .pvTimer .IsZero () {
330
330
lp .log .DEBUG .Println ("start pv disable timer" )
@@ -347,7 +347,7 @@ func (lp *LoadPoint) maxCurrent(mode api.ChargeMode, sitePower float64) int64 {
347
347
// kick off enable sequence
348
348
if targetCurrent >= lp .MinCurrent ||
349
349
(lp .Enable .Threshold != 0 && sitePower <= lp .Enable .Threshold ) {
350
- lp .log .DEBUG .Printf ("site power %.0f < enable threshold %.0f " , sitePower , lp .Enable .Threshold )
350
+ lp .log .DEBUG .Printf ("site power %.0fW < enable threshold %.0fW " , sitePower , lp .Enable .Threshold )
351
351
352
352
if lp .pvTimer .IsZero () {
353
353
lp .log .DEBUG .Println ("start pv enable timer" )
@@ -401,7 +401,7 @@ func (lp *LoadPoint) chargeDuration() time.Duration {
401
401
lp .log .ERROR .Printf ("charge timer error: %v" , err )
402
402
return 0
403
403
}
404
- return d
404
+ return d . Round ( time . Second )
405
405
}
406
406
407
407
// chargedEnergy returns energy consumption since charge start in kWh
@@ -428,7 +428,7 @@ func (lp *LoadPoint) remainingChargeDuration(chargePercent float64) time.Duratio
428
428
429
429
if lp .chargePower > 0 && lp .vehicle != nil {
430
430
whRemaining := (1 - chargePercent / 100.0 ) * 1e3 * float64 (lp .vehicle .Capacity ())
431
- return time .Duration (float64 (time .Hour ) * whRemaining / lp .chargePower )
431
+ return time .Duration (float64 (time .Hour ) * whRemaining / lp .chargePower ). Round ( time . Second )
432
432
}
433
433
434
434
return - 1
0 commit comments