Category Archives: Energy

Monitoring a Victron + Enphase hybrid system with Grafana: what turned out to be useful

A Victron ESS next to an Enphase system is two energy systems sharing one house. Each comes with its own app, and each app is confident about its own half of the truth. To see what is actually going on – where the PV goes, when the batteries cycle, when the grid is touched and at what price – I built a set of Grafana dashboards on my self-hosted stack. This post walks through the panels that turned out to be genuinely useful for monitoring such a hybrid system, and a few traps I fell into on the way.

The dashboard labels are in Luxembourgish; I translate the important ones as we go.

The setup

  • Victron side: 3× MultiPlus-II 48/6500 (three-phase ESS), Ekrano GX, two DIY 16 kWh LiFePO4 packs (EEL V6 Pro with JK BMS, 32 kWh in total), three Victron VM-3P75CT energy meters in the roles grid, loads and PV.
  • Enphase side: 37 IQ8 microinverters on two roofs, AC-coupled on the Victron AC-out, plus two IQ Battery 5P.
  • Data path: Telegraf reads the Ekrano over MQTT into InfluxDB 2 (raw data with limited retention, plus a 1-minute bucket kept indefinitely). openHAB polls the Envoy (per-panel data, Enphase battery) and stores it in its own bucket, together with the day-ahead spot price and the PV forecast. The JK BMS packs are read over an isolated RS485-to-Ethernet converter and published via MQTT, down to individual cell voltages.
  • Frontend: Grafana 13, everything self-hosted, no vendor cloud in the loop (Enphase cloud data is pulled nightly as a backup only).

A word of honesty about the data. Two current clamps are not yet where they will end up: the server circuit currently bypasses the loads meter on one phase, and the Enphase IQ batteries sit outside the PV meter, so Venus counts their charging as household load. Everything that depends on the loads meter – household consumption, autarky – is therefore biased for now, and I left those panels out of this post. What you see below is based on the PV, grid and battery measurements, which are correct.

1. Planning: forecast, spot price, state of charge

The first dashboard is the one I open in the morning. It shows today’s PV forecast against what has been produced so far, the forecast for tomorrow (here: available from 17:55), both batteries’ state of charge, the current spot price and which price source is active. The price feed queries Energy-Charts and falls back to a second source if that fails; the active source is shown so a silent failover does not go unnoticed.

Energy planning dashboard with forecast, SoC and spot price tiles and a 36-hour spot price bar chart
Planning view: forecast vs. production, SoC of both battery systems, and the spot price for the next 36 hours.

Below it, the spot price is plotted against the grid power. The blue areas are export. On the left you see the classic midday surplus at low prices; on the right, the batteries being sold into the evening price peak. The lower chart shows both batteries’ state of charge – note how differently the small Enphase batteries (blue) and the 32 kWh Victron bank (green) cycle.

Spot price versus grid export, and state of charge of Victron and Enphase batteries over 48 hours
Spot price vs. grid power (export negative), and the state of charge of both battery systems.

Since the forecast drives decisions (how much to sell in the evening, how much reserve to keep for a dark day), I track how good it is. The table compares the forecast made the evening before and the one made in the morning with actual production. On sunny days the forecast is decent; on overcast days it is off by a factor of two or more in either direction, which is exactly why the battery strategy must not trust a single forecast.

Forecast versus production for the last 14 days with a table of deltas and factors
Forecast quality: evening and morning forecast vs. actual production, with deltas and ratios per day.

2. PV: per panel and against the sun

Enphase microinverters report per panel, which makes shading and faults visible that a string inverter would hide. The tiles show the last value per panel, grouped by roof (house roof panels 1–13, garage roof 14–37). The Envoy only updates per-panel data about once an hour, so the tiles state how old the last value is.

Tiles showing the current power of each of 37 Enphase panels, grouped by roof
Per-panel power, grouped by roof. At peak, the house roof reaches about 308–318 W per panel, the garage roof about 285–293 W.

The heatmap over time and the per-panel averages are where it gets interesting. The peaks are almost identical across a roof, but the averages are not: panels 14, 15, 20, 21 and 26 on the garage roof average well below their neighbours. Same peak, lower average means partial shading during part of the day, not a defective module.

Heatmap of power per panel over two days
Power per panel over two days. Shading shows up as panels that start late or drop early.
Bar gauges of average and peak power per panel
Average (left) vs. peak (right) per panel. The low averages on panels 14, 20, 26 and others point to shading, not to faulty modules.

The array is deliberately over-panelled: 455 W modules on IQ8 microinverters that deliver at most about 330 W AC each, so 37 × 330 W ≈ 12.21 kW is the hard ceiling. Plotting PV power against the brightness measured on the south façade makes the clipping visible: above roughly 80 klx the maximum (orange) flattens at the clipping line. Over-panelling costs a little at noon in summer and gains a lot in the morning, the evening and in winter, which is what a self-consumption system needs.

PV power, sun position and brightness; PV power binned by brightness with a clipping line at 12.21 kW; PV yield per day
Top: PV power with sun azimuth, elevation and brightness on three façades. Bottom left: PV power per brightness bin, with the 12.21 kW clipping line. Bottom right: daily yield.

3. Where does the PV go?

This was the hardest panel to get right, and the most instructive. The question is simple: of every kWh the roof produces, how much is used directly, how much goes into the Victron battery, how much into the Enphase battery, and how much is exported?

My first version used daily totals: direct use = PV − export − battery charging. It produced days with zero direct use on a 70 kWh day, which is physically impossible. The reason: daily totals cannot tell where energy came from. Two flows were counted twice:

  • Evening battery export. When the Victron sells battery energy into the evening price peak, that energy appears in the export counter – but it had already been counted as PV going into the battery at midday.
  • Battery-to-battery transfers. When the Enphase batteries discharge in the morning while the Victron is charging, the same kWh is counted as charging twice.

The fix is to do the bookkeeping minute by minute (in Flux, joining the Victron 1-minute data with the Enphase battery data): in each minute, export counts at most as much as the PV produced in that minute, battery charging counts at most what is left of PV after export, and the remainder is direct use. Battery export at night and transfers between batteries then drop out automatically. The four parts add up to the PV meter’s energy counter within about half a percent.

Stacked daily bars of PV split into direct use, Victron battery, Enphase battery and export, plus the shares over 30 days
Where the PV went over 30 days: 26 % direct use, 34 % Victron battery, 16 % Enphase battery, 24 % export.

A side effect of building this panel: comparing the old and the new numbers quantifies how much energy is moved around rather than produced. Over three weeks, about 50 kWh of the export counter was battery energy sold in the evening, and several dozen kWh went into the Victron from the Enphase batteries or the grid. Every battery-to-battery kWh passes through two conversions and loses 10–15 %. That is an argument for configuring the two systems so they do not feed each other.

4. Grid: peaks and the 3 kW line

My grid tariff has a reference power of 3 kW; drawing more costs a surcharge. The peak panel shows the highest grid import per day, with a dashed line at 3 kW and red bars above it. The histogram counts minutes per 250 W bin, split into green (up to 3 kW) and red (above): 51 of roughly 41,500 minutes in 30 days. Export shows up to the left of zero.

Bar chart of the daily maximum grid import with a dashed line at 3 kW
Highest grid import per day; red bars exceed the 3 kW reference power.
Histogram of grid power in 250 W bins, red above 3 kW
Minutes per grid-power bin over 30 days. Red: above 3 kW.

The grid operator assesses peaks as 15-minute averages, while these panels use 1-minute averages. A red bar is therefore a warning, not necessarily a surcharge: a three-minute spike may well average out below 3 kW over the quarter hour.

The Victron grid meter also measures voltage, frequency, neutral current and the voltage between neutral and protective earth. These are not needed for energy accounting, but they are cheap early-warning indicators: a slowly rising PEN voltage, for instance, can hint at a deteriorating neutral connection long before anything fails.

Voltage per phase and grid frequency over 30 days
Grid quality over 30 days: 226–234 V per phase, 49.97–50.03 Hz.

