Nerdy tool for Calculating Return on Investment for Tesla Powerwall and Solar

9 min readAug 16, 2019


TL;DR — This is a pretty technical and nuanced topic for the layperson, so I’ve bolded the important bits, you can skim at leisure, just dive in at the link below, or drill into the small text if you want to “nerd” out :)

Update 11/9/21: Tool has been updated to allow for importing usage data (grid) and production data (solar) from almost any provider using CSV, as well as to estimate hourly usage based on typical usage patterns when the source data is only daily. Take a look!

Tesla’s Powerwall is a really cool wrapper around household battery backup technology that makes it accessible to consumers and not just hard core nerds and survivalists.

Powerwall 2, image from Tesla

Tesla’s Powerwall is a pretty thing, and a tempting purchase for homeowners. One of the main reasons to purchase a Powerwall is to have battery backup for your home during blackouts. The Powerwall provides uninterrupted power supply to your whole house, and can do so for hours (or days) depending on household use and number of batteries purchased. Coupled with Solar, and it can remove dependency on the Grid for power for long stretches of time.

The Powerwall 2 is not cheap, but there are some (rareish) situations in which the Powerwall can actually pay for itself, in electric bill savings.

The “Wizard of Woz” tweeted a 3 year ROI on his own 2 Powerwalls, likely hyperbole or a VERY strange case

First, it’s important to note that if you own your home and can either get solar panels (or more solar panels), then it’s almost always a better return on investment to buy more solar. Batteries don’t “Produce” anything, and are not perfectly efficient in storage (90% or so). But if your electric provider rules allow it there are a few ways in which you can save money on your electric bill by storing electricity when it’s cheap, and using the battery in place of grid power for running your home.

In all cases, the main mechanism for savings is to be on a “tiered” rate plan of some sort. This means that your power company meters your electricity hourly and charges different rates for usage during different parts of the day.

Often referred to as “Peak” and “Off-Peak” and occasionally a “Non-Peak” or “Shoulder” period between, these rates can vary as much as 0.50 per Kilowatt hour, though a more modest difference of around .10–.20 is more common. The Powerwall can be configured to be in a “Charge” mode during certain hours of the day, and a “Discharge” mode during others.

How much you can save depends on the rules for your power company, and whether or not you have solar (or some other power generation) capability.

  1. Arbitrage (In-Out). (Super Rare) — Some (although I don’t have an example) power companies allow you to charge your battery from the grid during off-peak, and will pay you money to put that power back onto the grid during peak periods for a profit. Powerwall software does not currently support this.
  2. Grid Input Only — (More common) — A configuration that allows your battery to take power from the Grid to charge during off-peak, and use that power during peak in place of the grid during peak usage when possible. This does not allow for putting power back onto the grid for profit, but allows you to save the difference between Peak & Off-Peak power. Note, most companies don’t allow you to do this mode if you have NEM (Solar), and if you could it would prevent you from long term battery backup usage as your battery wouldn’t benefit from solar input.
  3. Solar Input Only — If you have solar it’s likely you are on some sort of NEM (Net Energy Metering) program. In these configurations, you can get paid to put electricity back on the grid, however to prevent arbitrage, most power companies (like PG&E) will allow you to only charge your Powerwall from Solar. This allows you to get savings beyond solar by charging battery during Off-Peak (not much, because this is normally when the sun is down) and Shoulder (More of this, but less delta between peak) periods of the day. You can then discharge battery during peak modes and have some modest savings.

A single Powerwall can range from $4,700 to $6,700 (depending on tax incentives), and installation can be upwards of $2,000. The warranty Tesla provides upholds that the battery will still be 70% effective after 10 years.

