Tesla Powerwall Logging



My first bash at webCoRE. (Wish you could just type the code…)

Building on the work of bthrock

Here’s two pistons, one authenticates with the Tesla API and refreshes that as required, and the other logs energy data from the Powerwall to a Google Sheet and Fuel Stream. It also sends a push notification when Powerwall is full and if there has been consistent solar export to grid for more than 5 minutes. (Why doesn’t the Tesla app do this?)

To setup your Google Sheet for logging, follow instructions here

Tesla API Access

BUG: statement #43 should be “is different to” not “is greater than”


Good expansion. Have you been able to weed out any additional functionality of the API? I’m trying to work through determining when power goes out so that I can have SmartThings turn off non-critical devices (outside lights, charging stations, aquarium pumps) via plug-in switches when the powerwall is feeding the house


Whether the PW is in backup mode or not is included as part of the status response from the API. If you output the full response to the debug console, you’ll soon see all the options.


Yup. That and postman are how i have been playing with what has been discovered but kind of hard to replicate some of the statuses. Really wish Tesla would release some official API documentation. I understand being cautious with the automotive side, but solar and wall are hard to break.


Hi there Robin

Thanks for posting the Tesla API details for the PowerWall. This will prove to be really useful when I can get it to work!

Just two quick questions:

  1. I have three PowerWalls attached to my Tesla account. When I run the first script everything seems to run OK and we get data back - including a PowerWall ID. I wonder if it’s possible to list them all.
  2. When I run the second script I notice that the GET URLs are empty. I’m guessing that’s not good so can you help me out with what should be in there?

Many thanks


You need to do a call to /api/1/products first to get a list of all products on the account. The response will give you the correct IDs that you need to use to query each Powerwall . If you have more than one Powerwall on the same gateway, you might want to look at what
/api/1/energy_sites gives you too. Then query /api/1/energy_sites/[YourEnergySiteID].


No, I have more than one gateway, each with a single powerwall on my account


Hi there Robin

Many thanks for putting this together. I managed to negotiate the API and am now getting good results back in the form of data into the piston. I’ll complete the logging setup today and then we should be good.

It also helped answer a question for me - some months back a “phantom” PowerWall appeared in my app and as I swipe it will appear and then error. When I interrogated Products I had 4 items returned instead of the three which I expected.


Well I have put this all together and the only data I get is the battery charge. In the second piston where there is a get command it remained empty so I pointed it to the teslaApiUrl. I notice in yours you have TeslaApiUrl and powerwalls and @powerwall_id but when I Enter that under get as an expression I get an http error. Any ideas?