Repository navigation
feat(ios): the energy tax refund after battery storage, for Skatteverket - #145
Merged
Merged
Conversation
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>
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. |
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>
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>
frahlg
added a commit
that referenced
this pull request
Nov 2, 2026
Release notes in English and Swedish for #145 (the energy tax refund after battery storage) and #147 (Hannes's three notes on the plan's clock and the level). The two 0.5.x paragraphs go, so both files stay under App Store Connect's 4000 characters. 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.
A Swedish household gets back the energy tax on grid electricity that a battery stored and later sent back to the grid (11 kap. 13 § LSE). Core works out the figure for one calendar year in srcfl/ftw#1950, with an account per battery from srcfl/ftw#1953. The two ship in the same Core beta. Fredrik asked on 2 Nov 2026 to carry it into the iOS app.
What changes
ftw-battery-return-<year>.csv, shared through the system share sheet;problem, the screen shows its reason and no figure, and no months:battery_sizenames the batteries without a size,battery_unreadnames the drivers inunread, and any reason a later box adds gets a plain sentence.How it reads the box
Core needs no change. Both routes are
Readinapi.routeson srcfl/ftw#1950 and #1953, and the passthrough carriestext/csv(carriedMediatakestext/*). So the app callsGET /api/energy/battery-return?year=and.csv?year=throughapi.req. No registry name changes. A box without #1950 answersE_UNKNOWN_OP, and the screen says the box may run older software.BatteryReturn(FTWKit/Format) decodes Core's JSON (thebatterieslist andunreadof #1953) and holds the rules: Swedish price area, Swedish calendar years, whole kWh.BatteryReturnGlancebuilds what the screen says, once per answer, year or minute.BatteryReturnModelasks throughLiveAsk, named by year and hour: once while the screen is open, again for another year or a new hour, never on a timer. It keeps each year's last answer in the sealed home file, so the screen opens on it, dated (SAVED ON THIS PHONE · AS OF …). The file is at version 2, so an answer kept in #1950's first shape is dropped.SiteModel.readBoxreturns the raw body.BatteryReturnWords; a test fails on any sentence without Swedish.-FTWTab refundopens the screen in debug builds, and-FTWRefundYear 2024picks the year;scripts/demo-screenshots.shshoots both cases.Files that open PRs touch: only
HistoryTab.swiftoverlaps (#107). This PR adds three lines to the tab's body and a new view at the end of the file.Evidence (this Mac)
swift testinappleApp/FTWKit: 659 Swift Testing tests and 348 XCTest tests green, 16 of them new (BatteryReturnTests,BatteryReturnModelTests).xcodebuildfor the iOS Simulator: builds with no warnings in the new code.ftw-battery-return-2025.csvwith a header and 8,760 hours. After #1953: 2024 shows two batteries and 2023 thebattery_unreadreason, in English and Swedish and at the largest text size. A test reads the 2024 CSV: 2 × 8,784 rows, one per battery and hour.LaunchClocknumbers.One account per battery (srcfl/ftw#1953):
Largest text size:
For review
efficiencyandcapacity_whare no longer read; no released box answers that way. The note that the box keeps the hourly readings for the three years an owner can apply is true once feat(state): the energy ledger keeps hourly totals for four years ftw#1951 is in too; it matches the box's own History note there.SavingsModelTests.itOpensOnTheLastAnswerhas the same gap.🤖 Generated with Claude Code