Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nodered-entsoe-energy-prices

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.

What it does

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.

Requirements

Node-RED palette

These nodes are referenced in the flow and must be installed:

  • node-red-contrib-cron-plus — cron-based triggers
  • node-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 Assistant api-call-service node for the Loxone virtual switch
  • The built-in xml, http request, function, change, inject, delay, link out and debug nodes (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

External services

  • 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) and E1_injectie (injection, kWh, cumulative). Any DSMR/P1 ingestion that writes those globals will work.

Configuration

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 the in_Domain / out_Domain query parameters in "Generate URL" for other EIC area codes (e.g. 10YNL----------L for the Netherlands).
  • Timezone — the cron nodes use Europe/Brussels. Change if you run in a different zone.
  • InfluxDB bucket / database — the config-node uses gojodisk as 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 capMAX_KWARTIER_KWH = 15 in the quarter-hour functions. Increase for very high-load installations (EV charging, heat pump on a 3-phase 25 A connection).

Credentials

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).

Importing the flow

  1. Open Node-RED → menu (☰) → Import.
  2. Paste the contents of nodered-entsoe-energy-prices.json or upload the file.
  3. Pick a destination tab (new flow recommended).
  4. Open the gojodisk InfluxDB config-node and the Home Assistant server-node, and set the credentials / URL for your environment.
  5. Replace the two placeholders listed above.
  6. 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.

Global / flow variables created

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

License

MIT — do whatever you want, no warranty.

Notes & caveats

  • 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) and PT15M (quarter-hourly) ENTSO-E resolutions. From mid-2025 Belgian day-ahead is PT15M.
  • 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 !).

About

Node-RED flow that fetches Belgian ENTSO-E day-ahead prices and writes to InfluxDB

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors