Skip to content

Commit 31a493d

Browse files
fix(fetch): reword days_previous_auto log to not imply it ran this cycle
Raised alongside the #4496 follow-up investigation: the "days_previous_auto enabled - using weighted-bucket historical load forecast..." log line fires unconditionally every cycle purely because days_previous_auto defaults to True, regardless of whether the weighted-bucket forecast is actually used that cycle. Load ML (or any source that sets load_forecast_only) takes precedence and skips it entirely - fetch_sensor_data() already has its own, correctly conditional "Using weighted-bucket historical load forecast over N days" line that only logs when the fallback genuinely runs. Reworded to describe what's enabled/configured, not what happened, so a Load ML user reading the log isn't misled into thinking both forecast sources are being blended every cycle when they aren't - confirmed via code trace, not just the log wording, that no double-application actually occurs.
1 parent 643868f commit 31a493d

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

apps/predbat/fetch.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2366,7 +2366,16 @@ def fetch_config_options(self):
23662366
self.load_forecast_history = self.get_arg("days_previous_auto", True)
23672367
if self.load_forecast_history:
23682368
window_days = min(max(self.days_previous) if self.days_previous else 7, LOAD_FORECAST_HISTORY_MAX_DAYS)
2369-
self.log("days_previous_auto enabled - using weighted-bucket historical load forecast over up to {} days".format(window_days))
2369+
# Config-time log only - describes what's enabled, not what happened this cycle. This
2370+
# runs unconditionally every cycle regardless of whether the weighted-bucket forecast
2371+
# actually gets used: Load ML (or any other source that sets load_forecast_only) takes
2372+
# precedence and skips it entirely (fetch_sensor_data(), guarded by
2373+
# "not self.load_forecast_only"). The "using weighted-bucket..." wording previously
2374+
# here read as if it was happening every cycle regardless, which is what actually gets
2375+
# logged only when the forecast is genuinely used (fetch_sensor_data()'s own "Using
2376+
# weighted-bucket historical load forecast over N days" line) - confusing on a Load ML
2377+
# setup where this fallback is rarely/never actually invoked (#4496 follow-up).
2378+
self.log("days_previous_auto enabled - will fall back to a weighted-bucket historical load forecast over up to {} days if no other load forecast source takes precedence".format(window_days))
23702379
self.max_days_previous = window_days + 1
23712380
elif self.holiday_days_left > 0:
23722381
self.days_previous = [1]

0 commit comments

Comments
 (0)