Agile Battery & Solar Calculator
I am quite a heavy consumer of electricity at home. This is primarily driven by my lab but having a young son and two golden retrievers means more washing and drying. As a result I am always looking to try and reduce the electrical costs as it’s not cheap in the UK.
Table of Contents
Problem
Sadly my roof isn’t an ideal candidate for solar panels as the south facing part isn’t huge and has some shade, therefore I was looking at other options. I have been an Octopus Energy customer for a number of years, they have become one of the larger suppliers in the UK by offering a wide range of interesting tariffs and good customer support. I am on the “Agile Tariff” which means the price of electricity that I pay varies widely with the price changing every 30 minutes. Despite having some expensive time periods I generally come out ahead. ( I am £178 better off than a tracker tariff over the last 4 months)
I have often wondered if I can make a household battery make financial sense. A lot of the public calculators didn’t really give me the level of information I needed. Therefore I decided to build this Octopus Agile battery calculator. Disclaimer: all of the coding for this project was done by Claude — I can’t take any credit for it and for legal reasons double check the maths.
Below is the typical profile taken from today’s rates. Although the price changes based on demand and generation, typically windy and sunny days are the best. The typical cost profile follows this shape. Generally cheaper electricity most of the day and an expensive period between 4 and 7pm. At the time of writing the Middle East conflict has just started so the prices are higher than typical and the range between the lower and higher rate is narrower than usual.

Code
If you want to skip reading and jump straight to the code on Github
You need Python 3.8 and to add your Octopus API key to the .env file and then run the script.To get your API key just head to your Octopus account dashboard and open Developer settings. When you run the script it will connect to the Octopus Kraken system and pull your historic usage and pricing data in 30-minute chunks. Once it has done this it will generate an HTML file called octopus_battery_report.html next to the python script for easy consumption.
You can also execute the code as a one liner:
python3 octopus_battery_analysis.py --api-key sk_live_yourkeyI have also included a diagnostic script in the repo for troubleshooting API issues octopus_diagnose.py
Report Overview
Usage Summary

This is my usage report, and as can be seen I used 9,615kWh over the last year. For someone with gas heating and no electric cars this is quite high. I could also see this usage increasing. It also shows I had 164 hours at 0 or where Octopus paid me a small amount to use energy. The report then goes into a bit more consumption detail which is fairly self-explanatory.
Agile Rate Distribution

The distribution is important to understand so we can see if we can push our usage to the left with a battery.
The report then goes on to make battery recommendations based on the data with multiple charging strategies. The default strategy is a very simple one: we charge the battery if the charge is ≤10.0p and discharge≥20.0p
Battery Recommendation
The report has details of five of the most common batteries in the UK. Powerwall 2, GivEnergy 9.5kWh, Givenergy 13.5kWh, Sonnen 10kWh, Pylontech 7.4kWh. They all have different capacities and an estimated install cost is also assumed. It then calculates what savings could be achieved with each of these setups with either the default charging strategy or an optimised one.
Based on my usage the payback is never and the 15yr return on investment is very negative. This was disappointing.

What If Calculator
I decided to see if I could improve by simulating some what-if scenarios so I added a slider into the report to take account of the cost of the battery system reducing and the price of electricity increasing. Unfortunately for my use case even if the price of batteries halve and the price of electric doubles it still doesn’t make sense for me to install a battery.
Solar
OK so what if I was to add solar to the mix? This brings another factor to consider as effectively it leads to three strategies, Solar only, Battery only or Solar and Battery. The report will showcase some typical solar installs and calculate the solar generation where the energy would be consumed by my home first and then being exported. It will model several typical solar setups 3, 4 and 6kW and ultimately recommend the most cost effective setup.I was surprised by the answer to this where a 4kW solar system without a battery is what is ultimately recommended. However this still looks like a poor investment for me personally.

SEG – Smart Export Guarantee
The calculator will also include earnings for any unused solar energy. This is an important factor in the calculations
Conclusion
For my current usage neither a battery nor solar panels make a good investment however, I will be reviewing this periodically as the benefits and the price of both solar and battery have changed dramatically in the last couple of years. Hopefully you have a better output from the calculator.





