fix(control,prices): stop logging normal operation as warnings - #1443
Conversation
A night on the home box logged 3,022 warnings, of which 2,960 were "dispatch: meter clamp reduced battery target" and 9 were Nord Pool's 204 for tomorrow before 13:00. Both are normal operation, and they buried the one warning that mattered (the Easee cloud outage). - The meter clamp logs at info when it engages and at debug while it stays engaged. A dispatch tick past the holdoff that does not clamp ends the episode (deferred, so every exit after the holdoff counts, including the deadband exit); holdoff ticks do not. - A failed fetch of tomorrow's prices before 13:05 Europe/Stockholm logs at debug. dayAheadPublished is shared with nextDayAheadCatch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MuerPFZFG88kgu8sWVHeq7
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 36a9dcf36f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| slog.Warn("price fetch failed", "zone", s.Zone, "day", day.Format("2006-01-02"), "err", err) | ||
| // Tomorrow's day-ahead is not published before about 13:00, so | ||
| // asking earlier is expected to find nothing. | ||
| if notPublishedYet(offset, now) { |
There was a problem hiding this comment.
Classify the requested price date instead of its loop offset
On hosts whose local timezone differs from Europe/Stockholm, offset == 1 does not always mean the requested calendar date is Stockholm's tomorrow. For example, at 22:30 UTC in summer the offset-1 request formats as Stockholm's current date, but this condition downgrades a real same-day fetch failure to debug until UTC midnight; conversely, a Finnish host just after midnight can warn for an expected unpublished later date. Pass and compare the actual requested day so current-price failures remain visible.
AGENTS.md reference: AGENTS.md:L20-L23
Useful? React with 👍 / 👎.
| var meterClampActive bool | ||
| defer func() { state.meterClampLogged = meterClampActive }() |
There was a problem hiding this comment.
Reset clamp logging across idle and charge ticks
When a clamp tick is followed by any time in ModeIdle or ModeCharge, those modes return above this defer and leave meterClampLogged true. If the operator later switches back and the clamp engages again, its first event is logged only at debug—and is therefore absent from the production INFO logger—even though the previous clamp episode ended during the intervening mode. Install the reset before these short-circuit returns or clear it as part of the mode transition.
Useful? React with 👍 / 👎.
Problem
The home box logged 3,022 warnings overnight (2026-09-25 18:00 → 2026-09-26 08:45):
dispatch: meter clamp reduced battery target. This is normal self-consumption: the plan asks for more discharge than the house needs, and the clamp holds the grid at its target instead of exporting. For example, at 02:00 the plan asked for −729 W and the clamp set −433 W with the grid at +855 W.price fetch failed … nordpool: status 204, hourly from 00:40 to 08:40. Tomorrow's day-ahead is not published until about 13:00.The one warning that mattered, the Easee cloud going offline from 07:51 to 08:07, was buried among them. The support report's "repeating warning" finding also latches onto the clamp.
Change
notPublishedYet(offset, now)logs a failed fetch of tomorrow before 13:05 Europe/Stockholm at debug.dayAheadPublishedis shared with the existingnextDayAheadCatch.Evidence
TestMeterClampLogsWhenItEngagesdrives realComputeDispatchticks:The first version of the fix set the mark at the end of the function, and the test caught that the deadband exit skipped it.
TestNotPublishedYetcovers morning, just after midnight, after publication, winter in UTC and today.go test ./internal/control ./internal/prices ./internal/apipasses.Overlap
dispatch.goin theStatestruct near line 629 and in PV curtailment.prices.goinFromConfig.The hunks here are elsewhere, so a rebase should be trivial.
🤖 Generated with Claude Code
https://claude.ai/code/session_01MuerPFZFG88kgu8sWVHeq7