feat(providers): Dynamic Wholesale Tariff retailer wiring (Phase 7 PR-2b)#88
Merged
Conversation
…7 PR-2b) PR-2b — Dynamic Wholesale Tariff is now a selectable retailer in PriceHawk's config flow with TWO entries (OpenElectricity, AEMO Direct) backed by ONE DynamicWholesaleTariffProvider class. Both implement the Provider Protocol in the same slot as Amber/Flow Power/LocalVolts. - DynamicWholesaleTariffProvider: self-priced; sync update(); public set_live_price(WholesalePrice) called by the coordinator's async refresh coroutine. 4-minute staleness guard dedups SDK calls against the 5-min dispatch cadence. Negative wholesale prices honoured (exporter pays during curtailment). State persistence honours AEGIS rules (version field + explicit HA-tz date, no date.today() fallback). - coordinator.py: DWT branch in __init__ and rebuild_engine. _refresh_dwt_price coroutine hooked into _async_update_data before the tick loop. ConfigEntryNotReady on inconsistent config (DWT marker without enabled flag). - config_flow.py: async_step_cdr_retailer prepends two synthetic DWT entries + dispatches to new dwt_credentials / dwt_aemo_setup steps. WEM excluded from AEMO Direct (NEMWeb is NEM-only per PR-3). API key validated live against OpenElectricity SDK before entry creation. - strings.json + translations/en.json kept byte-identical (project invariant). - 29 new tests; 868 total pass. Decisions: DECISIONS.md > D-P7-10, D-P7-11. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 21, 2026
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.
Summary
PR-2b — wires Dynamic Wholesale Tariff into PriceHawk's config flow as TWO retailer options (OpenElectricity, AEMO Direct) backed by ONE
DynamicWholesaleTariffProviderclass. Both implement the existingProviderProtocol in the same slot as Amber/Flow Power/LocalVolts. Closes the "wiring" half of v2 research PR-2 per the 2026-05-20 OE/NEMWeb-as-retailer correction.DynamicWholesaleTariffProvider: self-priced; syncupdate(); publicset_live_price(WholesalePrice)called by the coordinator's async refresh coroutine. 4-minute staleness guard dedups SDK calls against the 5-min dispatch cadence. Negative wholesale prices honoured (exporter pays during curtailment) with sign discipline matchingAmberProvider. State persistence honours AEGIS rules (version field + explicit HA-tz date; nodate.today()fallback).coordinator.py: DWT branch in__init__+rebuild_engine._refresh_dwt_pricecoroutine hooked into_async_update_databefore the per-tick provider loop.ConfigEntryNotReadyraised on inconsistent config (DWT marker without enable flag).config_flow.py:async_step_cdr_retailerprepends two synthetic DWT entries + dispatches to newasync_step_dwt_credentials/async_step_dwt_aemo_setupsteps. WEM is excluded from AEMO Direct (NEMWeb is NEM-only per PR-3); included on the OpenElectricity flavour. API key validated live against the OpenElectricity SDK before entry creation; auth failure surfaces aserrors[api_key] = "invalid_api_key".strings.json+translations/en.jsonkept byte-identical (project translation-parity invariant).today, extras, idempotency, package export, option-builder helpers, source-level routing dispatch + storage writes, and a strings byte-identical guard.Stacked on PR #87 (NEMWeb). GitHub will auto-retarget the base to
devwhen PR #86 + PR #87 land.Test plan
pytest --tb=short -q→ 868 passed (839 baseline + 29 new)ruff check→ clean on every Phase 7 filediff strings.json translations/en.json→ byte-identicalhomeassistant.local:8123:sensor.pricehawk_*entities update within 5-10 minutes against wholesale ratesDecisions: D-P7-10, D-P7-11 in
DECISIONS.md.