A strange decision
One afternoon in September, at five o'clock, my system did something strange. Right then, a kilowatt hour from the grid cost 98 cents. I'm on a dynamic tariff, and the price can change every 15 minutes. So the system switched off the heat pump and fired up the gas boiler instead.
- Grid price98 ct/kWh
- Battery99 %
- Heat pumpOFF
- Gas boilerON
Sounds sensible: electricity expensive, gas cheaper. Except for one detail. The battery was 99 % full. The heat pump could have run entirely on the battery and the sun. I only spotted it by chance: the energy flow on my dashboard showed gas while the sun was shining.
So what went wrong? Was the system looking at the price in the wrong place? Or did it have no current price at all? To answer that, we need a question that sounds simple but isn't: when is electricity actually cheap?
The price that really matters
More precisely: what does one kilowatt hour from my battery cost? Because that's the electricity my house actually uses. If the system gets that number wrong, it makes wrong decisions. In my case: 69 hours of them in a single month.
A quick look at my setup, because it matters here. My house mainly runs on the battery, or straight on solar while the sun shines. The battery is filled by the solar panels, and in winter, when the sun isn't enough, it can be topped up from the grid. So there are exactly two ways for energy to get into the battery, and they cost very different amounts.
The battery is an account
The trick is to treat the battery like a bank account. Every kilowatt hour that goes in brings its price with it. Solar costs nothing, because the panels are already paid for. Grid electricity costs whatever I actually paid for it. That gives the stored energy a value in money, and that value helps decide between heat pump and gas.
The price of one kilowatt hour in the battery is then simply what the contents cost, divided by how much is in there.
Battery price = cost of the contents ÷ energy in the battery
Let's do the maths
Let's do the maths with example numbers. Yours will differ, the logic won't. Say the sun puts 10 kWh into the battery, at zero cost. Then, on a dark day, 5 more kWh come from the grid at 30 cents each. That's €1.50.
| Energy | Price | Cost | |
|---|---|---|---|
| Solar | 10 kWh | 0 ct/kWh | €0.00 |
| Grid | 5 kWh | 30 ct/kWh | €1.50 |
| In the battery | 15 kWh | €1.50 |
€1.50 ÷ 15 kWh = 10 ct per kWh
- Solar 10 kWh · 0 ct
- Grid 5 kWh · 30 ct
Taking energy out doesn't change the price
Now the house uses 10 kWh. What happens to the price? Nothing. It stays at 10 cents. There are 5 kWh left, worth 50 cents.
| Energy | Price | Cost | |
|---|---|---|---|
| Before | 15 kWh | 10 ct/kWh | €1.50 |
| Taken out | −10 kWh | 10 ct/kWh | −€1.00 |
| Left in the battery | 5 kWh | €0.50 |
€0.50 ÷ 5 kWh = still 10 ct per kWh
- Solar 3.3 kWh · 0 ct
- Grid 1.7 kWh · 30 ct
Think of a jug of lukewarm water. Pouring some out doesn't make the rest warmer or colder. The mix stays the mix.
Only adding changes the mix
Another 5 kWh come from the grid, again at 30 cents. That's €1.50 more.
| Energy | Price | Cost | |
|---|---|---|---|
| Already in the battery | 5 kWh | 10 ct/kWh | €0.50 |
| Grid | 5 kWh | 30 ct/kWh | €1.50 |
| In the battery | 10 kWh | €2.00 |
€2.00 ÷ 10 kWh = 20 ct per kWh
- Solar 3.3 kWh · 0 ct
- Grid 6.7 kWh · 30 ct
Every expensive top-up from the grid pushes the price up. Every sunny day dilutes it again.
Almost zero, and correct
Which leads to a number that looks like a bug. In summer, when the battery is filled almost entirely by the sun, the price drops to something like a hundredth of a cent per kilowatt hour.
It isn't a bug. It's the correct answer: the energy in the battery really did cost almost nothing.
Two wrong fixes
A number that small looks suspicious. I write the code with an AI, and twice the AI tried to “repair” this number. I followed along and judged the results. Both repairs sounded perfectly reasonable.
- Fix 1: use the grid price instead. But the current grid price is a price I don't pay. At that moment the electricity came from the battery, not the grid.
- Fix 2: use what the energy could have earned elsewhere. That only makes sense if you could sell it. In this example there's no feed-in payment, so there's no second price to compare with.
Both were wrong. The real cost is what went into the account. Nothing more, nothing less. Battery wear isn't in this price either, on purpose: when I tried adding it once, it pushed my system towards gas instead of almost-free solar.
Heat pump or gas?
Why does this matter so much? Because of decisions like the one at the beginning. With one kilowatt hour of electricity, a heat pump delivers several kilowatt hours of heat, most of it taken from the outside air. That factor is called the COP, the coefficient of performance. With a COP of 3, one kWh of electricity delivers 3 kWh of heat. The COP isn't fixed: on warm days it goes well above 6, and I've measured up to about 7.5. In the cold, at −6 °C, it drops to around 2.5.
Heat price (heat pump) = electricity price ÷ COP
The gas boiler has a kind of COP too: its efficiency, about 0.97. So gas heat has its own price per kilowatt hour of heat:
Heat price (gas) = gas price ÷ efficiency
Whichever is cheaper wins. Let's plug in numbers: winter, COP 3. My real values around freezing are between 3 and 4, but 3 keeps the maths simple. Gas heat costs me around 10 cents, without the standing charge.
From the battery, the heat pump wins by a factor of three. Now the same winter, but the battery is empty and has to be refilled from the grid at 42 cents. Then battery electricity costs around 42 cents too. Divided by three, that's 14 cents per kilowatt hour of heat:
Now gas is clearly cheaper. So “heat pump or gas?” has no fixed answer. It depends on where the electricity would come from, and what price it carries.
The tipping point
You can even calculate the electricity price at which the heat pump starts to lose: the price of gas heat times the COP. Below it, the heat pump wins. Above it, gas does.
Tipping point = gas heat price × COP
In winter, with a COP of 3, the heat pump only loses once electricity costs more than about 30 cents. In mild weather, with a COP of almost 6, the line is at about 60 cents. A battery at 10 cents doesn't even come close.
Over a whole week in an example home, it plays out like this: on sunny days the battery price stays near zero and the heat pump does all the heating; after grey, cold days and a night-time top-up from the grid, the price climbs, gas wins in the coldest hours with a low COP, and once the sun comes back, the price falls again.
69 hours → 0 hours
Now the mistake from the beginning makes sense. The old rule only ever looked at the grid price. At five that afternoon, it saw 98 cents and blocked the heat pump. Yet the battery was 99 % full, and the heat pump could have run on it for a fraction of a cent per kilowatt hour. So the system did have a current price. It just looked at the wrong one: the grid's instead of the battery's.
Over 30 days, that rule blocked the heat pump for 69 hours. In every single one of those hours, the battery was more than 60 % full. More than 60 % full, and still blocked. With the right price, it would have been zero hours.
Same 30 days (19 August to 18 September, 728 hours of data): the lowest charge level in those 69 hours was 64 %. The 0 hours are recalculated from the same data, not measured. And if the battery had been empty, the new rule would have blocked those hours too, because then the grid price really would have been the price of the source.
The rule
Where would the electricity come from right now? Then use the price of that source.
This applies to any price decision in a house. Not the price on the news. Not the price that feels right. The price of the source.
And in your house?
The account works for any battery. Two details depend on your setup:
- If your system feeds electricity into the grid, the feed-in payment you give up by storing is a real price. Then solar isn't free in your account: it costs what you could have sold it for. Without a feed-in payment, as in this example, it really is zero.
- This example leaves out losses and wear on purpose. Charging and discharging cost a noticeable share of the energy, often 5 to 15 percent, and every cycle ages the battery a little. Both are real, but they're a topic of their own, and they don't change the principle.
Outlook: grid charging
Which leads to the obvious next question: when is grid electricity cheap enough to fill the battery? That's trickier than it looks.
- Since October 2025, the day-ahead market, where electricity for the next day is traded, sets its own price for every quarter hour: 96 a day.
- Prices for tomorrow only arrive in the early afternoon.
- So you never see more than about a day and a half ahead.
- When the price you actually pay is zero or below: an easy yes.
- Everything else: only if the battery would actually run short.
That's the topic of a later episode: Grid charging in winter: never just fill it up.
Summary
- The battery is an account: solar goes in for free, grid electricity at what you paid.
- Taking energy out never changes the price. Only adding does.
- For every decision, use the price of the source the electricity would actually come from.
Measured values (98 ct, 99 %, 69 h, 64 %, COP, gas heat about 10 ct) come from the running system and are rounded. The kWh amounts and the 30 ct and 42 ct in the worked examples are example numbers.