Fix vehicle name not displayed (#450)

This commit is contained in:
andig 2020-11-18 10:23:04 +01:00 • committed by GitHub
parent 69a009d686
commit bf5e02bbe9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -135,11 +135,6 @@ func NewLoadPointFromConfig(log *util.Logger, cp configProvider, other map[strin
lp.vehicles = append(lp.vehicles, vehicle)
}
// use first vehicle for estimator
if len(lp.vehicles) > 0 {
lp.setActiveVehicle(lp.vehicles[0])
}
if lp.ChargerRef == "" {
return nil, errors.New("missing charger")
}
@ -356,6 +351,12 @@ func (lp *LoadPoint) Prepare(uiChan chan<- util.Param, pushChan chan<- push.Even
lp.publish("socLevels", lp.SoC.Levels)
lp.Unlock()
// use first vehicle for estimator
// run during prepare() to ensure cache has been attached
if len(lp.vehicles) > 0 {
lp.setActiveVehicle(lp.vehicles[0])
}
// prepare charger status
lp.handler.Prepare()
}