Loadpoint: fix active phases not initialised (#11962)
This commit is contained in:
parent
02276c27ae
commit
9ebdfc331e
2 changed files with 13 additions and 0 deletions
|
|
@ -7,6 +7,7 @@ import (
|
|||
"reflect"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
evbus "github.com/asaskevich/EventBus"
|
||||
|
|
@ -234,6 +235,7 @@ func NewLoadpointFromConfig(log *util.Logger, settings *Settings, other map[stri
|
|||
// phase switching defaults based on charger capabilities
|
||||
if !lp.hasPhaseSwitching() {
|
||||
lp.configuredPhases = 3
|
||||
lp.phases = 3
|
||||
}
|
||||
|
||||
// TODO deprecated
|
||||
|
|
@ -305,11 +307,15 @@ func NewLoadpoint(log *util.Logger, settings *Settings) *Loadpoint {
|
|||
|
||||
// restoreSettings restores loadpoint settings
|
||||
func (lp *Loadpoint) restoreSettings() {
|
||||
if testing.Testing() {
|
||||
return
|
||||
}
|
||||
if v, err := lp.settings.String(keys.Mode); err == nil && v != "" {
|
||||
lp.setMode(api.ChargeMode(v))
|
||||
}
|
||||
if v, err := lp.settings.Int(keys.PhasesConfigured); err == nil && (v > 0 || lp.hasPhaseSwitching()) {
|
||||
lp.setConfiguredPhases(int(v))
|
||||
lp.phases = lp.configuredPhases
|
||||
}
|
||||
if v, err := lp.settings.Float(keys.MinCurrent); err == nil && v > 0 {
|
||||
lp.setMinCurrent(v)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue