Fix charger wrongly enabled on startup when vehicle connected and minsoc defined (#402)
This commit is contained in:
parent
ed12988a64
commit
485e9ee706
2 changed files with 9 additions and 5 deletions
|
|
@ -455,7 +455,7 @@ func (lp *LoadPoint) findActiveVehicle() {
|
|||
}
|
||||
}
|
||||
|
||||
// updateChargerStatus updates car status and detects car connected/disconnected events
|
||||
// updateChargerStatus updates charger status and detects car connected/disconnected events
|
||||
func (lp *LoadPoint) updateChargerStatus() error {
|
||||
status, err := lp.handler.Status()
|
||||
if err != nil {
|
||||
|
|
@ -705,10 +705,6 @@ func (lp *LoadPoint) Update(sitePower float64) {
|
|||
// update progress and soc before status is updated
|
||||
lp.publishChargeProgress()
|
||||
|
||||
// update active vehicle and publish soc
|
||||
lp.findActiveVehicle()
|
||||
lp.publishSoC()
|
||||
|
||||
// read and publish status
|
||||
if err := lp.updateChargerStatus(); err != nil {
|
||||
lp.log.ERROR.Printf("charge controller error: %v", err)
|
||||
|
|
@ -718,6 +714,12 @@ func (lp *LoadPoint) Update(sitePower float64) {
|
|||
lp.publish("connected", lp.connected())
|
||||
lp.publish("charging", lp.charging)
|
||||
|
||||
// update active vehicle and publish soc
|
||||
// must be run after updating charger status to make sure
|
||||
// initial update of connected state matches charger status
|
||||
lp.findActiveVehicle()
|
||||
lp.publishSoC()
|
||||
|
||||
// sync settings with charger
|
||||
if lp.status != api.StatusA {
|
||||
lp.handler.SyncEnabled()
|
||||
|
|
|
|||
|
|
@ -196,6 +196,8 @@ func (site *Site) DumpConfig() {
|
|||
lp.log.INFO.Println(" charger config:")
|
||||
logMeter(lp.log, charger)
|
||||
lp.log.INFO.Printf(" timer %s", presence[timer])
|
||||
|
||||
lp.log.INFO.Printf(" mode: %s", lp.GetMode())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue