From ac70eb1cba15e9f5988dded9c2bf87f5bd0b3292 Mon Sep 17 00:00:00 2001 From: andig Date: Thu, 8 Oct 2020 13:44:21 +0200 Subject: [PATCH] Always round battery soc; use trunc() to keep consistent with comparing to target value --- core/site.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/site.go b/core/site.go index fd19a051e..465fbf50d 100644 --- a/core/site.go +++ b/core/site.go @@ -3,6 +3,7 @@ package core import ( "errors" "fmt" + "math" "time" "github.com/andig/evcc/api" @@ -323,7 +324,7 @@ func (site *Site) sitePower() (float64, error) { site.log.ERROR.Printf("updating battery soc: %v", err) } else { site.log.DEBUG.Printf("battery soc: %.0f%%", soc) - site.publish("batterySoC", soc) + site.publish("batterySoC", math.Trunc(soc)) // if battery is charging give it priority if soc < site.PrioritySoC && batteryPower < 0 {