5. ESS control: what is the system doing, and why?

When the ESS is steered externally (grid setpoint, minimum SoC, peak shaving), it is easy to lose track of what is currently in effect. One row of tiles mirrors the relevant Ekrano settings, next to the spot price and the grid power. If the setpoint was left at an export value by a rule that crashed, it is visible at a glance.

Spot price versus grid power, 36-hour price forecast, and tiles with current ESS settings
Spot price and grid power, plus the current ESS state: control mode, setpoint, minimum SoC, active SoC limit, peak shaving, limits.

A state timeline shows the system state over the day (discharging, external control, etc.), the AC input source and the grid alarm. It is the fastest way to see whether an automation actually did what it was supposed to do at 18:00.

State timeline of the ESS system state, grid source and grid alarm over 24 hours
System state, grid source and grid alarm over 24 hours.

6. Batteries: throughput, cells, health

Daily charge and discharge energy and equivalent full cycles give a feel for how hard the battery is worked: here about 13–14 kWh per day and 12.6 full cycles in 30 days. The daily SoC range shows how deep the cycles go; in the darker second half of October, the Victron no longer reached 100 % every day.

Daily charge and discharge energy and full cycles per day
Charge/discharge per day (415.7 / 403.1 kWh in 30 days) and full cycles per day (32 kWh = 1 cycle).
Daily SoC range and daily maximum cell spread
Daily minimum/maximum SoC and the daily maximum cell spread.

The 24-hour view combines SoC (Victron and Enphase), pack voltage and the charge voltage limit (CVL) on one chart, with power, current, minimum/maximum cell voltage and cell spread below. With LiFePO4, voltage is almost flat between roughly 20 and 90 % SoC and rises steeply only at the top, so the cell spread is mainly meaningful near full charge – which is exactly where it peaks.

SoC and voltage over 24 hours, battery power, voltage and current, min/max cell voltage and cell spread
24-hour battery view: SoC of both systems, pack voltage vs. charge voltage limit, power, min/max cell voltage and cell spread.

For the EEL packs, the JK BMS data go one level deeper. The overview shows SoC, voltage, current, cell spread, alarms and MOSFET temperature per pack; the bars below show each cell’s deviation from the pack mean. ±5 mV at rest is a healthy, well-balanced pack.

JK BMS overview of two packs with cell deviation from the pack mean
JK BMS overview for both packs and the deviation of each cell from the pack mean.
All 16 cell voltages of both packs over six hours
All 16 cells per pack during a charge. The cells stay together until the top, where balancing has to do its job.

Two panels I would recommend to anyone with a JK BMS. First, the sense-wire resistance per cell: it is the same, symmetrical pattern in both packs (highest around cell 9), so it reflects wire length rather than a bad connection – but a single cell suddenly deviating from that pattern would point to a loosening terminal. Second, the pack data table with throughput, cycles, full capacity and state of health.

Sense-wire resistance per cell for both packs and a table of pack data
Sense-wire resistance per cell, and pack data (throughput, cycles, capacity, SoH).

7. Where does the base load go?

Finally, individual consumers measured with Shelly plugs. In my case the servers and the network equipment run at around 500 W around the clock, roughly 12–13 kWh a day. That is the single biggest lever on the night-time battery drain, and it is also why consumption figures that miss the server circuit are badly off.

Power per device from Shelly plugs and energy per device over seven days
Measured devices: servers, network (with and without UPS), server network and ventilation.

Lessons learned

  • Do not trust daily totals for energy flows. As soon as batteries export or charge each other, only a per-minute calculation tells you where the PV went.
  • Never sum percentages. A legend that showed 2013 % “total” self-sufficiency taught me that one. And an unweighted mean of daily ratios lies too: weight by kWh.
  • Self-consumption in percent rewards a smaller PV array. In kWh, it is the number that matters economically. Autarky in percent is the meaningful ratio.
  • Meters have noise. The PV meter showed 6.5 W at night: CT offset and the microinverters’ filter capacitors, not moonlight. A small dead band (below 15 W shows as 0) keeps the live view honest without touching the stored data.
  • Do not draw lines across gaps for regularly sampled data; show the gap. Values from systems that only report on change (openHAB) are step lines that hold their last value.
  • Two y-axes with the same unit mislead. If both are °C or both are W, use one axis.
  • Know your CTs. Before interpreting consumption or autarky, verify what each clamp actually measures. Mine still need work, and the post shows only what is coherent today.

