I’ve written about various tools i’ve built to monitor my Tesla and my SolarCity power generation over the last year and about the automation i’ve done around these areas with automatic tweets, email reports etc. The interest and response from the community has been great.
A number of people have also asked me to share the code so they can do similar things for their own purposes or build upon what i’ve done and i’ve finally gotten around to doing that.
Before I share where you can find the code, just a warning that I won’t be able to help people get things set up and going in all their various environments, especially those of you on Windows. If I find some common areas of confusion i’ll try to clear things up but this is freely available code as a sample and you’ll have to know the programming language (Python), how to install packages, use git, etc. if you want to use this work.
Ok with that said, the code can be found over on GitHub:
In that repository you will see how I do things like auto-tweet my daily mileage/efficiency, how I tweet my Solar power generation each day, check that my car is plugged in at night etc. There are the main tools for doing that (tesla.py and solarcity.py) and then a number of helper functions to assist with tweeting, emailing, getting the weather etc. which could be used for other things too.
I hope by sharing this code it helps the growing Tesla and SolarCity community and continues to drive the adoption of these amazing technologies that also help our planet.
Awesome stuff! Just got this up and running yesterday. Going to install on Linux vm soon and test and then perhaps get this going on an EC2 instance and try it out with a headless browser. Thanks again! Really fun stuff.
Great! Wasnt sure if anyone was using it. Good to hear from someone on it. Let me know if you have any questions.
Really cool. i’m going to see if i can get this up and running. Currently I am using a custom php form to input data in a mysql database and then utilize Grafana to visualize. This could really make my life easy. I’ll have to look into changing your code to send to a database, but you’ve done most of the heavy lifting.
Does this code still work? Seeing this on a new install today..
2018-09-12 21:34:36,597 : DEBUG : get_daytime_weather_data :133 : cloudCoverage Day: 51%, Cloud Coverage daytime average: 43%
2018-09-12 21:35:08,719 : ERROR : :618 : Exception encountered
Traceback (most recent call last):
File “./solarcity.py”, line 614, in
File “./solarcity.py”, line 588, in main
if production > data[‘data’][production_max][‘production’]:
Latest in github is what i’m running and is working for me.
Has anyone been able to get something similar working for the Powerwall & Tesla Energy Gateway setup?
It seems Tesla may be phasing out the Powerguide at some point and therefore this wouldn’t be a future proof solution.
If anyone has a Powerwall/TEG solution for logging data and is willing to share that would be great.
The unofficial tesla API has powerwall options:
These don’t work on SolarCity installations.
Jason William said:
Solarcity is switched to Tesla APP. The codes dont work any more.
I’m still using this package daily with no issues.