isno.fr

Victron battery: control it with Node-RED, Home Assistant and 3ERL

A Victron battery driven by a Node-RED flow that runs on the GX and writes, quarter hour after quarter hour, the 48 Dynamic ESS slots according to the contract tariffs and the day's resale price. From installation to monitoring in Home Assistant.

Victron battery: control it with Node-RED, Home Assistant and 3ERL
A day of control in four ranges around the house: night, morning, low-price window, evening. Generated illustration.

A home battery only pays off if it charges at the right time and empties at the right time. With a Victron battery, the GX can do this through Dynamic ESS, provided you tell it what to do with each of the 48 slots of the day. This project tells it, from a Node-RED flow that runs on the GX itself, sells the solar surplus to 3ERL at the right price, and publishes everything it decides to Home Assistant.

It is written for one specific installation, mine, and says so: an Engie Happy Heures contract (two hours at a very low price every afternoon), surplus resale to 3ERL, and a Pylontech battery. The hardware and contract values are declared in a file; the logic, however, assumes this kind of contract. The limits are at the end of the article.

Prerequisites

Before you start, check that you have:

  • a Victron GX (Cerbo GX, EasySolar-II GX, Ekrano…) running Venus OS Large, which ships with Node-RED;
  • an ESS installation: the ESS assistant loaded in the MultiPlus-II or the Quattro (a MultiPlus-II 48/5000 in my case, inside an EasySolar-II GX), and a battery managed by its BMS (Pylontech over CAN, for example);
  • Dynamic ESS available on the GX;
  • Home Assistant with the Mosquitto add-on and the MQTT integration: the flow publishes its decisions there, and reads four values from it (see below);
  • Python 3 and Node.js on the computer that builds the flow;
  • your installation’s identifiers, noted once: the GX identifier (Paramètres > VRM (Settings > VRM), line “ID Portail VRM” (VRM Portal ID)) and the instance numbers of the Multi, the battery and the solar charger (same page, “Instances du dispositif VRM” (VRM device instances), or in the Victron nodes of Node-RED);
  • a supply contract with a low-price period (off-peak hours, an afternoon window);
  • for selling: a surplus resale contract with 3ERL, and grid injection approved by Enedis.

No Victron? The decisions do not depend on Victron. They live in separate JavaScript files, with their tests: the night threshold, the morning trajectory, the selling. Only two parts of the flow are specific to Victron: reading the measurements (Victron nodes) and writing the schedule (Dynamic ESS slots over MQTT). Node-RED can read and write Modbus and MQTT, and Home Assistant integrates many hybrid inverters. So the flow can be ported to an equivalent installation, provided you replace those two parts with the ones for your hardware.

What to set on the Victron GX

The flow writes the Dynamic ESS schedule, and nothing else: it does not touch any GX setting. Those settings must therefore be in place before you install it. Everything is set from the GX screen, or from its remote console, except the Dynamic ESS mode.

Node-RED and MQTT access

Paramètres > Intégrations (Settings > Integrations), section “Fonctionnalités Venus OS Large” (Venus OS Large features):

  • Node-RED: “Activé” (Enabled), and definitely not “Activé (mode sécurisé)” (Enabled (safe mode)). In safe mode, the flows do not restart when the GX restarts: Node-RED starts, the flows stay visible in the editor, but nothing is controlled, and nothing tells you so. They only start again at the next deploy. According to the Venus OS Large documentation, this mode is there to regain control when a faulty flow saturates the GX processor: it is a troubleshooting tool, not an operating setting, and it applies at every boot as long as it stays selected. This is exactly the failure described further down: my GX had been left in safe mode, and its flows did not start again after a reboot. It has been on “Activé” since.
  • Accès MQTT (MQTT access): “On”: the flow writes its slots through the GX’s MQTT broker.

The GX Settings > Integrations screen, annotated: Node-RED set to "Activé" (Enabled) so the flows restart with the GX, and MQTT access set to On

ESS

