Skip to content

Commit

Permalink
Site: don't modify battery mode unless battery configured (evcc-io#17027
Browse files Browse the repository at this point in the history
)
  • Loading branch information
andig authored Nov 1, 2024
1 parent 0c343c1 commit 956381b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/site_battery.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ func batteryModeModified(mode api.BatteryMode) bool {
return mode != api.BatteryUnknown && mode != api.BatteryNormal
}

func (site *Site) batteryConfigured() bool {
return len(site.batteryMeters) > 0
}

// GetBatteryMode returns the battery mode
func (site *Site) GetBatteryMode() api.BatteryMode {
site.RLock()
Expand Down Expand Up @@ -47,6 +51,8 @@ func (site *Site) requiredBatteryMode(batteryGridChargeActive bool, rate api.Rat
}

switch {
case !site.batteryConfigured():
res = api.BatteryUnknown
case batteryGridChargeActive:
res = mapper(api.BatteryCharge)
case site.dischargeControlActive(rate):
Expand Down

0 comments on commit 956381b

Please sign in to comment.