Fix initial charge power estimate zero when only PV meter installed

This commit is contained in:
andig 2020-03-24 13:03:31 +01:00
parent fb04aa98da
commit 3354cd4726

View file

@ -214,6 +214,7 @@ func (lp *LoadPoint) Prepare(uiChan chan<- Param, notificationChan chan<- push.E
if err = lp.setTargetCurrent(lp.MinCurrent); err != nil {
log.ERROR.Println(err)
}
lp.bus.Publish(evChargeCurrent, lp.MinCurrent)
}
// connected returns the EVs connection state
@ -238,11 +239,8 @@ func (lp *LoadPoint) chargerEnable(enable bool) error {
log.INFO.Printf("%s charger %s", lp.Name, status[enable])
lp.guardUpdated = time.Now()
if enable {
lp.bus.Publish(evChargeCurrent, lp.MinCurrent)
} else {
lp.bus.Publish(evChargeCurrent, int64(0))
}
// if not enabled, current will be reduced to 0 in handler
lp.bus.Publish(evChargeCurrent, lp.MinCurrent)
} else {
log.DEBUG.Printf("%s charger %s", lp.Name, status[enable])
}