Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix applying phase configuration at startup #3762

Merged
merged 1 commit into from
Jul 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions core/loadpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,15 @@ func NewLoadPointFromConfig(log *util.Logger, cp configProvider, other map[strin
lp.charger = cp.Charger(lp.ChargerRef)
lp.configureChargerType(lp.charger)

// setup fixed phases
if _, ok := lp.charger.(api.ChargePhases); ok && lp.GetPhases() != 0 {
lp.log.WARN.Printf("locking phase config to %dp for switchable charger", lp.GetPhases())
// set to unknown since we don't know the charger's setting yet and don't want to interrupt charging
lp.setPhases(0)
// setup fixed phases:
// - simple charger starts with phases config if specified
// - switchable charger starts at 0p since we don't know the current setting
if _, ok := lp.charger.(api.ChargePhases); !ok {
if lp.DefaultPhases != 0 {
lp.phases = lp.DefaultPhases
}
} else if lp.DefaultPhases != 0 {
lp.log.WARN.Printf("locking phase config to %dp for switchable charger", lp.DefaultPhases)
}

// allow target charge handler to access loadpoint
Expand Down