Paramètres > Configuration Système > ESS (Settings > System setup > ESS):

  • Mode: “Optimisé avec BatteryLife” (Optimized with BatteryLife) (or “Optimisé sans BatteryLife” (Optimized without BatteryLife));
  • SOC minimum (sauf défaillance réseau) (minimum SOC, unless grid fails): your floor, 20 % in my case. It depends on your battery: a lithium battery (LiFePO4, like the Pylontech) handles deep discharge, a lead-acid battery needs a much higher floor. Victron’s ESS manual gives no value: follow the battery manual. The flow reads this setting and never goes below it; it does not redefine it;
  • ⚠️ with BatteryLife, the floor actually applied (“Limite de SOC active” (active SOC limit)) can be higher than this minimum SOC: BatteryLife raises it by 5 % per day when the battery does not reach a good charge, up to 80 %, and lowers it again once the battery is back at 95 %. The flow, on the other hand, reads the configured minimum SOC. In my case, the window fills the battery to 100 % almost every day, and the active limit stays at 20 %. If yours rises, the flow will plan lower than what the ESS will allow; “Optimisé sans BatteryLife” avoids the gap;
  • Injection dans le réseau > Réinjecter l’excédent puissance PV couplé CC (Grid feed-in > Feed in excess DC-coupled PV): enabled. Without this setting, the surplus from an MPPT charger does not go to the grid, and the sale never happens.

The GX ESS screen: mode "Optimisé avec BatteryLife" (Optimized with BatteryLife), minimum SOC at 20 %

The Grid feed-in screen: "Réinjecter l'excédent puissance PV couplé CC" (Feed in excess DC-coupled PV) enabled, AC coupling disabled

Dynamic ESS: Node-RED takes over

Dynamic ESS has three ways of working: off, “Auto” (VRM computes the schedule from the prices you give it), and Node-RED (mode 4): a flow on the GX writes the schedule, slot by slot, and Dynamic ESS executes it. This last mode is the one the flow uses.

It has one peculiarity: it cannot be selected anywhere on screen. The GX menu (Paramètres > Configuration Système > ESS > Dynamic ESS > Mode) only offers “Off” and “Auto”, and VRM only sets its own “Auto” mode. So Node-RED hands control to itself, once, at commissioning: step 4 of the installation imports a small tab with a “Dynamic ESS en mode Node-RED” (Dynamic ESS in Node-RED mode) button, which writes this setting.

After that, the GX screen shows “Mode : Inconnu” (Mode: Unknown). This is normal: mode 4 has no name in that menu. Do not touch it again: choosing “Off” or “Auto” would cut off the control. If the mode ever goes back to “Auto” (it happened to me, and I do not know why), one click on the same button restores it. The VRM dashboard lets you check this at a glance, see below.

The GX Dynamic ESS screen in Node-RED mode: the mode shows as "Inconnu" (Unknown), which is normal

In VRM, leave Dynamic ESS disabled

The VRM portal has its own Dynamic ESS page (Installation > Settings > Dynamic ESS). It holds the configuration of the “Auto” mode: whether selling is allowed, maximum grid power, battery capacity and limits, wear cost, purchase price per time slot. With this flow, its switch stays off: Node-RED does the planning, with its own tariffs (tarifs.json) and its own wear (installation.json). The prices and the “sell or not” choice on that page are only used by the “Auto” mode: on mine, it still carries a single purchase price of €0.252 that nobody uses. Its battery and grid limits are also only used by VRM’s computation: the ones the GX applies when executing the slots are its own settings, detailed below. The “Controls” panel of the VRM dashboard only shows the Dynamic ESS controls when that switch is on, so it is normal not to see them there.

The VRM Dynamic ESS page: the Dynamic ESS switch is off, since Node-RED writes the schedule

The VRM dashboard is still useful to follow what the flow does: here, at midnight, the battery is charging from the grid, as the night period decided. The Multi shows “External control”: with DVCC, the battery’s BMS sets its charge limits, not the Multi’s internal algorithm.

The VRM dashboard at midnight: 4,350 W drawn from the grid, the battery at 38 % charging at 3,522 W, the Multi in "External control"

