Site: don't modify battery mode unless battery configured (#17027)
This commit is contained in:
parent
0c343c1c0b
commit
956381bd4e
1 changed files with 6 additions and 0 deletions
|
|
@ -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()
|
||||
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue