Welcome to Tesla Motors Club
Discuss Tesla's Model S, Model 3, Model X, Model Y, Cybertruck, Roadster and More.
Register

Help with downloaded Powerwall 2 data

Hey all,

I just got 2x Powerwall 2s activated less than a week ago. I downloaded the data from the app, which I believe shows power rate in 5 minute increments. I'm trying to figure out total kWh at base, low peak, and high peak. So I figure, at that rate (for example 2.6 kW), that would be 2.6 kWh if it went for an hour (2.6 kWh / h). So to figure out how much energy I have in 5 minutes that would be 5 min * (1 h / 60 min) * ( 2.6 kWh / h) = 0.217 kWh.

I had Excel do this for every 5 minute increment, and added it all up, and it comes up to about -11.2083 kWh for what I pulled from the grid (or really, sold to the grid). Meanwhile, the app claims 25.7 kWh from the grid.

If I apply this math to the solar, they match up perfectly. What am I missing? Is it only counting power from the grid, and not subtracting power I sold back?
 
I think your math is correct. The five-minute data is 1/12 of an hour (5/60), so kilowatts * 1/12 hr = kWh. I'm not sure of your issue with daily values. I noted that the five-minute PowerWall and grid energy values come in as +/- (depending on whether it is to or from) but the daily value are reported as net values for the day. So if you add up the +/- values, you should get the net for the day.

My experience is that I have done the same Excel calculations with data over about a two-week period and found that the five-minute data (added up to daily totals) was 1-3% different from the daily data. Not a big deal, and could be due to rounding errors in the five-minute data which is only presented to a 0.1 kW accuracy. I imagine the daily data downloaded from the app is more accurate, since they probably accumulate the values in higher accuracy than 0.1 kW internally.