Further down the same dashboard, a Dynamic ESS frame tells you which mode the GX is really running in, and shows hour by hour what the battery and the grid did. It is the simplest check after commissioning, and after every GX reboot.

The Dynamic ESS frame of the VRM dashboard, annotated: its title names the Node-RED mode, the plotted price is the one from the VRM page and not the flow's, and the night charge appears from midnight to 2 am

The other settings

These settings are those of my installation, read from the GX. The flow does not require any specific value for them, but it relies on them: they protect the battery and the contract, whatever the schedule asks for.

The grid current limit is set in the GX control panel (the icon at the top left of the screen), together with the ESS minimum SOC.

The GX control panel, annotated: the grid current limit at 25 A, and the ESS minimum SOC at 20 %

The 25 A limit is the most important protection for my contract: when the flow charges the battery from the grid while the house is consuming, it is what keeps the draw under the subscribed power. With another subscription, it is computed the same way: the subscribed power divided by 230 V, with a little margin.

DVCC is in Paramètres > Configuration Système > Contrôle de la charge (Settings > System setup > Charge control). It lets the battery’s BMS control the charge: without it, the GX would not know what the battery accepts at each moment.

The GX Charge control (DVCC) page, annotated: DVCC forced by the battery type, maximum charge current 100 A, control by the Pylontech BMS

The settings specific to Dynamic ESS are not shown on the GX screen in Node-RED mode. I read them over MQTT, under settings/0/Settings/DynamicEss/. The VRM Dynamic ESS page carries values with the same names, but it says so itself: they are only used for its own computation and do not change the GX settings. On my installation, both hold the same values. I checked in the Dynamic ESS code of my GX (Venus OS, dbus-systemcalc 2.257) what each one really does:

SettingMineWhat Dynamic ESS does with it in Node-RED mode
Battery capacity10.66 kWhconverts the gap between the current SOC and the slot target into charge power. At zero, Dynamic ESS does nothing at all
Charge and discharge limits5 kW and 4 kWcap the power Dynamic ESS asks of the battery, including the fast charge of the afternoon window
Import and export limits6 kW and 4.25 kWcap what Dynamic ESS asks of the grid, in both directions
System efficiency90 %corrects the conversion losses between the grid and the battery
Full chargeevery 7 days, for 2 hoursnothing: the GX does not read this setting, only VRM’s “Auto” mode uses it. With the flow, the afternoon window targets 100 % every day

The problem: everything depends on your contract

Three prices decide everything:

  • what you pay per kWh at each hour: peak hours, off-peak hours, low-price period;
  • what a resold kWh earns you;
  • what a kWh costs your battery: the pack price divided by the energy it can store over its whole life (guaranteed cycles × energy per cycle).

Two rules follow:

  • charging from the grid only pays off if low price + wear < price at the hour this kWh will be consumed;
  • selling the surplus only pays off if resale price > price at which you will buy this kWh back.

The example of my installation. Engie Happy Heures (the offer as described by Que Choisir, which is no longer listed on Engie’s site): €0.245 per kWh in peak hours, €0.191 in off-peak hours (midnight to 6 am), €0.037 between 3 pm and 5 pm. Resale to 3ERL: 70 % of the positive imbalance settlement price (the PREP, published every quarter hour). Three Pylontech US3000C modules: €0.061 of wear per kWh (€3,500 for 6,000 cycles of 9.6 kWh).

With your contract, the numbers change, and sometimes the conclusions. They are declared in two files, tarifs.json and installation.json, and the flow redoes these comparisons every quarter hour.

How it decides

The day is split into four periods. Each one writes its Dynamic ESS slots every fifteen minutes. Each tab starts a little before its period and ends a little after, so that its slots are written in time and corrected while they run.

The four control periods over a day, under the contract tariffs: night from midnight to 6 am during off-peak hours, morning from 6 am to 3 pm, Happy Heures window from 3 pm to 5 pm, evening from 5 pm to midnight, and the role of each

In Node-RED, each period is a tab. The complete flow has seven: the four periods, the price source (the only place that queries 3ERL), the measurements (consumption, solar forecast, BMS state, values read from Home Assistant) and the fuel price for the car.

