feat: add sell_price_equals_buy_price for net metering (NL saldering) - #2
Merged
Merged
Conversation
Under net metering (Dutch "saldering", in force through 2026 — e.g. Tibber NL) every exported kWh offsets an imported one on the bill, so its effective value is the full buy price incl. markup, VAT and grid fees — not spot + export compensation. The optimizer undervalued exports, skewing charge/discharge decisions for NL users. New opt-in price setting sell_price_equals_buy_price (default off, so existing behavior is unchanged). When enabled the sell price formula returns the buy price; the export compensation and export spot multiplier fields are hidden in the UI and ignored. - PriceSettings + PriceManager: new flag, _calculate_sell_price returns _calculate_buy_price when set - settings_store: bootstrap default + schema migration for old stores - API: setup-complete payload field sellPriceEqualsBuyPrice, PRICE_MAP, live updates; PATCH works via the existing section pass-through - PRICE_REQUIRED_FIELDS extended (store-backed, per contract test) - UI: toggle in Price Calculation (Settings + wizard), live preview shows sell = buy when enabled - tests: PriceManager unit tests for flag on/off Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JD7RhRSGxkW8zZirZQFRFC
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.
Why
Under net metering (Dutch "saldering", in force through 2026 — e.g. Tibber NL) every exported kWh offsets an imported one on the bill, so its effective value is the full buy price incl. markup, VAT and grid fees — not
spot + export compensation. The optimizer undervalued exports, skewing charge/discharge decisions for NL users.What
New opt-in price setting
sell_price_equals_buy_price(default off — existing behavior unchanged). When enabled the sell price equals the buy price; the Export Compensation and Export Spot Multiplier fields are hidden in the UI and ignored.PriceSettings+PriceManager: new flag;_calculate_sell_pricereturns_calculate_buy_pricewhen setsettings_store: bootstrap default + schema migration so existing stores upgrade in placesellPriceEqualsBuyPricein the setup-complete payload,_PRICE_MAP, and live updates;PATCH /api/settingsworks via the existing electricity-price section pass-throughPRICE_REQUIRED_FIELDSextended (store-backed field, enforced by the contract test)Verification
PriceManagerunit tests for the flag on/offnpm run buildandnpm run lintclean (0 errors)Independent of #1 (AC-coupled PV); both branch from
main.🤖 Generated with Claude Code
https://claude.ai/code/session_01JD7RhRSGxkW8zZirZQFRFC
Generated by Claude Code