Skip to content

Add optional annual base charge distribution to calculated cost sensors - #167

Draft
cabberley with Copilot wants to merge 1 commit into
mainfrom
copilot/feature-annual-base-charge-sensors
Draft

Add optional annual base charge distribution to calculated cost sensors#167
cabberley with Copilot wants to merge 1 commit into
mainfrom
copilot/feature-annual-base-charge-sensors

Conversation

Copilot AI commented Aug 5, 2026

Copy link
Copy Markdown

Calculated cost sensors currently model only variable consumption cost, which excludes fixed tariff components from hourly/daily/monthly/yearly views. This change adds an optional annual base charge input that is proportionally distributed per configured reset cycle and included directly in calculated sensor values.

  • Configuration and schema

    • Added optional annual_calc_base_price config/option field (numeric, default 0).
    • Wired value through config flow and options handling.
    • Added migration/default handling for existing entries to preserve backward compatibility.
  • Calculated sensor behavior

    • Extended calculated-cost logic to include:
      • consumption_cost + proportional_base_charge
      • proportional accumulation within the active period (instead of applying full period share at period start).
    • Implemented cycle-based distribution from annual value (hour/day/week/month/bi-monthly/quarterly/half-year/year).
    • Ensured base-charge updates apply forward-only (no retroactive history rewrite).
  • State/restore/reset integration

    • Integrated base-charge tracking with reset and restore-state paths so ongoing period progression remains consistent after restart and period boundaries.
  • Observability and UX

    • Added attributes exposing configured annual value and current calculated/base-charge context for easier validation in Home Assistant Developer Tools.
    • Added user-facing text/labels for the new option in strings.json and translations (en, de).
calculated_cost = (consumption_kwh * unit_price) + proportional_base_charge_for_current_period

Copilot AI linked an issue Aug 5, 2026 that may be closed by this pull request
3 tasks
Copilot AI changed the title [WIP] Add annual base charge feature for cost sensors Add optional annual base charge distribution to calculated cost sensors Aug 5, 2026
Copilot AI requested a review from cabberley August 5, 2026 21:06
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.

Feature proposal: Annual base charge for calculated cost sensors

2 participants