Giter VIP home page Giter VIP logo

tesla's Introduction

/google
These scripts are based on Google Apps Script (https://script.google.com/home), which is free!  There are 5 components to this project:

1.  Telemetry.gs - logs data from your vehicle for analysis, e.g. miles, efficiency, battery capacity, etc.
2.  SmartCharger.gs - sends an email if you forget to plug in your vehicle and calculates then sets the optimal charge start time.
3.  SmartClimate.gs - customized scheduling of pre-heating/cooling of cabin and seat heating by day of the week.
4.  Logging.gs - logs error messages in the try/catch blocks.
5.  Email.gs - keeps email sent folder from growing too large.
Additional component:  GoogleSheetScriptEditor.gs - cut/paste contents into a Google Sheet script editor as simple way to get API data.

Google Sheet example:  https://docs.google.com/spreadsheets/d/1662a1ma0Z2cdnkKvn2JWClFGsu-T-QS6NNCyyuyEweA/edit?usp=sharing
The first 3 tabs of the Google Sheet corresponds to the first 3 scripts above.

I created several in-depth videos walking through the functionality and code:  https://www.youtube.com/watch?v=l1pqhlGSuVg&list=PLgiPnlzk2O712gwiTIquUzdfVlzIMyS2M


/python
Ported Tesla Google Apps Scripts to python for more control over functionality and as a backup. Additional scripts for Tesla Energy products that run on local machines as they are writing to InfluxDB and I don't want to open that to the internet. 

1.  Core functions:
      TeslaEnergyAPI.py - API calls for Tesla Energy products
      TeslaVehicleAPI.py - API calls for Tesla Vehicles
      TeslaToken.py - API call for the Tesla authentication flow to retrieve new access and refresh tokens
      TeslaRefreshToken.py - API call to refresh new access and refresh tokens
      GoogleAPI.py - API calls for Google products and services
      Influxdb.py - Access to InfluxDB

2.  Utility functions:
      Utilities.py - Commonly used and helpful tools
      SendEmail.py - Service to send emails
      Logger.py - Central logging service 
      Crypto.py - Encryption and decryption functions for sensitve files
      CheckTokenExpiration.py - Retrieves new Tesla tokens based on expiration date/time
      RemoveTeslaCron.py - Cleans up crontabs that are meant to exist for each specific day
      TruncateEmail.py - Helper function to keep email sent folder from growing
      TruncateLog.py - Helper function to keep central logging from growing

3.  Energy functions:
      EnergyImport.py - Imports data manually when automated processes fail
      EnergyTelemetry.py - Writes all energy data from previous day for Grafana
      EnergyLiveTelemetry.py - Option to write real time energy data for Grafana using Tesla API
      EnergyLocalLiveTelemetry.py - Option to write real time energy data using Tesla Gateway API
      EnergyMode.py - Customizes energy site behavior based on weather

4.  Vehicle functions:
      PreconditionM3Start.py - Triggers car HVAC based on preferences stored in a Google Sheet
      PreconditionM3Stop.py - Halts car HVAC
      PreconditionMXStart.py
      PreconditionMXStop.py
      VehicleTelemetry.py - Write all vehicle data from previous day in Google Sheet
      SmartCharger.py - Calculates and sets charging times to complete at a departure time for 2 EV's
      SmartClimate.py - Sets up crontab for starting the car HVAC based on references stored in a Google Sheet

Here are the packages needed:
  python3-pip
  teslapy
  google-api-python-client
  google-auth-httplib2
  google-auth-oauthlib
  python-crontab
  pytz
  influxdb

tesla's People

Contributors

themonomers avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.