Repository navigation
feat(state): the energy ledger keeps hourly totals for four years - #1951
Merged
Merged
Conversation
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. |
frahlg
added a commit
to srcfl/ftw-app
that referenced
this pull request
Nov 2, 2026
srcfl/ftw#1951 keeps the ledger's hourly totals for four years, so the refund's note now says the box keeps them for the three years an owner can apply, as the box's own History does. The test of a second launch waits for the home file to land before it reads it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
frahlg
force-pushed
the
feat/ledger-hourly-four-years
branch
2 times, most recently
from
November 2, 2026 11:52
d6d8b88 to
871b79e
Compare
Skatteverket's refund of energy tax after battery storage is worked out hour by hour for a calendar year and may be claimed until three years after the year ends. With two years of hours, the start of an older year was already daily totals and counted as incomplete. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
frahlg
force-pushed
the
feat/ledger-hourly-four-years
branch
from
November 2, 2026 14:52
871b79e to
f7952f5
Compare
frahlg
added a commit
to srcfl/ftw-app
that referenced
this pull request
Nov 2, 2026
…ket (#145) * feat(ios): the energy tax refund after battery storage, for Skatteverket A Swedish household gets back the energy tax on grid electricity a battery stored and later sent back to the grid. Core works out the figure for one calendar year (srcfl/ftw#1950). History now has a row for it under the day, for a home in SE1 to SE4 with a battery. The screen shows the year's figure in whole kWh rounded down, the hours behind it, the battery it was counted with and each month, and shares the hourly basis as CSV. A problem from the box shows its reason and no figure. Both routes are Read in Core, so the session's API passthrough carries them as they are. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(ios): the box keeps the hourly readings as long as one can apply srcfl/ftw#1951 keeps the ledger's hourly totals for four years, so the refund's note now says the box keeps them for the three years an owner can apply, as the box's own History does. The test of a second launch waits for the home file to land before it reads it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(ios): the energy tax refund with one account per battery Core now counts each battery on its own (srcfl/ftw#1953), and #1950 and #1953 ship in the same beta. The answer lists the batteries with their size and least efficiency, names the drivers it read nothing from in `unread`, and drops the top-level `efficiency`, `capacity_wh` and the `batteries` count with its problem. - Decode the list and `unread`. One battery keeps its line; with several, each has a line with what came from it, its size and the least it gives back, as the box's own History card writes it. The figure stays the box's total. - `battery_size` names the batteries without a size; `battery_unread` names the drivers in `unread`, in English and Swedish. Any other reason keeps the plain text. - The kept answers move to version 2, so one in the old shape is dropped. - The demo box answers in the new shape and writes the CSV one row per battery and hour. Two years back it read two batteries; the oldest year has a size for a battery it read nothing from. - Debug builds take `-FTWRefundYear`, and the screenshot script shoots both cases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #1950. Retarget to
masteronce #1950 merges.Why
Skatteverket's refund of energy tax after battery storage (#1950) is worked out hour by hour for one calendar year and may be claimed until three years after that year ends. The ledger kept hourly totals for two years and daily totals after that, so a year claimed late had its first months as daily totals, which the report counts as incomplete.
What
EnergyLedgerRetentiongoes from 2 × 365 days to 4 × 366 days: the hours of a year now last until its claim deadline, leap years included. Five-minute detail (30 days) and the daily tier after the hourly horizon are unchanged.Cost
The ledger stores about one hourly row per asset and flow (more only where an hour mixes qualities). A site with a grid meter, battery, solar, a charger and observed load has about ten flows, so roughly 88,000 rows a year. Two more years of hours adds about 175,000 rows, a few tens of MB in
history.db, instead of the same years as daily rows.Evidence
go test ./internal/state -run 'Ledger|Prune|Plain|Energy'andnode --test web/battery-return.test.mjspass. The prune tests use the constant, so they move with it. No conflict with #1751, the other open PR touchingenergy_ledger.go.🤖 Generated with Claude Code