Skip to content

Commit

Permalink
Fix crash when on a fixed rate tariff
Browse files Browse the repository at this point in the history
If there are no charge windows then don't optimise any
  • Loading branch information
springfall2008 authored Jun 7, 2023
1 parent 66a7ebc commit 6d97cd1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion apps/predbat/predbat.py
Original file line number Diff line number Diff line change
Expand Up @@ -2297,7 +2297,7 @@ def update_pred(self):
metric, self.charge_limit_percent, import_kwh_battery, import_kwh_house, export_kwh, soc_min, soc, soc_min_minute = self.run_prediction(self.charge_limit, self.charge_window, self.discharge_window, self.discharge_limits, load_minutes, pv_forecast_minute, save='base', end_record=end_record)

# Try different battery SOCs to get the best result
if self.get_arg('calculate_best', False):
if self.get_arg('calculate_best', False) and self.charge_window_best:
record_charge_windows = max(self.max_charge_windows(end_record + self.minutes_now, self.charge_window_best), 1)
self.log("Record charge windows is {} end_record_abs was {}".format(record_charge_windows, self.time_abs_str(end_record + self.minutes_now)))

Expand Down

0 comments on commit 6d97cd1

Please sign in to comment.