Fix reading MaxGridSupplyWhileBatteryCharging from evcc.yaml (#14332)

This commit is contained in:
Michael Geers 2024-06-13 13:17:20 +02:00 • committed by GitHub
parent fc7c9240ba
commit 1819abf636
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 11 deletions

View file

@ -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())

View file

@ -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