Skip to content

v0.5.0: peak and off-peak prices, payback date - #7

Merged
PeterSlijkhuis merged 6 commits into
mainfrom
claude/project-thread-1p9qg3
Sep 26, 2026
Merged

PeterSlijkhuis merged 6 commits into
mainfrom
claude/project-thread-1p9qg3

Conversation

@PeterSlijkhuis

@PeterSlijkhuis PeterSlijkhuis commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

Before: Battery ROI required a dynamic price sensor, so people on a fixed or peak/off-peak contract couldn't use it. When the price sensor was unavailable, no profit was booked. Payback was shown only as a number of years.

After:

  • The price sensor stays first and primary. It is now optional when a Peak price is entered (all-in, per kWh). On a single-rate contract, the peak price is the only one to fill in.
  • Peak/off-peak contracts can add an Off-peak price with its hours (default 23:00 to 07:00). An Off-peak all weekend switch, off by default, covers contracts where Saturday and Sunday are fully off-peak.
  • With both a sensor and a peak price, the sensor wins and the typed-in prices fill in while the sensor is unavailable.
  • Setup refuses to save without either a price sensor or a peak price.
  • The payback sensor gets a paid_back_on attribute (the expected date). The card shows "Paid back by Mar 2031 (4.5 y)".

How: _build falls back to _fixed_price(local time) when the sensor gives no value. Surcharge and VAT still apply only to the sensor price, because typed-in prices are all-in. The same path is used when replaying history. Version 0.5.0.

Tests: 26 pass, including peak/off-peak and weekend switching, the no-price error, the sensor-unavailable fallback and the payback date.

The price sensor stays the primary source. Without one, or while it is
unavailable, a fixed all-in price (with an optional night price and hours)
is used. The payback sensor gets a paid_back_on date, shown on the card.
@PeterSlijkhuis PeterSlijkhuis changed the title v0.5.0: fixed and day/night prices, payback date v0.5.0: peak and off-peak prices, payback date Sep 26, 2026
Single-rate users are told to add a feed-in price and grid power, since
without them only charging losses show. README gets a table of what each
contract type usually earns, and the card screenshots show the payback date.

PeterSlijkhuis commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner Author

The new hacs check fails on 2 of 9 validations: the repository has no description and no topics. Both are repository settings (About section on the repo page), not code, so they can't be fixed from this PR. Everything else passes, including brands, the manifest and hacs.json. The check turns green on the next run once the settings are filled in.

@PeterSlijkhuis
PeterSlijkhuis marked this pull request as ready for review September 26, 2026 22:23
@PeterSlijkhuis
PeterSlijkhuis merged commit 73291b5 into main Sep 26, 2026
5 of 6 checks passed
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