Each new Powerwall you buy will provide less savings, as you will only save money (in cases #2 and #3) when your household Peak Usage exceeds the current storage capacity and generation capabilities (in the solar case) of your existing storage and system.

Determining your savings is not straight forward, as it very much depends on hourly usage, production, maximum and average peak household usage and the hours and rates of your power company.

The only real way to get more than a SWAG (Shitty wild ass guess) is to fill in data from your grid power usage (hourly), add hourly solar production data (hourly) to figure out what your actual household usage is, and then simulate the whole year charging and discharging hypothetical batteries, to determine what your new grid usage would be, during which periods and for what rates to come up with savings. For long term investment however, you’ll need to run the same simulation again for each of 10 years, considering that battery functionality decays every year, and that electric rates inevitably go up. This gets a little speculative, however is more accurate than assuming your returns on the first year will remain constant.

Fortunately, I’ve built a tool to make all this as easy as possible for my own case, and hopefully it works in your case as well.

I kind of spent way too much effort on this because my situation (PG&E Power user with Solar) is fairly complex to model, and just got more complex as I added functionality. But I’m pretty proud of the outcome. If it doesn’t work for your use case, shoot me an email and I can try and add support for your region.

Step 1 — Import Grid Usage Data

This is probably going to be the biggest disqualifier (sorry) because it limits the tool to PG&E customers. However if you have some other company send me an email or if you are a developer feel free to modify the code for your own usage in my Github, as the project has been made open source.

For PG&E users, goto the PG&E the website energy usage details page, and scroll down to find the “Green Button” which lets you download your usage data.

Then download a years worth (or as much as you have) of your usage data, exporting to CSV.

Take note of the radio buttons and dates selected (any year will do)

Then, go to my tool:

And upload your CSV.

Step 2 — (Optional) Upload Solar Data

If you have a solar system, then you’ll need to check the NEM box (For Net Energy Metering) this means that your power company pays you for putting electricity back onto the grid. Currently this is at the PG&E rules (You get the same amount of $$ for putting electricity back on the grid as you would pay), but if your company has something more sane or different, let me know or add your own options in github.

Currently, I support importing this data from Enphase Enlighten (slowly as their developer API sucks) or manually via a CSV (Which you can hopefully rig up in Excel).

Step 3 — (Optional) Simulate Solar Production

If you don’t have solar, or like me, want to consider the ROI of adding more in addition to a Powerwall — or (fun hack) just want to see an estimated ROI that you make yourself on Solar alone, I’ll note how to do this below… you can add a fake solar system (or click the do not use button to skip). This utilizes the PVWatts Solar simulation API and will base it off your address (lat long), size of system, type of panels, and roof angle.

Step 4 — Configure Rate Periods

Go to your bill and add information regarding the hours of each of the periods (military time) and cost per kWh. Defaults were for me (EV-A plan with PG&E)

Step 5 — Reality Check

After entering these details (and live updating as you tweak them) you’ll now see the simulation run. First check your bill information.

For the period entered, the Total row “Cost” column should be close to what you actually paid your electric company. There are lots of reasons it could be a little off, as Electric companies have tons of odd ways to add money to your bill, but it likely shouldn’t be less than calculated, or a lot more. Note, if your simulated total cost or simulated total grid use is less than 0, then you likely are considering a solar system bigger than what would be allowed by most power companies (which often have a rule around % of total use that you can make up in production) to protect their own bottom line. Simulated savings here shows just what you’d get in your first year from solar.

Step 6 — Tweak number of Powerwalls

Here you can play around with how many batteries you want to buy. I’ve put in the defaults for a single Powerwall 2 and rough estimates on cost.

You’ll now see what the Powerwall would save you (Powerwall only savings), and if you have a solar simulation, what you’d save in that scenario. This is for the period that you uploaded. It also shows a reality check for your simulation. If you have a solar system, this will show charging from solar production (simulated and real) and should reduce grid use during peak periods (sometimes this number will be negative, but that just means that the solar production would be returning to grid resulting in profit, not that you are transferring from battery to grid). For non-solar setup you’ll see in an increase in grid use during off-peak (your battery would charge full at night) and a decrease in peak-use (this should be non-negative as you won’t have NEM). Let me know if it seems really off, as I don’t have valid test data for these cases yet.

Step 7 — Return on Investment

Entering in all the information about how much money you are planning to spend, including cost of solar system (defaults for Powerwall are based on best info at time from the net). Default power increase is 6% annually, which has been the long term trend in my area.

Now, you can look at the predicted 10 year simulation and return on investment (if any) for your configuration, and tweak away to your hearts content!

My system, I have 4.1k of existing solar production, and am looking at 1 Battery and 4k more solar. 7 year ROI ain’t bad.




Kevin Lohman, Software Engineer, Father, Story Teller, and former US Navy Sailor (who never set foot on a ship)