Before you run it, you need to create two variables (teslaUserName and teslaPassword). These credentials are used to get a token and authenticate to the server. This script uses unofficial access to the API, so it could break at any time.
I have found lots of interesting uses for the script, such as adjusting charge levels to match solar array output -- with the whole-house energy monitoring, I can make sure that I'm not buying any electricity at a high TOU period. I also have the script calculate how far the car is away from home, which potentially makes for interesting applications in turning house HVAC and lighting on and things like that.
This seems like something that would be trivial to put into a Plugin, but I burned an entire day screwing around with it and made no progress.
- Code: Select all
Updated code at the end of the thread.