I have been playing around with my Tesla Powerwall 2 and Solar install for the last few weeks and managed to get some interesting results using a RESTful sensor against their API which is exposed as:
http://[Tesla Powerwall IP address]/api/meters/aggregates
This provides JSON
To get the latest values I created a number of sensors based on the “instant_power” values for house (load), grid (site), battery and solar. The battery percentage is exposed as JSON at /api/system_status/soe.
Note that my powerwall is on a separate IOT DMZ accessed via an dual homed apache reverse proxy using port 1234
I also created a sensor showing the watts left in the battery based on a 100% capacity of 13.5 kW
Daily aggregate amounts need a value stored from the previous midnight, I used automation to to publish on MQTT the recorded value at midnight and subtracted the current export or imported value for the House, Grid, Solar and Battery.
I have also created a few custom sensors based upon the API - but would be interested on working with someone to develop a complete Powerwall component that incorporates all the logic mentioned into a single component.
Let me know if you’d be interested, I’d be happy to act as a test bed