What does a kilometre in my electric car cost when I use the electricity price that applies while the car is charging? Since I started logging my charging sessions, I have charged 461 kWh at home at an average of DKK 1.07 per kWh. That is 26.6% cheaper than the daily average price. Here is how I built it and what the data shows.
Why do this?
I wanted to understand to what extent it pays to have an electric car. What does it actually cost in electricity? What is the real consumption when I drive? And how much can driving and charging be optimised?
The car's app shows how much energy the car has used, and the power company sends a bill. But neither answers those questions. And the price swings a lot: in the week up to 29 November, the total price ranged from DKK 1.51 to DKK 4.27 per kWh. The highest price was almost three times the lowest. So it matters when the car charges.
The car is also leased with a fixed number of kilometres a year, so I also keep an eye on whether I am driving more than the lease allows.
The setup
It all runs on a Raspberry Pi with Home Assistant at home.
- The car: The MercedesME 2020 integration pulls data from the car several times a day: battery level, range, odometer and charging power.
- The price: The Energi Data Service integration fetches spot prices from Energinet and adds grid tariffs, taxes, the supplier's mark-up and VAT, so I work with the full price per kWh.
- The grid: Eloverblik gives access to meter data from the grid.
- The rest of the house: The solar panels (Fronius), a solar forecast (Forecast.Solar), the heat pump, the weather and a number of smart plugs are connected too, so the car can be seen alongside the rest of the home's energy.
- Data and charts: Home Assistant stores the history in a MariaDB database, and Grafana reads from it to build dashboards and calculations.
The Mercedes, Energi Data Service and Eloverblik integrations are community integrations installed through HACS. MariaDB and Grafana run as add-ons in Home Assistant.
How I calculate
For each charging session, the battery level at the start and end, the charging time and the kWh charged are recorded. The price changes during the day, so the cost is calculated for each time slot in which the car charges:
Actual charging cost = Σ (kWh charged in the time slot × price in the time slot)
Cost at the daily average = kWh charged × the day's average price
Saving = cost at the daily average − actual charging cost
Cost per km = average price per kWh ÷ km per kWh
So the saving shows what it is worth to charge in the cheapest hours instead of at a random time on the same day.
The results
Charging per period
The latest session took the car from 32% to 98% in 5.7 hours. It charged 59.4 kWh, about 10.5 kW on average, and cost DKK 94.85, or DKK 1.60 per kWh.
The session ran after midnight on Sunday 29 November, when the price was at its lowest for the week. Even so, the saving was only 9.6%, because the price was low all Sunday: the day's average was about DKK 1.77, against DKK 2.61 for the week as a whole. The saving is measured against the average price on the same day. Had I charged at the week's average price instead, the session would have cost about DKK 155.
Prices also rise towards winter: DKK 1.07 per kWh on average for the whole period, DKK 1.45 in November and DKK 1.60 in week 48.
Most days I drive short distances, and some days much further. Over the last 14 days it came to 301 km, 22 km a day on average, and the car was charged twice. At 5.43 km per kWh, or about 18.4 kWh per 100 km, a kilometre costs about DKK 0.20 at the prices I have actually paid. At the daily average price it would have been about DKK 0.27.
Does it pay?
To answer the first question, I compared with an equivalent diesel and petrol car over the same kilometres. I used DKK 17 per litre for both fuels and a consumption of 16 km/l for diesel and 13 km/l for petrol.
| EV (home charging) | Diesel (16 km/l) | Petrol (13 km/l) | |
|---|---|---|---|
| Cost per km | DKK 0.20 | DKK 1.06 | DKK 1.31 |
| About 2,500 km covered by home charging | DKK 492 | DKK 2,660 | DKK 3,273 |
| 19,304 km in the lease year so far* | approx. DKK 3,800 | approx. DKK 20,500 | approx. DKK 25,200 |
A kilometre costs about DKK 0.20 in the electric car, against about DKK 1.06 in the diesel car and about DKK 1.31 in the petrol car. Over the roughly 2,500 km covered by home charging, the electricity cost DKK 492, against about DKK 2,660 for diesel and about DKK 3,273 for petrol. Across the lease year so far, the difference is about DKK 16,700 compared with diesel and about DKK 21,400 compared with petrol.
DKK 17 per litre matches the average diesel price over the last six months of about DKK 17.2. In the official figures, petrol averaged about DKK 19 over the last three months, so if anything the calculation favours the petrol car.
Leasing: am I driving too much?
The lease allows 20,000 km a year. The dashboard compares the kilometres driven with what the lease allows to date, quarter by quarter. Kilometres from before I started detailed logging are estimated.
As of 29 November I have driven 19,304 km against 16,548 km allowed to date, 2,756 km over. If I keep this pace, the lease year will end at about 23,331 km, about 3,331 km (16.7%) over the allowance. It is good to know that now rather than when the car goes back.
What I learned
- The car does 5.43 km per kWh, or about 18.4 kWh per 100 km.
- Timing pays. Charging in the cheapest hours has cost me 26.6% less than the daily average price.
- The saving varies. When the price is low all day, there is less to gain within the day. In week 48 it was 9.6%.
- With a big battery you can also choose the day. Measured against the week's average price, the latest session was about 39% cheaper.
- Winter costs more. In week 48 I paid DKK 1.60 per kWh, against DKK 1.07 on average for the whole period.
- It pays. A kilometre costs about DKK 0.20, against about DKK 1.06 in an equivalent diesel car.
- Data gives time to act. The forecast shows about 3,300 km over the lease, and I know it now rather than at handover.
Next steps
The Mercedes is phase one. The goal is a full picture of what it costs to drive electric and how the power is shared across the home.
- Phase 1 – the Mercedes: Price per kWh and per km, the saving from charging in the cheap hours, and driving against the lease. That is what you have read about here.
- Phase 2 – Cupra Raval: From the start of 2027, our Cupra Raval joins the calculations, so I can see what it costs to run two electric cars.
- Phase 3 – the whole house: A full picture of how the power is shared between the cars and the house: heating, cooling and the heat pump. This needs a 3-phase energy meter in the electrical panel, a Meross EM06P, that measures consumption in real time.
Want to do the same?
With Home Assistant, the car, the power price and the rest of the home's energy can be brought together in one place, and charging can be moved to the cheapest hours. You don't need to write code to get started, but a stable network and a well-thought-out setup make a big difference.