Repository navigation
Price Model
ZenMaster plans on a buy price and a sell (feed-in) price for every quarter of the next seven days. The first day or two are real day-ahead prices from your supplier or the power exchange. Everything after that is a forecast. This page explains where the prices come from, how a supplier's tariff turns the wholesale price into what you pay, and how the forecast beyond the day-ahead prices is built.
The price arrays hold 12 history quarters followed by the future; slot 12 is the quarter that contains "now".
You choose a provider on the price card. The implementations live in solver/dynamicprices/.
| Provider | Source | What it delivers |
|---|---|---|
| Energy-Charts | Energy-Charts public price API, per bidding zone | Wholesale day-ahead (spot), today and tomorrow |
| Nord Pool | Nord Pool public day-ahead data (pynordpool library) |
Wholesale day-ahead, today and tomorrow |
| Frank Energie | Frank GraphQL API, public prices or, after login, the prices of your own delivery site | All-in buy price and market price, today plus two days |
| Tibber | Tibber API with your access token |
total (all-in) and energy price, today and tomorrow |
| Zonneplan | Zonneplan app API, linked with a mailed one-time code | All-in and tax-excluded price; quarter-hourly preferred, hourly as fallback |
| NOMOS (DE) | NOMOS API with client credentials | All-in price (incl. VAT) and its electricity share |
| Octopus Energy (DE) | Octopus (Kraken) GraphQL API | Flat or time-of-use rate, and the forecast periods of a dynamic tariff |
| NextEnergy | No day-ahead of its own | The indicative forecast plus the tariff table only |
| Wholesale and named suppliers | Energy-Charts day-ahead | Spot plus the supplier's tariff from tariffs.json
|
The named suppliers in the last row are ANWB Energie, Vandebron and Eneco (NL), EnBW (DE), Ebem, Octa+ and Eneco (BE), Sobry and Frank Energie (FR), aWATTar and smartENERGY (AT). They have no API of their own in ZenMaster: their price is the Energy-Charts spot price with their markup applied.
Every provider first fetches the indicative seven-day wholesale curve of EpexPredictor, then overwrites it with the real prices it has. Where the real prices end is remembered, so the outlook can show which part is a forecast. NextEnergy has no real prices, so its whole curve is indicative.
Refresh: on a cold start, and each day once the market publish time (13:00 for every country in the table) has passed, again every quarter until the prices for tomorrow are in. After every refresh the sell price is capped at the buy price, so the planner never sees "free money".
For the spot providers the tariff comes from solver/dynamicprices/tariffs.json. A value you enter on the card wins over the supplier's value, and the supplier's value wins over the country's. The energy tax used below is the country's energy tax plus the grid fee.
| Country | Energy tax (EUR/kWh) | Grid fee (EUR/kWh) | VAT (value added tax) | Feed-in rule |
|---|---|---|---|---|
| NL | 0.09161 | none | 21 % | spot x 1.0 |
| DE | 0.06662 | 0.0924 | 19 % | fixed 0.077 EUR/kWh (factor 0) |
| BE | 0.0422 | 0.0523 | 6 % | spot x supplier factor + supplier markup |
| FR | 0.03035 | time of use (below) | 20 % | fixed 0.011 EUR/kWh (factor 0) |
| AT | 0.0072 | 0.0768 | 20 % | spot x 0.81 |
Supplier defaults (import markup in EUR/kWh, fixed cost in EUR/day):
| Supplier | Import factor | Import markup | Fixed cost/day | Export factor | Export markup |
|---|---|---|---|---|---|
| ANWB (NL) | 1.0 | 0.0149 | 0.28 | 1.0 | 0 |
| Vandebron (NL) | 1.0 | 0.01826 | 0.23 | 1.0 | 0 |
| Eneco (NL) | 1.0 | 0.01562 | 0.23 | 1.0 | -0.0292 |
| EnBW (DE) | 1.0 | 0.0 | 0.58 | country | country |
| Ebem (BE) | 1.08 | 0.03145 | 0.1918 | 0.925 | -0.011 |
| Octa+ (BE) | 1.094 | 0.02058 | 0.1781 | 0.922 | -0.0131 |
| Eneco (BE) | 1.02 | 0.01833 | 0.0411 | 1.0 | -0.013 |
| Sobry (FR) | 1.0 | 0.010 | 0.6523 | country | country |
| Frank Energie (FR) | 1.0 | 0.019 | 0.5843 | country | country |
| aWATTar (AT) | 1.0 | 0.015 | 0.189 | country | country |
| smartENERGY (AT) | 1.0 | 0.012 | 0.0983 | country | country |
The fixed cost per day is stored with the tariff but is not part of the per-quarter price.
France, time of use. The grid fee TURPE (Tarif d'Utilisation des Réseaux Publics d'Électricité) depends on the hour and the season. Winter is November to March. Default off-peak hours are 22:00-06:00; you can enter the off-peak hours of your address on the card, and a separate set for summer.
| TURPE (EUR/kWh) | Winter | Summer |
|---|---|---|
| Peak | 0.0772 | 0.0171 |
| Off-peak | 0.0409 | 0.012 |
Net metering (saldering). With saldering on, exported kWh are settled at the import price: the sell price is set equal to the buy price for every quarter.
For Energy-Charts, Nord Pool, the named suppliers and NextEnergy:
buy = (spot x import_factor + import_markup + energy_tax + tou) x (1 + VAT/100)
sell = spot x export_factor + export_markup
spot is the day-ahead price converted from EUR/MWh to EUR/kWh, tou is the French time-of-use grid fee (zero elsewhere).
Providers that deliver an all-in price (Tibber, Zonneplan, NOMOS, Octopus) use that price directly for the real quarters. For the forecast tail they add the average difference between their all-in price and the spot price over the real quarters. Frank Energie builds its tail as spot x (1 + VAT/100) + sourcing markup + energy tax, with the last markup and tax it received. NOMOS and Octopus apply the country's feed-in rule to the sell price; Tibber, Zonneplan and Frank use the provider's market price as sell price.
flowchart LR
H[Recorded price history<br/>hourly statistics] --> F[Least-squares fit<br/>per window 10/14/21 days]
W[Open-Meteo<br/>irradiance and wind] --> F
F --> S{Best error on<br/>last 3 days}
S --> R[Refit winner up to now]
R --> SH[Intraday shape]
E[EpexPredictor<br/>indicative curve] --> L[Level per day]
SH --> T[Tail = level x shape]
L --> T
T --> X[Cross-fade 8 quarters<br/>from the last real price]
ZenMaster fits its own published buy and sell price sensors on their recorded history (hourly means from the recorder statistics). A series needs at least 168 hours of history, otherwise the fallback below is used. The model is ordinary least squares on:
- a constant;
- sine and cosine of the hour of day for the 24, 12 and 8 hour harmonics;
- a weekend flag (Saturday and Sunday);
- solar irradiance (direct normal plus diffuse, in W/m2, divided by 1000);
- wind speed at 10 m (m/s, divided by 10).
The weather comes from Open-Meteo, hourly, covering the history and eight forecast days.
Three window lengths are tried: 10, 14 and 21 days. The most recent 3 days are held back as a test set. Each window is fitted on the days just before that test set and scored by its mean absolute error on it. A window needs at least 18 hours of data per day of its length to take part; the test set needs at least 24 hours and the rest at least 48. The window with the lowest error wins and is refitted on its length up to now, so the newest days are in the model. Because the winner is chosen again on every refresh, the window length follows the season.
The tail starts where the real prices end. For each tail day (blocks of 96 quarters):
tail = level_of_day x shape / mean(shape over that day)
The level is the mean of the positive EpexPredictor indicative prices for that day, which keeps the day-to-day contrast the battery plans its arbitrage on. The shape comes from the fitted model. Without a fitted model, the shape is the per-quarter-of-day profile of the real day-ahead prices, normalised to its mean; that needs at least 24 quarters of real prices, and quarters of day without a real sample keep their indicative value.
Finally the first 8 tail quarters are cross-faded from the last real price: quarter i (0 to 7) gets weight (i + 1) / 9 on the tail value and the rest on the last real price. The buy tail gets its own fitted shape in the same way.
See The planner for how these prices drive the plan and Battery model for how the battery uses them.
In the code: custom_components/zenmaster/solver/dynamicprice.py, custom_components/zenmaster/solver/dynamicprices/ (energycharts.py, nordpool.py, frank.py, tibber.py, zonneplan.py, nomos.py, octopus.py, nextenergy.py, tariffs.json)
ZenMaster on GitHub · Releases · Issues · Licensed under GPL-3.0
Getting started
Devices
How it calculates
- The planner
- Battery model
- Real-time control
- House model
- Hot water tank
- Price model
- Solar, base load and phases
- Appliances and EV
- Recorder
More