Tesla Powerwall Controls

The official integration of the Tesla Powerwall (https://www.home-assistant.io/integrations/powerwall/) is great and I use it to get live stats, however this has no control of powerwall functions - I would like to be able to set the powerwall to Backup mode when my electricity is cheap, then back to self consumption when it is not. Using the local API for this is apparently unreliable, but someone has documented the public App service API here on github and specifically the energy.py file has lots of comments showing use of the API with the powerwall. I’ve never written a HA integration and my python isn’t very good else i would try and integrate this directly.

Ideally this could be integrated into the official tesla extension, as an optional “add your tesla credentials for full powerwall controls” rather than just the IP of the gateway for monitoring. You can also pull stats from the public API, which would be great for people who’s powerwall is not on the local network.

Don’t forget to vote for your own request.