Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/TWCManager/TWCMaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down