A Node-RED flow that fetches Belgian day-ahead electricity prices from the ENTSO-E Transparency Platform, combines them with live readings from a P1 smart meter, and writes the result to InfluxDB 2.x (and, optionally, to Home Assistant / a Loxone Miniserver).
Designed to run on a Raspberry Pi or any other Node-RED host located in Europe/Brussels.
The flow is split into six sections, each marked with a comment node in the editor:
| Section | Purpose |
|---|---|
| 1. ENTSO-E price fetch | Fetches today's + tomorrow's day-ahead prices (cron: 01:01, 06:01, 13:01 + startup). The 13:01 trigger catches tomorrow's prices, which ENTSO-E publishes around 12:30 CET. An auto-retry loop runs every hour between 13:00 and 23:59 until tomorrow's data is in the archive. |
| 2. Quarter-hour metering + cost | Every 15 min, reads E1_afname (consumption) and E1_injectie (injection) totals, computes the delta over the last quarter, and calculates cost / revenue using the matching ENTSO-E slot price. Includes a first-run guard and a 15 kWh/quarter sanity cap. |
| 3. Hourly price → InfluxDB + Loxone | On the hour, looks up the current slot's price and pushes it to InfluxDB + a Loxone virtual input (via Home Assistant). |
| 4. Ecopower arrays + day-ahead InfluxDB | Builds two arrays (ecopower_injectie, ecopower_verbruik) used elsewhere for cost forecasting, and stores the day-ahead curve in InfluxDB. |
| 5. 48 h InfluxDB write | Every 15 min, writes today + tomorrow prices to InfluxDB via HTTP line protocol (one point per quarter). |
| 6. Manual controls | Inject buttons for: manual ENTSO-E fetch, manual month-cost reset, test previous-month data, restore monthly cost (+8). |
The flow keeps a 24/48 h price archive in global.dayAheadPricesArchive, keyed by ISO date (YYYY-MM-DD), with automatic pruning of dates older than today.
These nodes are referenced in the flow and must be installed:
node-red-contrib-cron-plus— cron-based triggersnode-red-contrib-influxdb— InfluxDB out node (used in Sections 3–5)node-red-contrib-home-assistant-websocket(optional) — only needed if you keep the Home Assistantapi-call-servicenode for the Loxone virtual switch- The built-in
xml,http request,function,change,inject,delay,link outanddebugnodes (shipped with Node-RED core)
Install in one go via the Node-RED palette manager, or from the command line:
cd ~/.node-red
npm install node-red-contrib-cron-plus node-red-contrib-influxdb node-red-contrib-home-assistant-websocket- ENTSO-E security token — register at https://transparency.entsoe.eu/ and request a personal API token (free, takes ~1 working day to be issued).
- InfluxDB 2.x — a bucket for the price/cost series. The flow uses the v2.0 client; for v1.x InfluxDB you'd need to switch the config-node mode.
- (Optional) Home Assistant — only needed to forward the current hour price to a Loxone Miniserver via a
switch.*virtual entity. - (Optional) P1 smart meter integration — the flow reads two global Node-RED variables,
E1_afname(consumption, kWh, cumulative) andE1_injectie(injection, kWh, cumulative). Any DSMR/P1 ingestion that writes those globals will work.
Before deploying, replace the placeholders in nodered-entsoe-energy-prices.json:
| Placeholder | Where | What to set |
|---|---|---|
YOUR_ENTSOE_SECURITY_TOKEN |
"Generate URL" function (Section 1) | Your personal ENTSO-E API token (UUID). |
YOUR_INFLUXDB_HOST |
InfluxDB config-node + "Write 48h via HTTP line protocol" node | Hostname or IP of your InfluxDB instance (e.g. 192.168.1.50 or influx.lan). |
Other values you may want to review:
- Bidding zone — currently hardcoded to
10YBE----------2(Belgium). Change thein_Domain/out_Domainquery parameters in "Generate URL" for other EIC area codes (e.g.10YNL----------Lfor the Netherlands). - Timezone — the cron nodes use
Europe/Brussels. Change if you run in a different zone. - InfluxDB bucket / database — the config-node uses
gojodiskas bucket/database name; rename to match yours. - Loxone entity — the api-call-service node toggles
switch.todo_loxone_prijs_verbruik. Replace with your own entity, or delete the node if you don't use Loxone/HA. - Sanity cap —
MAX_KWARTIER_KWH = 15in the quarter-hour functions. Increase for very high-load installations (EV charging, heat pump on a 3-phase 25 A connection).
ENTSO-E only requires a security token in the URL (no separate username/password). InfluxDB 2.x uses a token configured in the Node-RED influxdb config-node — set this in the editor after import; the token is not stored in the exported flow JSON (Node-RED keeps credentials in the separate flows_cred.json file).
- Open Node-RED → menu (☰) → Import.
- Paste the contents of
nodered-entsoe-energy-prices.jsonor upload the file. - Pick a destination tab (new flow recommended).
- Open the
gojodiskInfluxDB config-node and theHome Assistantserver-node, and set the credentials / URL for your environment. - Replace the two placeholders listed above.
- Deploy.
Within ~30 seconds of deploy, the startup inject fires once and the flow fetches today's prices. The first hourly cost record appears after the next quarter-hour boundary.
For reference (read by other flows, dashboards, etc.):
| Scope | Name | Type | Set by |
|---|---|---|---|
global |
dayAheadPricesArchive |
{ [YYYY-MM-DD]: [{uur, hourPrice}, ...] } (96 slots/day) |
Section 1 |
global |
Maandkost |
number (cumulative €/month) | Section 2 / Section 6 |
global |
ecopower_injectie |
array | Section 4 |
global |
ecopower_verbruik |
array | Section 4 |
flow |
E1_afname, E1_injectie |
{value, kwartierDelta, timestamp} |
Section 2 |
flow |
pArray |
array | Section 1 |
flow |
Maandkost, MaandkostMonthKey |
number, YYYY-MM |
Section 2 |
MIT — do whatever you want, no warranty.
- ENTSO-E publishes day-ahead prices for the next day at ~12:30 CET on weekdays and ~13:00 CET on weekends. The 13:01 cron is timed for this; the auto-retry covers occasional delays.
- The flow handles both
PT60M(hourly) andPT15M(quarter-hourly) ENTSO-E resolutions. From mid-2025 Belgian day-ahead isPT15M. - Prices from ENTSO-E are in EUR/MWh. The cost-calculation functions in Section 2 convert to €/kWh internally where needed — double-check the formulas if you adapt the flow for another tariff structure.
- The "Ecopower formule" function contains a yearly correction factor; review it once per year (see node name
formule ecopower jaarlijks nazien !).