Make targetSoC configurable

This commit is contained in:
andig 2020-08-06 18:19:53 +02:00
parent 2266f43074
commit ef2cc9a94b
2 changed files with 11 additions and 5 deletions

View file

@ -1,6 +1,7 @@
package core
import (
"sort"
"sync"
"time"
@ -96,9 +97,13 @@ func NewLoadPointFromConfig(log *util.Logger, cp configProvider, other map[strin
lp.Mode = api.ChargeModeString(string(lp.Mode))
lp.OnDisconnect.Mode = api.ChargeModeString(string(lp.OnDisconnect.Mode))
lp.TargetSoC = 100
if len(lp.SoC.Levels) > 0 {
lp.TargetSoC = lp.SoC.Levels[len(lp.SoC.Levels)-1]
sort.Ints(lp.SoC.Levels)
if lp.TargetSoC == 0 {
lp.TargetSoC = 100
if len(lp.SoC.Levels) > 0 {
lp.TargetSoC = lp.SoC.Levels[len(lp.SoC.Levels)-1]
}
}
if lp.Meters.ChargeMeterRef != "" {

View file

@ -238,6 +238,7 @@ loadpoints:
charge: charge # charge meter
vehicle: audi
mode: pv
targetSoC: 100 # charge to 100%
soc:
alwaysUpdate: false # set true to update vehicle soc even when disconnected
levels: # target soc levels for UI
@ -245,9 +246,9 @@ loadpoints:
- 50
- 80
- 100
onDisconnect:
onDisconnect: # set defaults when vehicle disconnects
mode: pv # switch back to pv mode
targetSoC: 100 # charge fully
targetSoC: 100 # charge to 100%
phases: 3 # ev phases (default 3)
sensitivity: 1 # current raise/lower step size (default 10A)
enable: # pv mode enable behavior