The "DESS nuit" (DESS night) tab in Node-RED on the GX, from left to right: read the price set by the source, compute the morning need, the night setpoint, the dark-day charge, then write the slots to the GX and publish the state to Home Assistant. Under each node, its latest live status

Each node shows its latest decision and its reason. Here, at noon: the price read 8 minutes ago, a need of 0.18 kWh for the morning, and the resulting setpoint, “la batterie sert” (the battery serves), since it will last until sunrise.

The night: serve, freeze or charge

From midnight to 6 am, the grid costs the off-peak rate. At 6 am it switches to peak hours, and the battery must last until solar covers the house.

Every night, the flow computes what the morning will cost in peak hours: hour by hour, from 6 am to 3 pm, the usual consumption (corrected by the continuously measured consumption) minus the forecast solar production, up to the first hour when solar is enough. From this it derives a threshold: the floor, plus that need.

  • Above the threshold, the battery serves the house during the night: it has enough to last the morning.
  • Below it, the tariff decides. If off-peak + wear < peak, the flow charges the battery from the grid up to the threshold. Otherwise, it freezes it: the battery stops going down, the house takes the grid at the off-peak rate, and each kWh kept will avoid a peak-hour kWh in the morning. Keeping more than the threshold would be a loss: that kWh would be bought back at €0.037 in the afternoon window.

The night decision tree: morning need known, SOC below the threshold or freeze already decided, off-peak plus wear against peak; the battery serves, is topped up or frozen; and the second path for dark days, which charges what is missing without looking at the tariffs

The threshold kept is the highest one computed during the night, and a freeze once decided holds until morning: the battery does not start going down again because a forecast moved at 3 am.

The need follows the season without any setting: in summer, solar covers the house early and there is almost nothing to keep; in winter, it covers it late, and the threshold rises.

The flow redoes this comparison every night with the prices declared in tarifs.json: nothing is hard-coded, and the decision follows your contract. As an example, mine, which shows that a tariff increase can be enough to reverse the conclusion:

Off-peak + wearPeak hours avoidedBelow the threshold, the flow…
until 30 November0.191 + 0.061 = €0.252€0.245freezes: charging would cost more than it avoids
from 1 December0.228 + 0.061 = €0.289€0.293charges: the margin is thin, but it wins

An upcoming tariff grid is declared in advance in tarifs.json, with its effective date. You need to deploy the flow once after adding it; the flow then switches grids on its own, on the given day.

A second reason to charge at night, regardless of tariffs. The flow also compares the next day’s consumption with the forecast solar production, corrected by the gap measured between forecast and production over the previous days. If the deficit exceeds what the afternoon window can bring (3.55 kW for 2 hours, i.e. 7.1 kWh) plus what the battery holds, it charges what is missing during off-peak hours. On a very dark day, the battery therefore charges at night even when the tariff calculation would say to freeze it: otherwise, it would be empty before the window.

The day: go down, fill up, serve

The day decision tree: in the morning, go down along a trajectory to the 3 pm target, or let the battery serve if the room is already made; in the window, fill to 100 % then let the surplus go once the battery no longer absorbs; in the evening, the battery serves down to the floor

The morning: go down until the window

From 6 am to 3 pm, the battery covers peak hours. The flow aims, at 3 pm, for the level that leaves just the room the window will fill: 100 % minus what the window can put in. This gain is measured in Home Assistant every day; failing that, it is estimated from what the BMS accepts. In between, the flow draws a discharge trajectory, slot by slot, following the hourly consumption. The grid does not recharge the battery in the morning.

The window: fill up at the low price

From 3 pm to 5 pm, the target is 100 %, with the fast charge requested from Dynamic ESS. Filling up completely has one more reason than price: the battery’s gauge only recalibrates at the end of a full charge.

The evening: serve the house

From 5 pm to midnight, the most expensive period, the battery serves the house down to the floor. Any solar surplus follows the selling rule.

Selling to 3ERL

3ERL buys the surplus at the PREP of the quarter hour and pays back 70 % of it. This price changes every quarter hour, and it can go negative: 3ERL then deducts the injected energy from your earnings, and asks you to curtail injection.

The “Source 3ERL” (3ERL source) tab is the only one that queries 3ERL. After each publication, it polls every minute until it gets the quarter-hour price, and makes it available to the four periods. On each pass, the current period decides whether to open or close selling, and writes it into its slots.

The selling decision tree, every quarter hour: closed in case of a prohibition (curtailment, degraded mode, RTE unavailable, negative or zero PREP); during the window, open when the battery no longer absorbs; in the morning and evening, open if the price is known, fresh and above the buy-back price, or if the battery is full

  • Always closed if 3ERL requests curtailment, is in degraded mode, or if RTE is unavailable. And also if the PREP is negative or zero: the flow notices this itself, without waiting for 3ERL’s flag. On 15 October, that flag did not work.
  • In the morning and evening, selling only opens if 70 % of the PREP exceeds the price at which I will buy this kWh back: the Happy Heures window at €0.037, i.e. a PREP above €52 per MWh. A price that is unknown or more than 45 minutes old (three missed publications) also closes selling. On 15 October, the 3ERL API stayed frozen for four and a half hours: selling on a price you no longer know is selling blind.
  • Unless the battery is full: the surplus would then be lost for nothing, and it is better to sell it, even at a low or unknown price. The prohibitions of the first point, however, never give way.
  • During the window, the rule is different: selling opens as soon as the battery barely absorbs anything (less than 0.5 kW, around 99 %), whatever the price. Only the prohibitions close it.

Closing selling does not necessarily put the surplus into the battery: if the battery is following a discharge trajectory, as in the morning, the surplus is simply clipped.

The battery itself never sells to the grid. This is a choice I made once and for all, and it is enforced in the code, at the single place that writes to the GX. Only the solar surplus is sold.

When data is missing

The flow depends on sources that go down: the 3ERL API, the solar forecast, Home Assistant. Each rule then picks the cautious side, and says so in its reason:

  • without a forecast or without a consumption profile, no freeze at night, and no night charge;
  • without readable tariffs, freeze by default;
  • without a 3ERL price, or with a stale price, selling closes, unless the battery is full;
  • without a consumption profile, the morning keeps a single target instead of a trajectory;
  • without the GX floor, no night charge.

Installing the flow in Node-RED and Home Assistant

All the code is public on GitHub, under the GPL-3.0 license: Isno-Open/victron-dess-3erl.

The flow’s code is not written in the Node-RED editor: it is built from the repository, where each rule is a readable JavaScript file, with its tests. Its settings, on the other hand, are changed afterwards in the editor, without rebuilding anything (see step 4). The installation takes five steps: declare, build, prepare Home Assistant, import into Node-RED, check.

1. Declare your installation

On the computer that will build the flow:

git clone https://github.com/Isno-Open/victron-dess-3erl
cd victron-dess-3erl
cp installation.example.json installation.json

Open installation.json: each value is commented. Replace them all with yours, in particular:

"gx": {
  "portal_id": "0123456789ab",
  "vebus_service": "com.victronenergy.vebus/275",
  "battery_service": "com.victronenergy.battery/512",
  "solarcharger_service": "com.victronenergy.solarcharger/273"
},
"panneaux": { "latitude": 45.0, "longitude": 5.0, "inclinaison": 30, "azimut": 0 },
"home_assistant": { "url": "http://homeassistant.local:8123" },
"parametres": {
  "CAPA_UTILE_KWH": 10.13,
  "P_CHARGEUR_RESEAU_KW": 3.55,
  "P_PV_CRETE_KW": 4.25,
  "FENETRE_DEBUT_H": 15,
  "FENETRE_FIN_H": 17,
  "FIN_HEURES_CREUSES_H": 6,
  "COUT_USURE_EUR_KWH": 0.0608,
  "PART_PRODUCTEUR": 0.70,
  "SOC_PLEINE_PCT": 100
}

The instance numbers (/275, /512, /273) are those of your devices: they appear in any Victron node in Node-RED, on the “Service” line. This file stays on your side: it is not published.

