Add energyforecast.de provider with 48-hour forecast window#225
Conversation
Co-authored-by: MaStr <1036501+MaStr@users.noreply.github.com>
Co-authored-by: MaStr <1036501+MaStr@users.noreply.github.com>
|
@copilot you forgot, that an api_key is required with the parameter token= |
Co-authored-by: MaStr <1036501+MaStr@users.noreply.github.com>
Added API token support. The energyforecast.de provider now requires an Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot If we are using vat fees and markup for local calculation, we should send the parameters vat=0 fixed_cost_cent=0 that we avoid the calculation on the data provider side. |
Co-authored-by: MaStr <1036501+MaStr@users.noreply.github.com>
Added |
There was a problem hiding this comment.
Pull Request Overview
This PR adds energyforecast.de as a new dynamic tariff provider to extend the price forecast window from the typical 24-36 hours to 48 hours, providing better day-ahead planning capabilities.
Key changes:
- New
Energyforecastprovider class implementing the energyforecast.de API with 48-hour forecast support - Integration into the
DynamicTarifffactory with configuration validation for required fields - Local price calculation applying VAT, fees, and markup to base prices retrieved from the API
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/batcontrol/dynamictariff/energyforecast.py |
New provider implementation with API client, price extraction logic, and formula for local price calculation |
src/batcontrol/dynamictariff/dynamictariff.py |
Factory integration adding energyforecast type with configuration validation |
tests/batcontrol/dynamictariff/test_energyforecast.py |
Comprehensive test suite with 9 tests covering price extraction, timezone handling, edge cases, and token validation |
config/batcontrol_config_dummy.yaml |
Updated configuration example documenting energyforecast as a new provider option |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| min_time_between_api_calls, | ||
| delay_evaluation_by_seconds | ||
| ) | ||
| selected_tariff.set_price_parameters(vat,fees,markup) |
There was a problem hiding this comment.
The parameter order passed to set_price_parameters() is (vat, fees, markup), but the method signature in energyforecast.py line 52 expects (vat, price_fees, price_markup). While the parameter names differ, the order should match. However, checking the Awattar implementation at line 48, it also calls set_price_parameters(vat,fees,markup) but Awattar's signature at line 53 is (vat, price_fees, price_markup). The order here appears correct, but verify that the second parameter is fees and third is markup, not reversed.
There was a problem hiding this comment.
The parameter order is correct - set_price_parameters(vat, fees, markup) matches the method signature (vat, price_fees, price_markup). The second parameter is fees/price_fees and the third is markup/price_markup, which is consistent with the Awattar implementation.
config/batcontrol_config_dummy.yaml
Outdated
| # apikey: YOUR_API_KEY # required for tibber and energyforecast | ||
|
|
There was a problem hiding this comment.
The comment indicates 'apikey' is required for both tibber and energyforecast, but it's commented out. For energyforecast, the apikey is a required field (as validated in dynamictariff.py line 89-94), so users won't get a working configuration by uncommenting just the provider type. Consider adding a separate example section for energyforecast configuration or making this clearer in the comments.
| # apikey: YOUR_API_KEY # required for tibber and energyforecast | |
| # apikey: YOUR_API_KEY # MANDATORY for energyforecast and tibber. Uncomment and set if using those providers. | |
| # Example configuration for energyforecast provider (apikey is required!): | |
| # utility: | |
| # type: energyforecast | |
| # vat: 0.20 | |
| # fees: 0.015 | |
| # markup: 0.03 | |
| # apikey: YOUR_API_KEY |
There was a problem hiding this comment.
Added a dedicated energyforecast configuration example section showing all required fields including the mandatory apikey. Updated in commit d12d5d9.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: MaStr <1036501+MaStr@users.noreply.github.com>
Add support for energyforecast.de as a dynamic tariff provider with 48-hour forecast window
Completed Tasks:
Implementation Summary:
Changes in this commit:
Key Features:
/api/v1/predictions/next_48_hours?resolution=hourly&token=YOUR_TOKEN&vat=0&fixed_cost_cent=0token)(base_price * (1 + markup) + fees) * (1 + vat)Test Coverage:
Quality Metrics:
Configuration Example:
API Request Format:
The
vat=0andfixed_cost_cent=0parameters ensure we receive base prices from the API, then apply our own local calculations.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.