Here is my practical question -- the app allows you to download the data via an e-mail upon request. Do you know if there is any way to automate that process? It gets tedious downloading five-minute data each day, but it appears the five-minute data disappears after two days so if I don't grab it I lose access. I will probably lose interest in seeing the five-minute data eventually, but it seems like it would be an easy upgrade to their app to just have the app send an e-mail every day (or month) with the previous day's (month's) data. And it is fun to see the changes through the day.

Finally, there is one data item I would like to see in the downloaded data, and that is the battery charge state. In my (limited) analysis of the data from my system, it looks like the battery is only giving about 82% round-trip efficiency, but I don't know what state of charge it started and ended with, so I could be off as much as about 25kWh (2x PowerWalls) in the energy. As I get more data, that amount will be less and less significant, so I should see the efficiency approach a final value asymtotically, but it is odd that they don't report the charge state.
 

jboy210

Well-Known Member
Supporting Member
Dec 2, 2016
7,281
4,949
Northern California
I think your math is correct. The five-minute data is 1/12 of an hour (5/60), so kilowatts * 1/12 hr = kWh. I'm not sure of your issue with daily values. I noted that the five-minute PowerWall and grid energy values come in as +/- (depending on whether it is to or from) but the daily value are reported as net values for the day. So if you add up the +/- values, you should get the net for the day.

My experience is that I have done the same Excel calculations with data over about a two-week period and found that the five-minute data (added up to daily totals) was 1-3% different from the daily data. Not a big deal, and could be due to rounding errors in the five-minute data which is only presented to a 0.1 kW accuracy. I imagine the daily data downloaded from the app is more accurate, since they probably accumulate the values in higher accuracy than 0.1 kW internally.

Here is my practical question -- the app allows you to download the data via an e-mail upon request. Do you know if there is any way to automate that process? It gets tedious downloading five-minute data each day, but it appears the five-minute data disappears after two days so if I don't grab it I lose access. I will probably lose interest in seeing the five-minute data eventually, but it seems like it would be an easy upgrade to their app to just have the app send an e-mail every day (or month) with the previous day's (month's) data. And it is fun to see the changes through the day.

Finally, there is one data item I would like to see in the downloaded data, and that is the battery charge state. In my (limited) analysis of the data from my system, it looks like the battery is only giving about 82% round-trip efficiency, but I don't know what state of charge it started and ended with, so I could be off as much as about 25kWh (2x PowerWalls) in the energy. As I get more data, that amount will be less and less significant, so I should see the efficiency approach a final value asymtotically, but it is odd that they don't report the charge state.


There is an API for the Gateway you can use. It is documented at this repo https://github.com/vloschiavo/powerwall2.

I am in the process of using this API in an app that will constantly get information from the gateway. I then write this data to a database. I plan on using this data for reporting and creating Machine Learning models that will make predictions based on past performance in various scenarios.
 
There is an API for the Gateway you can use. It is documented at this repo https://github.com/vloschiavo/powerwall2.

I am in the process of using this API in an app that will constantly get information from the gateway. I then write this data to a database. I plan on using this data for reporting and creating Machine Learning models that will make predictions based on past performance in various scenarios.
That's more ambitious than I planned - I've used that API reference to pull data into a database, but mostly just planing to do some trend analysis and hopefully confirm the performance is as expected.

I wish Tesla would make this an official API just to have some confidence the format won't suddenly change.
 

jboy210

Well-Known Member
Supporting Member
Dec 2, 2016
7,281
4,949
Northern California
That's more ambitious than I planned - I've used that API reference to pull data into a database, but mostly just planing to do some trend analysis and hopefully confirm the performance is as expected.

I wish Tesla would make this an official API just to have some confidence the format won't suddenly change.

No one can guarantee the format will not change. I have been doing software engineering for decades and every time I heard that promise made it was broken.
 
No one can guarantee the format will not change. I have been doing software engineering for decades and every time I heard the promise made it was broken.

It's true, but if it was official, there is more chance it won't be sudden and/or they might support the old APIs for a time.

Overall, it is one thing that is too bad is that Tesla doesn't provide supported, non-proprietary ways to interact with the system. It's the same issue I have with our thermostat - has some cool features but limited support for 3rd-party integration, like SmartThings.
 

jboy210

Well-Known Member
Supporting Member
Dec 2, 2016
7,281
4,949
Northern California
It's true, but if it was official, there is more chance it won't be sudden and/or they might support the old APIs for a time.

Overall, it is one thing that is too bad is that Tesla doesn't provide supported, non-proprietary ways to interact with the system. It's the same issue I have with our thermostat - has some cool features but limited support for 3rd-party integration, like SmartThings.

The best thing to do is create a separate library the handles communication with external devices like the Gateway. That isolate any changes to a small area of the code.
 
The best thing to do is create a separate library the handles communication with external devices like the Gateway. That isolate any changes to a small area of the code.
Sure - and really all I'm doing at this point is requesting data every minute and writing it to a database, so in principle an easy change, as long as they don't decide to no longer expose certain data. (I still haven't entirely decided what use to make of this data, but at least it is being collected.)

I just feel like for there to be more reliable options for integration with home automation or other advanced integrations, support from Tesla in the form of an official API or integration would be very helpful.
 

jboy210

Well-Known Member
Supporting Member
Dec 2, 2016
7,281
4,949
Northern California
Sure - and really all I'm doing at this point is requesting data every minute and writing it to a database, so in principle an easy change, as long as they don't decide to no longer expose certain data. (I still haven't entirely decided what use to make of this data, but at least it is being collected.)

I just feel like for there to be more reliable options for integration with home automation or other advanced integrations, support from Tesla in the form of an official API or integration would be very helpful.

I am in the same mode, just collecting data. Also using this as a bit of a learning exercise to sharpen my Python skills, especially in working with databases and json data.
 
I am in the same mode, just collecting data. Also using this as a bit of a learning exercise to sharpen my Python skills, especially in working with databases and json data.
I definitely don't do much coding any more these days, so decided to (re-)learn some of the Java I haven't touched in forever, along with Google's gson library, which saves some time handling the json data. Shoving it into a MySQL database for future use.
 
In a similar boat. Wrote a script to download data from both the TEG API locally and the TeslaAPI online, dumping it to a MySQL DB. Have also been playing with the PW Dashboard. Links for reference below.

Tesla API
vloschiavo/powerwall2

liveaverage/docker-powerwall-dashboard
rhodesman/teslaPowerDash

Reason for using both local and online Tesla APIs is I seem unable to auth to the local one to get privileged info and wanted the value for total_pack_energy to track degradation over time.

Also, retrieving data locally from the two SMA SunnyBoy inverters into MySQL.
 

aesculus

Still Trying to Figure This All Out
May 31, 2015
4,971
2,893
Northern California
No one can guarantee the format will not change. I have been doing software engineering for decades and every time I heard that promise made it was broken.
Tesla seems to go out of their way at times to violate this. For example they assign unique IDs to superchargers which is great and expected. Then for some reason they just change the ID's for the same locale or even worse, reuse the ID at another physical site, even while the original site is still active and has gotten a new ID. Unbelievable. I cannot understand why internally there is not a means to trap and deal with these issues. I suspect a lot of in house grumbling goes on.
 

About Us

Formed in 2006, Tesla Motors Club (TMC) was the first independent online Tesla community. Today it remains the largest and most dynamic community of Tesla enthusiasts. Learn more.

Do you value your experience at TMC? Consider becoming a Supporting Member of Tesla Motors Club. As a thank you for your contribution, you'll get nearly no ads in the Community and Groups sections. Additional perks are available depending on the level of contribution. Please visit the Account Upgrades page for more details.


SUPPORT TMC
Top