Your contract tariffs go in tarifs.json, by effective date. An announced increase is declared in advance: you rebuild and deploy once, and it will apply on its own on the given day.

Then check the declaration:

python3 installation.py

A value that is missing, of the wrong type or out of its bounds stops everything, and says which one.

2. Build the flow

node --test test-*.js          # tests first
python3 construire.py

construire.py produces three files:

  • flows.json, the complete flow in seven tabs;
  • flows-courtiers.json, the two MQTT brokers the flow refers to: night_broker (the GX itself) and ha_broker (Home Assistant). It is imported only once, at the first installation.
  • flows-mode-dess.json, the button that hands Dynamic ESS control to Node-RED. It is also used only once.

All the values from installation.json and tarifs.json go to a single place in the flow: its global environment variables, which every tab reads. No node holds them hard-coded, not even the GX identifier or the Home Assistant address.

Before writing these files, construire.py checks the complete flow:

  • every value read by a rule must be declared;
  • no installation value may be left written inside a node.

If a check fails, it does not leave a flows.json behind.

3. Prepare Home Assistant

The flow publishes its decisions to Home Assistant, and reads four values from it. So you need three things on the Home Assistant side.

An MQTT broker, and an account for the GX. Install the Mosquitto broker add-on and the MQTT integration if you have not already. In Paramètres > Personnes > Utilisateurs (Settings > People > Users), create a dedicated user, for example victron-gx: the GX will connect to the broker with this account.

The control package. The repository provides ha/pilotage-energie.yaml: the five values (input_number) and the four automations that measure the solar charger’s start time and what the afternoon window really gains. To install it:

  1. in configuration.yaml, if not already done:
    homeassistant:
      packages: !include_dir_named packages
  2. copy the file to /config/packages/pilotage_energie.yaml;
  3. replace the two sensors marked “À ADAPTER” (TO ADAPT) with those of your Victron integration: the power produced by the solar charger, in W, and the battery state of charge, in %;
  4. restart Home Assistant.

An access token. In your Home Assistant profile, Sécurité (Security) tab, create a long-lived access token, named for example Node-RED GX. Copy it: it is shown only once, and you will need it in the next step.

Without these values, the flow still works: it falls back on estimates, and says so in its reasons.

4. Import the flow into Node-RED

  1. Open the GX’s Node-RED editor. The simplest way is through VRM, from anywhere: Installation > Venus OS Large > Node-RED. VRM opens the editor remotely, with no local address, no port to open on the router and no certificate warning. From the local network, the direct address also works: https://<adresse du GX>:1881 (self-signed certificate, to accept).

    The VRM Venus OS Large page: the Node-RED card opens the GX editor remotely

    The GX Node-RED editor, opened remotely through VRM: the seven tabs of the flow, here the 3ERL source

  2. First installation only: menu ☰ > Importer (Import), choose flows-courtiers.json, then Importer.

  3. Menu ☰ > Importer, choose flows.json, then Importer. Seven tabs appear: Source 3ERL, Carburant (Fuel), DESS nuit (night), DESS matin (morning), DESS fenetre (window), DESS soir (evening), Mesures et historiques (Measurements and history). The settings come with them: menu ☰ > Paramètres (Settings) > Environment tab (“Variables d’environnement globales”, global environment variables) shows them all, one per line (battery capacity, window hours, GX identifier, Home Assistant address…). Check them at a glance.

    The flow's global variables in the GX Node-RED editor, Settings menu, Environment tab: usable capacity, wear cost, battery service and the other settings, one per line

  4. The Home Assistant broker: double-click any “vers HA” (to HA) node, then the pencil next to “Mosquitto de HA” (HA’s Mosquitto). Sécurité (Security) tab: enter the user victron-gx and its password. Mettre à jour (Update), then Terminé (Done).

  5. The Home Assistant token: in the “Mesures et historiques” tab, double-click each of the four “http request” nodes that query Home Assistant: “sensor.sun_next_rising”, “input_number.demarrage_mppt_hier”, “input_number.lever_au_jour_de_la_mesure” and “gain mesure de la fenetre” (measured window gain). Enable authentication, type bearer, and paste the token. It stays in Node-RED’s credentials: it is never written into a file of the repository.

  6. Click Déployer (Deploy).

  7. First installation only: import flows-mode-dess.json (after flows.json: its button reads the GX identifier from the settings), deploy, and click the button to the left of the “Dynamic ESS en mode Node-RED” node. Check on the GX that Paramètres > Configuration Système > ESS > Dynamic ESS shows “Mode : Inconnu” (Mode: Unknown). The “Mise en service DESS” (DESS commissioning) tab can then be deleted.

