Skip to content

Feature/pricing modules#636

Open
ngardiner wants to merge 6 commits intomainfrom
feature/pricing-modules
Open

Feature/pricing modules#636
ngardiner wants to merge 6 commits intomainfrom
feature/pricing-modules

Conversation

@ngardiner
Copy link
Copy Markdown
Owner

Pricing Module integration (redux)

ngardiner and others added 6 commits April 13, 2026 15:42
…es modules

Forward-ports the pricing_modules branch (PRs #210 and #237) onto current main.
Introduces a pluggable Pricing module system with multi-module aggregation policy,
a /api/getPricing HTTP endpoint, background task queuing from Policy on each
enforcement cycle, and three initial modules: StaticPricing (config-based flat
rates), aWATTarPricing (Austrian spot market), and PVPCesPricing (Spanish PVPC
regulated tariff with cheapest-window scheduling support).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add Tuple import from typing module
- Replace tuple[bool, str] with Tuple[bool, str] for Python 3.9 compatibility
- Replace tuple[bool, str, dict] with Tuple[bool, str, dict]
- Fixes TypeError: 'type' object is not subscriptable in Python 3.9
…nfig

- Dashboard: add import/export price display to showStatus (shown only when
  Pricing modules are active); poll /api/getPricing every 30s via jsrefresh
- Policy: expose getImportPrice() and getExportPrice() in policyValue() so
  pricing conditions can be used in any policy match/value field
- Config: add maxImportPrice to config section; add full pricing module
  configuration block (Static, aWATTar, PVPCes) with commented examples;
  add commented emergency policy examples to stop charging when import price
  exceeds configured maximum or when export price exceeds import price

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Update PVPCesPricing cache comment to clarify daily update behavior
- Change default multiPrice policy from 'add' to 'first' in TWCMaster
- Improves pricing module documentation and default behavior
- Update config.json default multiPrice policy to 'first'
- Add rate limit handling in aWATTarPricing to respect 15-minute cache
- Update lastFetch timestamp even on parse errors to avoid excessive API calls
- tests/unit/conftest.py: fix namespace package shadowing so TWCManager.*
  imports resolve to lib/TWCManager/ rather than the root launcher script;
  this lifts the entire unit suite from 21 to 252 passing tests
- tests/unit/test_pricing.py: 28 tests covering StaticPricing (enabled/
  disabled paths, import/export prices, capabilities), aWATTarPricing
  (cache enforcement, Eur/MWh conversion, connection error handling),
  PVPCesPricing (hourly price selection, cache behaviour, token headers,
  cheapest-window scheduling including cross-midnight), and TWCMaster
  price aggregation with both 'first' and 'add' multiPrice policies
- docs/modules/Pricing_Static.md: Static Pricing module documentation
- docs/modules/Pricing_aWATTar.md: aWATTar Pricing module documentation
- docs/modules/Pricing_PVPCes.md: PVPCes Pricing module documentation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

Test Results

    8 files  +  2      8 suites  +2   4m 37s ⏱️ + 1m 11s
  368 tests + 28    272 ✅ + 28  2 💤 ±0   58 ❌ ± 0   36 🔥 ± 0 
1 472 runs  +452  1 088 ✅ +356  8 💤 +2  232 ❌ +58  144 🔥 +36 

For more details on these failures and errors, see this check.

Results for commit 1701ced. ± Comparison against base commit 795d647.

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