Stack: Victron Venus OS on Ekrano GX → MQTT → Telegraf → InfluxDB 2; Enphase Envoy and JK BMS → openHAB / MQTT → InfluxDB 2; Grafana 13. All self-hosted.

Renew enphase JWT token

I am fetching my PV data over web calls; my openhab system (webcalls and enphase binding) requests these data from the local enphase gateway. In order for this to work, you need a JWT token from your enphase account. This token is valid exactly 1 year.

Step 1: open a Terminal and get a session ID from Enlighten:

SESSION=$(curl -s -X POST https://enlighten.enphaseenergy.com/login/login.json? \
  -F "user[email]=my@email.com" \
  -F "user[password]=YOUR_ENLIGHTEN_PASSWORD" | jq -r '.session_id')
echo "Session: $SESSION"

This returns a session ID like for example: bd998gh582w15h598b124a65745zz3wl.

Step 2: Exchange session for a JWT. For this you need your Envoy serial number. Get it with this command:

curl -sk https://IP.OF.LOCAL.ENVOY/info | grep -o '<sn>[^<]*</sn>'

This will return your Envoy serial number <sn>123456789012<s/n>.

Step 3: Get your JWT token:

ENVOY_SERIAL="your_serial_here"
TOKEN=$(curl -s -X POST https://entrez.enphaseenergy.com/tokens \
  -H "Content-Type: application/json" \
  -d "{\"session_id\": \"$SESSION\", \"serial_num\": \"$ENVOY_SERIAL\", \"username\": \"my@email.com\"}")
echo "Token: $TOKEN"

Step 4: Verify that it works by querying your Envoy:

curl -sk -H "Authorization: Bearer $TOKEN" \
  https://IP.OF.LOCAL.ENVOY/production.json?details=1 | jq '.production[0].wNow'

It should return a wattage.
Now replace the password in openhab by the JWT token value.

Luxembourg’s smart meter SMARTY

Luxembourg’s smart meter branded as Smarty by the electric grid managing company CREOS allows monitoring your electricity consumption and production as well as your gas consumption. Additionally it allows the grid operator to control certain electrical appliances in your household.

Shedding relays – relais de délestage

If parts of the electricity grid in Luxembourg are becoming overloaded or unstable, the grid operator can remotely command the Smarty smart meter to take action to protect the grid. Smarty can diminish the power of domestic car charging points from 11kW to 7kW. As of writing this, CREOS confirms not using this feature (January 2025).

Smarty can also reduce the power of photovoltaic systems to about a third of the available power, if your PV management system allows this. If not, the shedding relay (FR: relais de délestage) will fully shut down the PV system when asked by the grid operator. It seems that this is currently not used neither by CREOS.

Smarty can also limit charging power of night storage heaters (DE: Nachspeicherheizung, FR: chauffage à accumulation) systems through shedding relays.

Billing

Every 15 minutes, the Smarty transmits to the grid operator (or the third party data collection partner) the average electricity consumption of the last 15 minutes. This is used to bill the quantity of electrical energy that was consumed, as well as the monitoring of the load that you used on the grid.

As of 1st January 2025, every household in Luxembourg is categorised in a power consumption category. Most households are in category 3 kW. Households with electric cars or heat pumps might be categorised into 7 kW or 12 kW categories. The monthly costs depend on the power consumption class that you are in.

If you are in the 3 kW category, and you drag 5 kW from the grid for about an hour, you have to pay additional fees (FR: supplément pour le dépassement), in this case: 5-3=2 kWh, which currently equals to 2*0.1139€ = 0,2278€.

If you use for example a (tea) water heating device that pushes your maximal power consumption over the 3 kW limit for about a minute, the fact that Smarty calculates the average over 15 minutes should assure that this short stepping over your category’s boundaries should not be visible on your invoice.

