Open Source Tesla & SolarCity Monitoring Code


There’s been a good amount of interest from the community on how I’ve been able to create a program to automatically track my Tesla energy consumption,and the amount of solar energy my home SolarCity system generates.

Major Mileage TweetI’ve even gotten requests from a number of people asking me to share my code so they can attempt something similar. Well I finally got around to doing so today and will be open sourcing it.

Before I share the repository for the code, just fair warning that I won’t be able to help anyone get things set up, especially for those on Windows. If there turns out to be a common area of confusion, I’ll be sure to clear things up at that time.

As mentioned, this code is open source and free to use by anyone but you’ll be required to understand the programming language (Python), how to install packages, and use git if you want to use this work.

That said, the code can be found over on GitHub:

Solar Generation TweetIn that repository you will see how I set up auto-tweet for my daily mileage and driving efficiency. You’ll also see how I tweet my Solar power generation each day and verify that my car is plugged in each night. The main tools for doing that are in and There’s also a number of helper functions I wrote to assist with tweeting, emailing and retrieving the weather.

I hope by sharing this code it helps the growing Tesla and SolarCity community with creating some unique apps and tools, but most importantly I hope it inspires the greater community to adopt technologies that help our planet.

To Top