Skip to content
API Scraper for pulling Vehicle Statistics from the Tesla Owner API into an InfluxDB + Grafana Dashboards
Python Shell Dockerfile
Branch: master
Clone or download
Pull request Compare This branch is 49 commits ahead, 1 commit behind lephisto:master.
Geczy and gundalow Update README.md
Co-Authored-By: John R Barker <john@johnrbarker.com>
Latest commit ea46ab1 Jul 25, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
data refactor(docker): use data/ rather than rely on /opt Jul 23, 2019
grafana-dashboards Fix temperature not showing in defined variable Jul 23, 2019
grafana-datasources Revert "Revert "Implement a fully-Dockerized setup."" Jan 23, 2019
provisioning First working Docker-Compose Version Apr 15, 2019
screenshots Optimize screenshots, save 64% filesize Jul 23, 2019
scripts feat(docker-compose): add influx healthcheck & template apiscrapers Jul 23, 2019
.gitignore feat(docker-compose): add influx healthcheck & template apiscrapers Jul 23, 2019
Dockerfile Update Dockerfile Jul 23, 2019
Dockerfile.compose refactor(Dockerfile): simplify Dockerfile Jul 23, 2019
LICENSE Initial commit Jan 12, 2019
README.md Update README.md Jul 25, 2019
apiconfig.py Included modified teslajson.py with API Info in apiconfig.py Jan 12, 2019
apiscraper.py Added offline check to reduce polling. Jun 20, 2019
config.py.compose Added Systemd Service file for docker Apr 17, 2019
config.py.dist Added Systemd Service file for docker Apr 17, 2019
dashboard2docker.sh fix(dashboard2docker): mac-compatible sed syntax Jul 23, 2019
docker-compose.yml Update docker-compose.yml Jul 24, 2019
install.sh Update install.sh Jul 25, 2019
requirements.txt migrate to python 3 Apr 13, 2019
srtmread.py Fix lephisto#51 Invalid Field Format Jun 16, 2019
tesla-apiscraper.service Service definition Apr 17, 2019
teslajson.py Removed redundant functionality, saved rpc calls Jan 21, 2019

README.md

Welcome to Tesla API Scraper 👋

Putting an end to handing out the Key for your >$100k car to a third party you don't know.

Selfhosted API Scraper for pulling Vehicle Telemetry from the Tesla Owner API into an InfluxDB visualisation on Grafana Dashboards.

Known to work with Model S, X and 3. Capable of handling multiple Vehicles in one Tesla Account

Driving Dashboard

Install

Paste the following in your terminal

# Enter your email and password to your tesla.com account
teslaEmail=""
teslaPassword=""

git clone https://github.com/Lunars/tesla-apiscraper.git && cd tesla-apiscraper && bash install.sh $teslaEmail $teslaPassword

Usage

After the install you can reach the scraper at http://localhost:3000

Default u/p is admin/admin

Both logfile (apiscraper.log) and the config file (config.py) are mapped outside the Docker container, so you can view / change these whenever you'd like. After changing, just restart the container.

If you ever want to update the stack:

git pull
docker-compose rm --force --stop apiscraper
docker-compose build apiscraper
docker-compose up -d

Migrate from lephisto/tesla-apiscraper to lunars/tesla-apiscraper

If you're coming from the original repo, you can just update your instance to Lunars

git remote rename origin upstream
git remote add origin https://github.com/Lunars/tesla-apiscraper.git
git branch --set-upstream-to origin/master master
git pull

Known Limitations and issues

  • If you narrow down Timefilter too much, and there are no Measurements, you won't see anything in the Graph and Discrete.
  • The Code is far from being clean and in some way spaghetti'ish. This will be cleaned up in future Versions.
  • Boolean Values from the API currently won't show

Some remarks about the APIScraper

  • As stated below, the API is crafted for being used by the IOS or Android app. One challenge was to implement a reliable sleepmode. If the car is awake, the API keeps it awake, as long as requests occur. Once it falls asleep, parts of the API can be called to check the sleep state without waking up the car, however, when the scraper detects that the car doesn't change Values (not driving, not charging), it increases the Poll interval until the Car falls asleep. Once it's asleep it checks the sleepstate every Minute. This ensures, that the stats don't miss relevant portions of rides when the car was just woken up, an issue some other monitoring implementations suffer from.

More Disclaimer

  • Please note that the use of the Tesla REST API in general and the use of this software in particular is not endorsed by Tesla. You use this software at your own risk. The author does not take responsibility for anything related to the use of this software.

Roadmap

  • Multithreaded statpulling
  • Code Cleanup (feel free to send PR :)
  • Move from influxql to it's successor flux, the upcoming query language for InfluxDB
  • Write some Tickscripts for alerting
  • Have a color gradient on geolocation that reflects any metric like speed for instance
  • Improve sleepinitiation

Credits

  • Tesla API Interface forked from Greg Glockner https://github.com/gglockner/teslajson (removed pulling Tesla API Credentials from a pastebin whish seemed fishy..)
  • Things stolen from basic Script from cko from the german tff-forum.de
You can’t perform that action at this time.