From 3354cd472684303cca2e160fb09c1ac63063b58e Mon Sep 17 00:00:00 2001 From: andig Date: Tue, 24 Mar 2020 13:03:31 +0100 Subject: [PATCH] Fix initial charge power estimate zero when only PV meter installed --- core/loadpoint.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/core/loadpoint.go b/core/loadpoint.go index de03a59e7..656b0e8ab 100644 --- a/core/loadpoint.go +++ b/core/loadpoint.go @@ -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]) }