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

Powerwall 2 Gateway API Documentation

This site may earn commission on affiliate links.
I have 3 x PW2 with no solar. I am using Time-based control and on SRP E27P Time-of Use Demand Plan. Starting this November, there are two peak times per weekday, 5 am to 9 am and 5 pm to 9 pm. So I have to go into the app twice a day and change the peak times since you can only program one peak time on the app. I need help creating a script to make this work automatically. I did read the posts above, but I am not very good with command lines. Can someone give me exact instructions on how to make this work.
 
I have 3 x PW2 with no solar. I am using Time-based control and on SRP E27P Time-of Use Demand Plan. Starting this November, there are two peak times per weekday, 5 am to 9 am and 5 pm to 9 pm. So I have to go into the app twice a day and change the peak times since you can only program one peak time on the app. I need help creating a script to make this work automatically. I did read the posts above, but I am not very good with command lines. Can someone give me exact instructions on how to make this work.

Don't know how to make the API work, but a workaround is described here.

Powerwall Time-Based with 2 peak periods
 
I have 3 x PW2 with no solar. I am using Time-based control and on SRP E27P Time-of Use Demand Plan. Starting this November, there are two peak times per weekday, 5 am to 9 am and 5 pm to 9 pm. So I have to go into the app twice a day and change the peak times since you can only program one peak time on the app. I need help creating a script to make this work automatically. I did read the posts above, but I am not very good with command lines. Can someone give me exact instructions on how to make this work.
If you have a SmartThings hub @Darwin has made an amazing program that will automate scheduling Tesla Powerwall Manager app for the SmartThings Hub - DarwinsDen.com I use it and it automatically changes me from self powered to tbc cost savings with different peak times
 
  • Informative
  • Helpful
Reactions: GenSao and NuShrike
I have 3 x PW2 with no solar. I am using Time-based control and on SRP E27P Time-of Use Demand Plan. Starting this November, there are two peak times per weekday, 5 am to 9 am and 5 pm to 9 pm. So I have to go into the app twice a day and change the peak times since you can only program one peak time on the app. I need help creating a script to make this work automatically. I did read the posts above, but I am not very good with command lines. Can someone give me exact instructions on how to make this work.
You sound like this guy I know named Norm lol
 
Can anyone share cloud api tips locations servers or code used to authenticate with cloud ?

min update 1.50.1 they locked down installer account so the only option for automation appears to be cloud but all my attempts to authenticate fail with SSo mfa challenge

installer now requires toggling power to get a token
 
Can anyone share cloud api tips locations servers or code used to authenticate with cloud ?

min update 1.50.1 they locked down installer account so the only option for automation appears to be cloud but all my attempts to authenticate fail with SSo mfa challenge

installer now requires toggling power to get a token

Edit : I'll respond in the 1.50.1 thread
 
Last edited:
WE finally got it working!!!


Happy to report we migrated our code to cloud automation from local and you can download the newest code here, just change lines 33-35 to your credential for Tesla and let it rip, use at your own risk!
Newest powerwall code – Solar Coder (this code can help you schedule your powerwall if you have double peaks like we do on the SRP powerplan from 5am-9am and 5pm-9pm which as a reminder for Arizona SRP start November 1st)
 
Does anyone have a way to use the api call to get prior days of data?
https://owner-api.teslamotors.com/api/1/powerwalls/{{battery_id}}/powerhistory
This gives me the following JSON. Exactly what I want. But that is only for today. I want prior days.
Example:
"response": {
"serial_number": "321654987321654987321654987",
"time_series": [
{
"timestamp": "2020-11-05T00:00:00-05:00",
"solar_power": 0,
"battery_power": 0,
"grid_power": 561.4320022583008,
"grid_services_power": 0,
"generator_power": 0
},
{
"timestamp": "2020-11-05T00:05:00-05:00",
"solar_power": 0,
"battery_power": 0,
"grid_power": 550.5089950561523,
"grid_services_power": 0,
"generator_power": 0
},
{
"timestamp": "2020-11-05T00:10:00-05:00",
"solar_power": 0,
"battery_power": 0,
"grid_power": 550.9809997558593,
"grid_services_power": 0,
"generator_power": 0
},
{
"timestamp": "2020-11-05T00:15:00-05:00",
"solar_power": 0,
"battery_power": 0,
"grid_power": 550.0899978637696,
"grid_services_power": 0,
"generator_power": 0
},