https://www.creos-net.lu/fileadmin/dokumente/downloads/fr_tarif_electricite_2025.pdf

To find out what your power category is, check your electricity provider’s portal, like myenovos.eu.

Balancing out consumption and production on 3-phase grids

When you are running a balcony power plant (DE: Balkonkraftwerk), you might be interested in how the Smarty manages billing or settlements of electricity production over the three phases. In Luxembourg, a normal household is connected to the power grid on 3 phases each capable of pumping 40A of current.

When you connect such a small photovoltaic system to a power socket on your balcony, it will feed the produced electricity only to the phase where you connected it. But this might not be the phase where your house is consuming most electricity, so you are feeding your produced electricity to the grid and drag the electricity from the grid that you need on the other phase (buying from thew grid is much more expensive then what you get paid for injecting electricity).

But there is good news: the smarty will balance this out (DE: saldierender Stromzähler), as it sums up power consumption on all three phases and power production on all three phases and only considers the difference for billing. Without this, a (mono-phase) balcony power plant is not really interesting for private use.

[Unfortunately I only have oral confirmation of this from an engineer. No guarantee on this information. It might also change over time.]

Monitoring your consumption and production

You have three possibilities to extract consumption and production data from your Smarty smart meter.

(1) By default, Smarty shows the most important values in a 5 seconds rhythm. Additionally: With the green button on your Smarty, you can cycle through the data that the meter gathers. To understand what value is currently displayed, Smarty adds the OBIS code to the display.

OBIS codes

(2) Plug the Smarty+ dongle into your Smarty meter’s P1 port and monitor your data on your smartphone

(3) Connect the P1 port over a serial / USB to a computer and monitor your data using a home automation software like for example openHAB with the help of the DSMR binding.

When using the P1 port, solution 2 & 3, you need to ask the grid operator to give you the P1 decryption key.

Source for most of the information above: https://www.creos-net.lu/en/individuals/practical-info/faq

Some information was confirmed in a telephone discussion with a grid engineer in January 2025. The general disclaimer applies here too, of course!

Optimising warm water management with solar thermal energy

Out of the box, a lot of solar thermal energy installations are not really functioning in a transparent way. It is quite difficult to really know what the installation is doing and how much energy it adds into the warm water reservoir. Our installation, a Buderus gas condensing boiler system (Logamax plus GB162-25 V3) that manages our solar thermal panels, does give some information on the output of the system, but it does not have a unit, thus the numbers are not really directly interpretable, besides seeing if you produced more, less or a lot less/more energy through the solar thermal panels compared to the previous days.

Solar thermal installation’s added energy to the warm water system

After 10 years, our solar thermal installation failed to function for an undefined period of time (we don’t know how the system really failed), including at least one summer. The result was that the solar liquid became very viscous as during the summer months it overheated and boiled in the panels. The result was partially blocked hoses carrying the solar liquid from the roof to the heating system in the basement. Fortunately, some minor flow still was assured so that we could flush the whole system and get rid of most of the solidified liquid that was blocking the hoses. A faulty pump was the reason for this failure.

The Buderus management system showed that the pump was working. What I did not know was, that the display only indicated that it had sent electricity to the pump. It did not get any reliable feedback from the pump indicating if the pump really pumps. So technically, the user is blind and does not really know if the pump is really working or not. After flushing the hoses and panels, as well as installing a new pump, the system was refilled with fresh solar fluid and luckily the system came back to life.

I was then looking for a monitoring solution and find this device from a dutch enthusiast. Its EMS-ESP software helps me render the information from my heating system, including solar thermal panels, visible in my home automation system.

