Tesla Powerwall 2 – API interface

Meters / Power output stats

Calling the below URLs does not require authentication. Each will return JSON output with key-value pairs:

GET /api/meters/aggregates

request: curl http://192.168.xxx.xxx/api/meters/aggregates

Full list of discovered APIs – Summary:

 

  • BatterySOC = “/api/system_status/soe”;
  • MeterAggregates = “/api/meters/aggregates”;
  • CustomerRegistration = “/api/customer/registration”;
  • PowerWalls = “/api/powerwalls”;
  • ConnectionStatus = “/api/sitemaster”;
  • Version = “/api/status”;

 

Application

It includes a script which gets the SoC from the gateway, writes the value to a RRD file and an example graph that can be created from the RRD.
http://www.bowmill.net/examples/example.zip

Unpack it to c:\example or change the paths in the script.

createsocrrd.bat will create an rrd db called soc.rrd with one variable socpct
readsoc.ps1 needs to be modified to your GW address and will write the soc value to soc.rrd and after running the PS for a while …
graphit.bat will run rrdtool graph and (hopefully) create soc.png – a 4 hr graph of the soc value.

It uses RRDtool https://oss.oetiker.ch/rrdtool/ Full details of parameters can be found on his site.

If this is your first time running PS scripts on your Windows machine you may have to modify the default execution policy – running Powershell ISE as an admin task and entering Set-ExecutionPolicy RemoteSigned should be sufficient but here Google is your friend.

 

 

Application / Implementation

Sources

Advertisement