Calculating PV System (Solar) Payback in Home Assistant

There are a bunch of threads about calculating your energy bill after getting solar, but many involve reverse engineering the energy company’s billing system and then applying that to your production. I originally went down this path of building out a complicated spreadsheet and then tried to bring that into Home Assistant (HA) so it could accurately calculate my bill. Now after a year since my solar install, I’ve seen my energy company change my TOU rates and fixed costs multiple times, which requires reworking the spreadsheet and if I had figured out how to do that in HA, I’d be doing more work there…

Here’s my simple workaround to focus on what I really care about and answer these questions - how much has my system returned on the investment and when will it be fully paid back?

I’m thinking about this in 4 steps:

  1. Get HA to track the information the easiest way possible by ignoring inflation, changing rates, time value of money, etc.
  2. Automate further and remove manual processes where I can.
  3. Forecast the expected payback date.
  4. Factor in inflation, changing rates, and time value of money.

I’ve only completed step 1 at this point, but I’m sharing what I’ve done to see if others have either already figured this out or if there are any suggestions for improving what I’ve put together.

Step 1 needs to focus on a few variables to determine what I saved by having solar and deduct that from what I paid to determine how much is remaining to be paid back. Here’s an example with some simple numbers:

  • Investment Cost = $20,000
  • Energy Consumed (Amount of home energy use since install date) = 2000 kWh
  • Cost of Energy without Solar = $0.20/kWh
  • Energy Bill Total (Amount paid to energy company since install date) = $100
(Energy Bill Total) - ((Energy Consumed) x (Cost of Energy without Solar)) = Amount Towards Payback
($100) - (2000 x $0.20) = -$300 Towards Payback

(Investment Cost) + (Amount Towards Payback) = Amount Remaining to Payback
($20,000) + (-$300) = $19,700 Remaining to Payback

Investment Cost and Cost of Energy without Solar are static numbers since for Step 1 we’re ignoring the time value of money, inflation, another other factors for now.

Energy Consumed can come from whatever sensor you have in Home Assistant that measures this (e.g. Tesla Powerwall would use sensor.powerwall_load_import) from the time of install to today, which can be gathered from a SQL query on the sensor.

Energy Bill Total is the tricky and annoying one depending on how to get this information into HA. Since there is no existing connection to my energy company to automatically dump billing data and I haven’t figured out how to scrape emails and insert that data automatically, I’ve created two Helpers to track of this information.

* input_number.monthly_energy_bill → this requires a manual monthly input of the amount paid to my energy company.
* sensor.running_energy_bill_total → this is a utility meter that calculates the total paid based on each entry to input_number.monthly_energy_bill.

Now it comes down to calculating and showing this information in Home Assistant. I’m currently using Grafana as the Energy Consumed value is using a SQL query based on time and I haven’t found a good way to automatically pull this information as a sensor in HA and calculate. So for Step 1, I now have to manually input a number into a sensor monthly and then open a Grafana dashboard to adjust the dates to show what my current payback status is.

I recognize much of this is specific to my scenario, but I’m sharing in case it’s helpful, others have already done this better, and/or there are suggestions for how I can improve this project.

2 Likes

and using a utility sensor did not work…for some reason it started compounding the values even though no changes were made to the input number…since the utility meter requires a template sensor, each time template entities are refreshed, it re-calculates it…

back to the drawing board.

for years i’ve been doing these calculations through excel, if i can do this in HA, it will save me SO much time! Sadly, i’m not overly proficient in HA just yet.

I have two inverters, solis and solaredge - both have energy generation data going to HA, solaredge also has a usage meter, which comes in the form of “sensor.solaredge_imported_energy”.

On the energy dashboard, HA is then able to calculate the consumed solar based on the difference between the sum of energy generated less the energy exported, however i cannot find that value represented as an entity in HA.

In my manual calculations, I calculate the energy bill without solar, less the actual energy bill. So calculate the cost of what you self-consumed, plus the cost of what you imported and any daily service charges - that figure gives you what the bill would’ve been at the tariff you’re currently on. Then the delta between that and my actual bill becomes the ROI or Payback.