For an update, repeat only steps 3 and 6: the brokers, the password, the token and the mode stay in place.

Changing a setting later needs neither Python nor a rebuild: menu ☰ > Paramètres > Environment tab (“Variables d’environnement globales”), edit the value, Terminé, then Déployer. All tabs read it from the same place, so they all change together. Also copy it into installation.json: the next import of a rebuilt flows.json would take the value from the file.

5. Check

Within the next few minutes:

  • in Node-RED, each tab shows a green dot and a reason under its nodes: the price read, the computed setpoint, the slots written. A red or yellow dot says what is missing;
  • under each “vers HA” node, “Connecté” (Connected) is displayed;
  • in Home Assistant, the “Pilotage energie ISNO” (ISNO energy control) device appears with its sensors (see the next section).

In Home Assistant

The flow announces what it publishes through MQTT discovery: Home Assistant creates the “Pilotage energie ISNO” device on its own, with its sensors.

The "Pilotage energie ISNO" (ISNO energy control) device created by MQTT discovery in Home Assistant: its sensors (peak-hour need, charge accepted by the BMS, requested night charge, 3 pm charge target, measured consumption…) and recent activity

Each decision arrives there with its reason: which period decided, whether selling is curtailed and why, whether the battery is frozen tonight. When the control does something unexpected, you read why instead of guessing.

One nuance: during the window, the “vente bridée” (selling curtailed) sensor can show curtailment by price while the setpoint lets the surplus go, since the window has its own rule. The setpoint is what counts.

The sensors can then be placed wherever you like on a dashboard. Mine follows the PREP against the selling threshold, the injected power, and what selling to 3ERL has earned.

A dashboard card: the PREP, the selling threshold at €52 per MWh, the injected power, then what was sold today, since the start, and the average price obtained

The same principle, a device controlled by an ESP32 or by Node-RED and followed in Home Assistant over MQTT, is used in other projects on the site: the pellet stove with OpenXtraflame, the roller shutters with OpenProfalux.

The results

The figures of a real month, from 31 October to 29 November 2026, read hour by hour in VRM, at the Happy Heures tariff of that period (€0.245 in peak hours, €0.191 in off-peak hours, €0.037 from 3 pm to 5 pm). November is the worst month for solar: the battery does almost everything.

Over 30 dayskWh
House consumption42614.2 kWh per day
Bought from the grid376€41.22, i.e. €0.110 per kWh on average
of which for the battery, from 3 pm to 5 pm189at €0.037
Supplied by the battery in peak hours186instead of kWh at €0.245
Solar production16765 consumed immediately, 50 stored, 53 sold

The battery’s gain, all included:

€
Purchases avoided (what the battery supplied, at that hour’s price)48.06
Recharging from the grid− 11.75
Wear (€0.061 per kWh out of the battery)− 12.39
Net gain over the month23.92

Without a battery, the same house would have paid €77.52 for these kWh instead of €41.22. Wear takes back a share, and it is counted: a battery that did not pay for its wear would only be moving the expense around. This gain counts the 50 stored solar kWh as free; sold instead, they would have earned about €7.

