From 1819abf636fad207fe8dccbd32ced83967c66be7 Mon Sep 17 00:00:00 2001 From: Michael Geers Date: Thu, 13 Jun 2024 13:17:20 +0200 Subject: [PATCH] Fix reading MaxGridSupplyWhileBatteryCharging from evcc.yaml (#14332) --- core/site.go | 11 +++++------ core/site_api.go | 10 +++++----- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/core/site.go b/core/site.go index e2db3d76e..f382a186b 100644 --- a/core/site.go +++ b/core/site.go @@ -81,11 +81,10 @@ type Site struct { auxMeters []api.Meter // Auxiliary meters // battery settings - prioritySoc float64 // prefer battery up to this Soc - bufferSoc float64 // continue charging on battery above this Soc - bufferStartSoc float64 // start charging on battery above this Soc - maxGridSupplyWhileBatteryCharging float64 // ignore battery charging if AC consumption is above this value - batteryDischargeControl bool // prevent battery discharge for fast and planned charging + prioritySoc float64 // prefer battery up to this Soc + bufferSoc float64 // continue charging on battery above this Soc + bufferStartSoc float64 // start charging on battery above this Soc + batteryDischargeControl bool // prevent battery discharge for fast and planned charging loadpoints []*Loadpoint // Loadpoints tariffs *tariff.Tariffs // Tariffs @@ -851,7 +850,7 @@ func (site *Site) prepare() { site.publish(keys.PrioritySoc, site.prioritySoc) site.publish(keys.BufferSoc, site.bufferSoc) site.publish(keys.BufferStartSoc, site.bufferStartSoc) - site.publish(keys.MaxGridSupplyWhileBatteryCharging, site.maxGridSupplyWhileBatteryCharging) + site.publish(keys.MaxGridSupplyWhileBatteryCharging, site.MaxGridSupplyWhileBatteryCharging) site.publish(keys.BatteryMode, site.batteryMode) site.publish(keys.BatteryDischargeControl, site.batteryDischargeControl) site.publish(keys.ResidualPower, site.GetResidualPower()) diff --git a/core/site_api.go b/core/site_api.go index db8c93efa..757b7017b 100644 --- a/core/site_api.go +++ b/core/site_api.go @@ -246,7 +246,7 @@ func (site *Site) SetBufferStartSoc(soc float64) error { func (site *Site) GetMaxGridSupplyWhileBatteryCharging() float64 { site.RLock() defer site.RUnlock() - return site.maxGridSupplyWhileBatteryCharging + return site.MaxGridSupplyWhileBatteryCharging } func (site *Site) SetMaxGridSupplyWhileBatteryCharging(power float64) error { @@ -259,10 +259,10 @@ func (site *Site) SetMaxGridSupplyWhileBatteryCharging(power float64) error { site.log.DEBUG.Println("set max grid supply while battery charging:", power) - if site.maxGridSupplyWhileBatteryCharging != power { - site.maxGridSupplyWhileBatteryCharging = power - settings.SetFloat(keys.MaxGridSupplyWhileBatteryCharging, site.maxGridSupplyWhileBatteryCharging) - site.publish(keys.MaxGridSupplyWhileBatteryCharging, site.maxGridSupplyWhileBatteryCharging) + if site.MaxGridSupplyWhileBatteryCharging != power { + site.MaxGridSupplyWhileBatteryCharging = power + settings.SetFloat(keys.MaxGridSupplyWhileBatteryCharging, site.MaxGridSupplyWhileBatteryCharging) + site.publish(keys.MaxGridSupplyWhileBatteryCharging, site.MaxGridSupplyWhileBatteryCharging) } return nil