mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2025-06-27 08:26:53 +00:00
fix(ElecPriceEnergyCharts): get history series, update docs (#606)
Signed-off-by: redmoon2711 <redmoon2711@gmx.de>
This commit is contained in:
parent
eacd9010e1
commit
eb23123bba
@ -136,11 +136,21 @@ option are added.
|
||||
|
||||
### ElecPriceEnergyCharts Provider
|
||||
|
||||
The `ElecPriceEnergyCharts` provider retrieves electricity prices directly from **Energy-Charts.info**,
|
||||
which supplies price data for the next 24 hours. For periods beyond 24 hours, the provider generates
|
||||
prices by extrapolating historical price data combined with the most recent actual prices obtained
|
||||
from Energy-Charts.info. Electricity price charges specified in the `charges_kwh` configuration option
|
||||
are included in the calculation as `(market price + charges_kwh) * 1.19 VAT`.
|
||||
The `ElecPriceEnergyCharts` provider retrieves day-ahead electricity market prices from
|
||||
[Energy-Charts.info](https://www.Energy-Charts.info). It supports both short-term and extended forecasting by combining
|
||||
real-time market data with historical price trends.
|
||||
|
||||
- For the next 24 hours, market prices are fetched directly from Energy-Charts.info.
|
||||
- For periods beyond 24 hours, prices are estimated using extrapolation based on historical data and the latest
|
||||
available market values.
|
||||
|
||||
Charges and VAT
|
||||
|
||||
- If `charges_kwh` configuration option is greater than 0, the electricity price is calculated as:
|
||||
`(market price + charges_kwh) * 1.19 VAT` (including 19% VAT).
|
||||
- If `charges_kwh` is set to 0, the electricity price is simply: `market_price` (no VAT applied).
|
||||
|
||||
**Note:** For the most accurate forecasts, it is recommended to set the `historic_hours` parameter to 840.
|
||||
|
||||
### ElecPriceImport Provider
|
||||
|
||||
|
@ -177,18 +177,12 @@ class ElecPriceEnergyCharts(ElecPriceProvider):
|
||||
# Determine if update is needed and how many days
|
||||
past_days = 35
|
||||
if self.highest_orig_datetime:
|
||||
# Try to get lowest datetime in history
|
||||
try:
|
||||
history = self.key_to_array(
|
||||
key="elecprice_marketprice_wh",
|
||||
start_datetime=self.start_datetime,
|
||||
fill_method="linear",
|
||||
)
|
||||
# If start_datetime lower then history
|
||||
if history.index.min() <= self.start_datetime:
|
||||
past_days = 1
|
||||
except AttributeError as e:
|
||||
logger.error(f"Energy-Charts no Index in history: {e}")
|
||||
history_series = self.key_to_series(
|
||||
key="elecprice_marketprice_wh", start_datetime=self.start_datetime
|
||||
)
|
||||
# If history lower, then start_datetime
|
||||
if history_series.index.min() <= self.start_datetime:
|
||||
past_days = 0
|
||||
|
||||
needs_update = end > self.highest_orig_datetime
|
||||
else:
|
||||
@ -196,9 +190,9 @@ class ElecPriceEnergyCharts(ElecPriceProvider):
|
||||
|
||||
if needs_update:
|
||||
logger.info(
|
||||
f"Update ElecPriceEnergyCharts is needed, last update:{self.highest_orig_datetime}"
|
||||
f"Update ElecPriceEnergyCharts is needed, last in history: {self.highest_orig_datetime}"
|
||||
)
|
||||
# Set Start_date try to take data from 5 weeks back for prediction
|
||||
# Set start_date try to take data from 5 weeks back for prediction
|
||||
start_date = to_datetime(
|
||||
self.start_datetime - to_duration(f"{past_days} days"), as_string="YYYY-MM-DD"
|
||||
)
|
||||
@ -213,7 +207,7 @@ class ElecPriceEnergyCharts(ElecPriceProvider):
|
||||
self.key_from_series("elecprice_marketprice_wh", series_data)
|
||||
else:
|
||||
logger.info(
|
||||
f"No update ElecPriceEnergyCharts is needed last update:{self.highest_orig_datetime}"
|
||||
f"No Update ElecPriceEnergyCharts is needed, last in history: {self.highest_orig_datetime}"
|
||||
)
|
||||
|
||||
# Generate history array for prediction
|
||||
|
Loading…
x
Reference in New Issue
Block a user