Skip to content

Commit a3e8c9a

Browse files
Fix bug in charging window setting that caused crash, extend rate charge out by 24 hours
1 parent 9f43709 commit a3e8c9a

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

predbat.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ def rate_replicate(self, rates):
525525
"""
526526
minute = 0
527527
# Add 12 extra hours to make sure charging period will end
528-
while minute < (self.forecast_minutes + 12*60):
528+
while minute < (self.forecast_minutes + 24*60):
529529
if minute not in rates:
530530
minute_mod = minute % (24*60)
531531
if minute_mod in rates:
@@ -726,7 +726,7 @@ def publish_rates(self, rates, export):
726726
Create rates/time every 30 minutes
727727
"""
728728
rates_time = {}
729-
for minute in range(0, self.forecast_minutes, 30):
729+
for minute in range(0, self.forecast_minutes+24*60, 30):
730730
minute_timestamp = self.midnight_utc + timedelta(minutes=minute)
731731
stamp = minute_timestamp.strftime(TIME_FORMAT)
732732
rates_time[stamp] = rates[minute]
@@ -1138,7 +1138,7 @@ def update_pred(self):
11381138

11391139
# We must re-program if we are about to start a new charge window
11401140
# or the currently configured window is about to start but hasn't yet started (don't change once it's started)
1141-
if (self.minutes_now >= self.charge_start_time_minutes) and (self.minutes_now < self.charge_end_time_times):
1141+
if (self.minutes_now >= self.charge_start_time_minutes) and (self.minutes_now < self.charge_end_time_minutes):
11421142
self.log("Currently in a charge window, don't change it")
11431143
elif (self.minutes_now < window['end']) and (
11441144
(window['start'] - self.minutes_now) <= self.set_window_minutes or

0 commit comments

Comments
 (0)