Wear, the other half of the decisions. In 30 days, 204 kWh came out of the battery: about 21 full cycles, less than one a day, for €12.39 of wear. This cost is not suffered, it is decided: every time a kWh could go through the battery, the flow counts that trip at €0.061 and compares it with what it earns. The month shows two examples.

  • At night, freeze rather than charge. Without counting wear, charging from the grid at night looked like a win: €0.191 off-peak against €0.245 in the morning. With wear, each kWh cost €0.252 to avoid €0.245: a loss. Over 29 nights, the flow therefore froze the battery 10 times, with the house taking the grid at off-peak rates; it let it serve 9 times, when it had enough to last the morning; it charged it 8 times, on dark days, through the second path, so that it would not be empty before the window; it was at the floor the other 2 nights.
  • Sell rather than store. A solar kWh put into the battery in the morning is only worth what it will avoid buying in the window: €0.037. Sold to 3ERL, it earned €0.126 on average. So the flow sold 53 kWh of surplus instead of storing them.

Selling to 3ERL earned €6.51 for 51.5 kWh in November, i.e. €0.126 per kWh on average, according to the 3ERL dashboard, which is authoritative for payment (the flow’s counter estimated it at €7.13 for 52.7 kWh). Little surplus in November, sold only when the price was better than keeping it. Since the start, in October: 114.1 kWh valued at €13.74.

The month includes an outage: from 24 to 26 November, Node-RED stayed in safe mode after a GX reboot (see below), and the control was not running. The figures include it as is.

From 1 December, the Engie tariff increase also makes night charging in off-peak hours profitable: the flow switches to it on its own, and the next update of this section will say what it earns.

What can break

On 24 November, the GX rebooted, and Node-RED came back in safe mode: the tabs were loaded, but none of them was running. No slots were written any more, Dynamic ESS fell back to plain self-consumption, and the battery stopped charging during the window. You can see it in the daily discharge: on the 25th, nothing.

The battery's daily discharge over fourteen days in Home Assistant: around 6 to 12 kWh per day, except on 25 November, at zero

The diagnosis takes one request: the Node-RED API answers {"state":"safe"} instead of {"state":"start"}. Reloading the flows is enough to get going again, but only until the next reboot if the GX is set to “Activé (mode sécurisé)”: that is the setting to change, as explained above. And the general lesson: monitor the state of Node-RED itself, not only what it publishes, since a stopped flow publishes nothing any more, including its own silence.

The limits, and how to adapt it

  • 3ERL is at the heart of the selling decision: the price source, the curtailment requested by the aggregator, the share paid back. With another aggregator, or without resale, you need to adapt the price source and the selling rule.
  • The period times are fixed in the code, for a low-price window from 3 pm to 5 pm and off-peak hours from midnight to 6 am. Another contract requires changing them, and a Tempo or dynamic-price contract requires other rules, not just other values.
  • Pylontech: the balancing thresholds and absorption steps were measured on US3000C units. Measure yours: the template explains how.
  • The battery never sells to the grid: this is enforced in the code. If your contract makes that sale profitable, that is where to step in, knowing what you are doing.

Selling your surplus with 3ERL

All this selling control relies on one particularity of 3ERL: it is one of the few surplus buyers that pays the real market price, quarter hour by quarter hour, and publishes that price through an open interface. That is what the “Source 3ERL” tab queries. With a fixed-price buy-back, there would be nothing to decide.

What the 3ERL-RE association offers, according to its site:

  • 70 % of the PREP paid to the producer, the remaining 30 % covering its operation; during negative prices, no commission;
  • no subscription and no entry fee, payment from the first injected kWh, paid once a year;
  • no imposed supplier: you keep your electricity contract, like the Happy Heures offer here;
  • unsubscribing possible at any time; if you already have a purchase contract, the association handles the change of buyer;
  • negative price alerts, and an interface for those who can curtail their injection automatically, which is what this flow does.

They say it themselves: with a battery, you inject little, and a subscription or entry fees would never pay for themselves. That is exactly the case of an installation controlled like this one.

The author's 3ERL dashboard for November 2026: 51.5 kWh injected, valued at €6.51, day by day; the two days at zero, the 24th and 25th, are those of the Node-RED outage

To join them, you need a declared installation (prior declaration at the town hall, Consuel certificate), a connection in an Enedis area (local utilities are not covered), then registration on their site. Their FAQ details the steps with Enedis. I have no connection with them, other than being a producer with them since October.