Code by Scott שאול בן ישוע
Verified Commit 94681c76 authored by Sha'ul ben Yeshua's avatar Sha'ul ben Yeshua 🎗
Browse files

README edits

parent bb25f2b9
Tesla Powerwall 2 - Local Gateway API documentation
======
This is a list of api URLs all from reverse engineer from the local gateway. This is not the [ Tesla Owner API] which you can find here: (https://tesla-api.timdorr.com) with a Python library that works nicely to control a Powerwall 2 here: (https://github.com/mlowijs/tesla_api), which is actively being developed here: (https://github.com/swm11/tesla_api).
This is a list of api URLs all from reverse engineer from the local gateway. This is not the [Tesla Owner API] which you can find here: (https://tesla-api.timdorr.com) with a Python library that works nicely to control a Powerwall 2 here: (https://github.com/mlowijs/tesla_api), which is actively being developed here: (https://github.com/swm11/tesla_api).
Powerwall 2 Web UI
---
The web UI provides ~~an instantaneous~~ a 250-500ms average(?) power flow diagram an access to the wizard.
Hit your local gateway IP with a browser, i.e. _https://powerwall/
Hit your local gateway IP with a browser, i.e. _https://POWERWALL-IP/
You should see something like this:
![GatewayUI](https://gitlab.borgnet.us:8443/sgrayban/powerwall2/-/raw/master/img/TeslaPowerwallGatewayUI.jpg "Gateway Web UI")
Hubitat Elevation Hub (Home Automation)
---
The driver located under [Hubitat/driver](https://gitlab.borgnet.us:8443/sgrayban/powerwall2/-/tree/master/Hubitat) is not open for public use but works for all Tesla Powerwall II systems.
---
**Wizard**
You can hit the _"Login"_ link on this page and go through the setup (be careful what you change in the wizard).
......@@ -30,7 +34,7 @@ Calling the below URLs does not require authentication. Each will return JSON o
_GET /api/meters/aggregates_
request: `curl --cacert cacert.pem https://powerwall/api/meters/aggregates`
request: `curl --cacert cacert.pem https://POWERWALL-IP/api/meters/aggregates`
response: [see sample response here](https://gitlab.borgnet.us:8443/sgrayban/powerwall2/-/raw/master/samples/api_meters_aggregates.json
)
......@@ -58,7 +62,7 @@ _GET /api/meters/site_
Detailed information about the site specific meter.
request: `curl --cacert cacert.pem https://powerwall/api/meters/site`
request: `curl --cacert cacert.pem https://POWERWALL-IP/api/meters/site`
response: [see sample response here](https://gitlab.borgnet.us:8443/sgrayban/powerwall2/-/raw/master/samples/api-meters-site.json)
......@@ -66,7 +70,7 @@ _GET /api/meters/solar_
Detailed information about the solar specific meter.
request: `curl --cacert cacert.pem https://powerwall/api/meters/solar`
request: `curl --cacert cacert.pem https://POWERWALL-IP/api/meters/solar`
response: [see sample response here](https://gitlab.borgnet.us:8443/sgrayban/powerwall2/-/raw/master/samples/api-meters-solar.json)
......@@ -77,7 +81,7 @@ _GET /api/system_status/soe_
This returns the aggregate charge state in percent of the powerwall(s).
request: `curl --cacert cacert.pem https://powerwall/api/system_status/soe`
request: `curl --cacert cacert.pem https://POWERWALL-IP/api/system_status/soe`
response: `{"percentage":69.1675560298826}`
......@@ -91,7 +95,7 @@ Use this URL to determine:
2. How long the powerwall has been set to the running state {in seconds}
3. Is the powerwall gateway connected to Tesla's servers {true|false}}
request: `curl --cacert cacert.pem https://powerwall/api/sitemaster`
request: `curl --cacert cacert.pem https://POWERWALL-IP/api/sitemaster`
response: `{"running":true,"uptime":"802459s,","connected_to_tesla":true}`
......@@ -102,7 +106,7 @@ When site master or the Powerwalls are off, the response is: `{"running":false,
_GET /api/powerwalls_
Use this URL to determine how many power walls you have, their serial numbers, and if they are in sync (assuming more than one powerwall).
request: `curl --cacert cacert.pem https://powerwall/api/powerwalls`
request: `curl --cacert cacert.pem https://POWERWALL-IP/api/powerwalls`
response: [see sample response here](https://gitlab.borgnet.us:8443/sgrayban/powerwall2/-/raw/master/samples/api-powerwalls.json)
......@@ -114,7 +118,7 @@ I have two of the AC Powerwall 2s in the United States. The PackagePartNumber i
_GET /api/customer/registration_
Use this URL to determine registration status. The below shows the results from a system that is fully configured and running.
request: `curl --cacert cacert.pem https://powerwall/api/customer/registration`
request: `curl --cacert cacert.pem https://POWERWALL-IP/api/customer/registration`
response: `{"privacy_notice":true,"limited_warranty":true,"grid_services":null,"marketing":null,"registered":true,"timed_out_registration":false}`
......@@ -123,7 +127,7 @@ response: `{"privacy_notice":true,"limited_warranty":true,"grid_services":null,"
_GET /api/system_status/grid_status_
Determine if the Grid is up or down.
request: `curl --cacert cacert.pem https://powerwall/api/system_status/grid_status`
request: `curl --cacert cacert.pem https://POWERWALL-IP/api/system_status/grid_status`
response: {"grid_status":"SystemGridConnected","grid_services_active":false}
......@@ -147,7 +151,7 @@ password=last 5 digits of your gateway serial number
You can then reset/choose your own customer password, if you want to make it stronger."
request: `curl --cacert cacert.pem https://powerwall/api/system/update/status`
request: `curl --cacert cacert.pem https://POWERWALL-IP/api/system/update/status`
response: `{"state":"/update_failed","info":{"status":["nonactionable"]},"current_time":1422697552910}`
......@@ -204,7 +208,7 @@ Southern California Edison has TOU plan with the following details:
---
_GET /api/site_info_
request: `curl --cacert cacert.pem https://powerwall/api/site_info`
request: `curl --cacert cacert.pem https://POWERWALL-IP/api/site_info`
response: `{"max_site_meter_power_kW":1000000000,"min_site_meter_power_kW":-1000000000,"nominal_system_energy_kWh":13.5,"nominal_system_power_kW":10,"site_name":"Loschiavo","timezone":"America/Los_Angeles","grid_code":"60Hz_240V_s_UL1741SA:2016_California","grid_voltage_setting":240,"grid_freq_setting":60,"grid_phase_setting":"Split","country":"United States","state":"California","distributor":"*","utility":"Pacific Gas and Electric Company","retailer":"*","region":"UL1741SA"}`
......@@ -212,7 +216,7 @@ response: `{"max_site_meter_power_kW":1000000000,"min_site_meter_power_kW":-1000
_GET /api/site_info/site_name_
request: `curl --cacert cacert.pem https://powerwall/api/site_info/site_name`
request: `curl --cacert cacert.pem https://POWERWALL-IP/api/site_info/site_name`
response: `{"site_name":"Home Energy Gateway","timezone":"America/Los_Angeles"}`
......@@ -221,7 +225,7 @@ The site_name value can be changed from the Tesla Mobile app settings.
---
_GET /api/status_
request: `curl --cacert cacert.pem https://powerwall/api/status`
request: `curl --cacert cacert.pem https://POWERWALL-IP/api/status`
response: `{"start_time":"2019-09-23 23:38:46 +0800","up_time_seconds":"223h5m51.577762169s","is_new":false,"version":"1.40.2","git_hash":"14f7c1769ec307bba2ea62355a09d01c8e58988c+"}`
......@@ -234,7 +238,7 @@ _GET /api/logout_
The Gateway Web UI uses this url to logout of the wizard. I assume you can also use this to expire an auth token...(some testing is required).
_This is untested. Question for the community: Does this still work? Soliciting for pull requests! :)_
Request: `curl --cacert cacert.pem -i https://powerwall/api/logout`
Request: `curl --cacert cacert.pem -i https://POWERWALL-IP/api/logout`
Response: `HTTP/2 204
date: Thu, 03 Oct 2019 13:48:10 GMT`
......@@ -246,7 +250,7 @@ _GET /api/system_status/grid_faults_
Not sure what this does...does it list the recent grid failure dates/times?
Request: `curl --cacert cacert.pem https://powerwall/api/system_status/grid_faults`
Request: `curl --cacert cacert.pem https://POWERWALL-IP/api/system_status/grid_faults`
Response: `[{"timestamp":1569976192352,"alert_name":"PINV_a006_vfCheckUnderFrequency","alert_is_fault":false,"decoded_alert":"[{\"name\":\"PINV_alertID\",\"value\":\"PINV_a006_vfCheckUnderFrequency\"},{\"name\":\"PINV_alertType\",\"value\":\"Warning\"},{\"name\":\"PINV_a006_frequency\",\"value\":57.207,\"units\":\"Hz\"}]","alert_raw":432406325129904128,"git_hash":"14f7c1769ec307","site_uid":"xxxx","ecu_type":"TEPINV","ecu_package_part_number":"xxxxx","ecu_package_serial_number":"xxxxxx"}]`
......@@ -255,7 +259,7 @@ _GET /api/sitemaster/stop_
_UPDATE: You need to be authenticated for this command_
This stops the powerwalls & gateway. In the stopped state, the powerwall will not charge, discharge, or monitor solar, grid, battery, home statistics.
Request: `curl --cacert cacert.pem https://powerwall/api/sitemaster/stop`
Request: `curl --cacert cacert.pem https://POWERWALL-IP/api/sitemaster/stop`
Response:
......@@ -268,7 +272,7 @@ _GET /api/sitemaster/run_
_UPDATE: You need to be authenticated for this command_
This starts the powerwalls & gateway. Use this after getting an authentication token to restart the powerwalls.
Request: `curl --cacert cacert.pem https://powerwall/api/sitemaster/run`
Request: `curl --cacert cacert.pem https://POWERWALL-IP/api/sitemaster/run`
Response:
Returns HTTPS Status 202 if request is accepted
......@@ -279,7 +283,7 @@ _GET /api/config/completed_
_UPDATE: You need to be authenticated for this command_
This applies configuration changes.
Request: `curl --cacert cacert.pem https://powerwall/api/config/completed`
Request: `curl --cacert cacert.pem https://POWERWALL-IP/api/config/completed`
Response:
Returns HTTP Status 202 if input accepted
......@@ -305,7 +309,7 @@ Here is an example login using a blank username (none needed) and a serial numbe
Request:
`curl --cacert cacert.pem -s -i -X POST -H "Content-Type: application/json" -d '{"username":"","password":"ST123456789","force_sm_off":false}' https://powerwall/api/login/Basic`
`curl --cacert cacert.pem -s -i -X POST -H "Content-Type: application/json" -d '{"username":"","password":"ST123456789","force_sm_off":false}' https://POWERWALL-IP/api/login/Basic`
Response:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment