|
21 | 21 | from html import escape as escape_html |
22 | 22 | from datetime import timedelta |
23 | 23 | from predbat import THIS_VERSION_DISPLAY |
24 | | -from const import TIME_FORMAT, PREDICT_STEP, EXPORT_LIMIT_IDLE, MINUTE_WATT, FULL_EXPORT_POWER, EXPORT_MODE_TARGET, EXPORT_MODE_FREEZE, EXPORT_MODE_IDLE, CHARGE_STATE_PRECEDENCE, EXPORT_STATE_PRECEDENCE |
| 24 | +from const import TIME_FORMAT, PREDICT_STEP, RUN_EVERY, EXPORT_LIMIT_IDLE, MINUTE_WATT, FULL_EXPORT_POWER, EXPORT_MODE_TARGET, EXPORT_MODE_FREEZE, EXPORT_MODE_IDLE, CHARGE_STATE_PRECEDENCE, EXPORT_STATE_PRECEDENCE |
25 | 25 | from utils import dp0, dp1, dp2, dp3, calc_percent_limit, minute_data, minute_data_state, find_charge_rate, export_mode_of, export_target_of, export_power_of, export_limit_sort_key, pack_export_limit, export_limit_from_stored |
26 | 26 | from prediction import Prediction |
27 | 27 |
|
@@ -3189,18 +3189,18 @@ def plan_row_holding_for_car(self, minute_start, minute_end, car_hold_minutes=No |
3189 | 3189 | def history_slot(self, when): |
3190 | 3190 | """Which plan slot the plan history rebuild at when counts towards, as (date, slot number from midnight). |
3191 | 3191 |
|
3192 | | - Slots are plan_interval_minutes long, shifted one run (PREDICT_STEP) later: the run at a slot boundary |
| 3192 | + Slots are plan_interval_minutes long, shifted one run (RUN_EVERY) later: the run at a slot boundary |
3193 | 3193 | writes predbat.cost_today seconds before calculate_yesterday() reads its history back from Home |
3194 | 3194 | Assistant, so the slot just finished is rebuilt on the next run, once that value is recorded. This only |
3195 | 3195 | helps when that next run re-plans; with calculate_plan_every at or above the slot length, re-plans can |
3196 | 3196 | fall on boundaries and the rebuild then happens there. |
3197 | 3197 | """ |
3198 | | - when = when - timedelta(minutes=PREDICT_STEP) |
| 3198 | + when = when - timedelta(minutes=RUN_EVERY) |
3199 | 3199 | return when.date(), (when.hour * 60 + when.minute) // self.plan_interval_minutes |
3200 | 3200 |
|
3201 | 3201 | def history_refresh_minutes(self): |
3202 | 3202 | """The longest the plan history should go between rebuilds: a slot, the run it waits, and up to one re-plan interval.""" |
3203 | | - return self.plan_interval_minutes + PREDICT_STEP + self.calculate_plan_every |
| 3203 | + return self.plan_interval_minutes + RUN_EVERY + self.calculate_plan_every |
3204 | 3204 |
|
3205 | 3205 | def calculate_yesterday(self): |
3206 | 3206 | """ |
|
0 commit comments