diff --git a/lib/TWCManager/TWCMaster.py b/lib/TWCManager/TWCMaster.py index 056c6189..317d8346 100644 --- a/lib/TWCManager/TWCMaster.py +++ b/lib/TWCManager/TWCMaster.py @@ -293,6 +293,10 @@ def getScheduledAmpsTimeFlex(self): slave = next(iter(self.slaveTWCs.values())) vehicle = slave.getLastVehicle() if vehicle != None: + # we update current SOC - but only when charging + if slave.isCharging==1: + self.queue_background_task({"cmd": "checkCharge"}) + amps = self.getScheduledAmpsMax() watts = self.convertAmpsToWatts(amps) * self.getRealPowerFactor(amps) hoursForFullCharge = self.getScheduledAmpsBatterySize() / (watts / 1000) @@ -308,6 +312,9 @@ def getScheduledAmpsTimeFlex(self): # adding half an hour if battery should be charged over 98% if vehicle.chargeLimit >= 98: startHour -= 0.5 + # As soon we start charge, we set start charging another quarter of an hour back - so it won't start and stop charging the whole time + if slave.isCharging==1: + startHour -= 0.25 if startHour < 0: startHour = startHour + 24 # if startHour is smaller than the intial startHour, then it should begin beginn charging a day later