From there started a journey to understand how the heating system works and figuring out how to set it up correctly. To optimise the system, maximise the collection of heat from the sun and minimise gas consumption and heat losses, I worked on the following variables:

  • I augmented the maximal temperature of the warm water, when heated by the solar thermal system. I went up to 80°C (beware that such a high temperature also has side-effects, mainly on the longevity of the appliance). Be careful that your warm water recipient does not feed very hot water into your pipes. The risk to burn yourself, especially for kids, is extremely high. Make sure to have a mixing tap installed (at the exit of your warm water appliance and before your pipe system) that only lets water flow to your house system with a pre-defined maximal temperature, for example 50°C.
  • I reduced the temperature where the gas condensing fills in to heat up the warm water. The lower you can go in temperature, and still have enough warm water at your disposal, the better it is, as cou can use more energy from the sun. Ideally, the boiler is at 45°C each morning so that I have enough reserve to add a lot of heat to it. My gas boiler jumps in when warm water temperature drops to 45°C.
  • I configured the warm water circulation pump so that it only kicks in, when imminent warm water demands from a remote location in the house happen. The circulation pump starts when the light in the shower is witched on. We just have to wait for half a minute to make sure warm water is available in the water collector next to the shower. Having the circulation pump run all day, “extracts” the heat from your warm water reservoir. Without any circulation, my warm water reservoir looses between 0.5 and 0.7°C per hour.
  • To avoid excessive gas consumption, I completely switch off the heating circuit of the gas system during summer months (I only keep the warm water circuit switched onI). Our system happens to consume between 1 and 1.5 cubic-metre of gas even if all heating appliances are shut off an d the outside thermostat communicates to the system that there is no heating needed. This might by a configuration issue, but until now I could not find an issue in the configuration parameters.

Exemplary data on solar thermal energy for hot water

We found it particularly difficult to find objective real life data on the usage of solar heat panels for hot drinking water. Our solar system (installed for for hot water only, not for heating up the house) is configured to allow for hot drinking water temperatures up to 80°C. A (child-)protection is installed so that the boiler will never deliver more than 60°C at all times. The gas condensing heating system only kicks in when the water temperature in the upper part of the water reservoir drops to 45 °C and will stop heating when the upper part is at 55°C. The following examples are based on real data coming out of our system, which consists of a Buderus Logamax Plus GB162-25 v3 gas condensing heater and a Buderus SM300/1 W warm water reservoir.

To better understand how these water heating systems function, feel free to consult this article (in german). The article also shows a graph of the water reservoir with the upper and lower parts and its corresponding heating systems.

  1. Example of heat consumption after showering
1 bath & 2 showers (July 20th, 21°C outside temp at 9:00, sunny conditions, Western Europe)

The above graph (green line) shows that our warm water reserve is at 75°C at 08:45 in the upper part of our boiler. The first chute at 8:45 is due to a bath tub filling, at 9:05 one person takes a shower, at 09:30 a second person takes a shower. The remaining temperature is around 57°C.

Around 9:40, the sun is providing enough heat through the solar heat panels (yellow line) and the lower sector temperature (blue line) in the boiler begins to rise.

  1. Example of the gas heating helping out to provide sufficient hot water

When the water temperature drops in the upper part of the boiler to 45°C, the gas heating will heat this part up to 55°C again. This normally takes around 10 minutes and consumes around 0.2 cubic meter of gas. (To properly measure this, the house heating part of the gas system is manually switched off. The only gas consumption is due to warm water heating.)

Warm water temperature, heated by solar panels and gas heating system (July)

The above graph shows on the green line, above the Day 13 when the gas heating jumps in to heat up the upper part of the warm water reservoir. Over the week’s time shown in the graph, this happened 4 times. We are in July and outside temperatures are mid to end 20s°C and it is sunny.

  1. How much energy will be lost over night, when nobody uses warm water?
Temperature loss over time (due to non-perfect reservoir insulation)

Over 10 hours, from 22:30 to 8:30, the temperature in the upper part (yellow line) of the hot water reservoir drops by 5.5°C. Of cours, the lower part drops quicker, but when using hot water, it is taken from the upper part. So the heat losses are around 0.55°C per hour when the hot water is around 70°C. The losses might vary, if the overall temperature is lower. The higher the overall temperature is (and thus the difference to the room temperature), the higher the loss of heat will be. Around 60°C, we measure 0.51°C losses per hour. These losses cannot be avoided. Any insulation will produce heat losses.