Skip to content

fix(control,prices): stop logging normal operation as warnings - #1443

Merged
frahlg merged 1 commit into
masterfrom
fix/quiet-normal-logs
Sep 26, 2026
Merged

frahlg merged 1 commit into
masterfrom
fix/quiet-normal-logs

Conversation

@frahlg

@frahlg frahlg commented Sep 26, 2026

Copy link
Copy Markdown
Member

Problem

The home box logged 3,022 warnings overnight (2026-09-25 18:00 → 2026-09-26 08:45):

  • 2,960 × 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.
  • 9 × 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

  • Meter clamp.
    • It logs at info when it engages and at debug on the following ticks.
    • A deferred update after the holdoff check records whether the tick clamped. Every tick that makes a decision therefore ends the episode, including the deadband early exit. Holdoff ticks do not.
  • Prices.
    • notPublishedYet(offset, now) logs a failed fetch of tomorrow before 13:05 Europe/Stockholm at debug.
    • Today's failures, and tomorrow's after publication, stay warnings.
    • dayAheadPublished is shared with the existing nextDayAheadCatch.

Evidence

  • TestMeterClampLogsWhenItEngages drives real ComputeDispatch ticks:

    1. Three clamp ticks log INFO, DEBUG, DEBUG.
    2. A tick with the grid on target clears the mark.
    3. The next clamp logs INFO again.

    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.

  • TestNotPublishedYet covers morning, just after midnight, after publication, winter in UTC and today.

  • go test ./internal/control ./internal/prices ./internal/api passes.

Overlap

The hunks here are elsewhere, so a rebase should be trivial.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MuerPFZFG88kgu8sWVHeq7

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
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-26T07:00:16.255563Z 36a9dcf PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +1648 to +1649
var meterClampActive bool
defer func() { state.meterClampLogged = meterClampActive }()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@frahlg
frahlg merged commit fdfa700 into master Sep 26, 2026
14 checks passed
@frahlg
frahlg deleted the fix/quiet-normal-logs branch September 26, 2026 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant