Skip to content

Technoguyfication/tesla-metrics-agent

Repository files navigation

Tesla-Metrics-Agent

InfluxDB data source for reporting Tesla vehicle metrics.

Report metrics such as vehicle location, speed, climate control settings, charge rate, and more!

Setup and Installation

Prerequisites:

Choose one of the following deployment methods:

Docker (Recommended)

docker run --name tesla-metrics-agent \
   -e TESLA_REFRESH_TOKEN="See repository readme to obtain your refresh token" \
   -e INFLUXDB_URL="https://your-influx-db.example.com" \
   -e INFLUXDB_TOKEN="your-token-here" \
   -e INFLUXDB_ORG="your-org-here" \
   -e INFLUXDB_BUCKET="tesla-metrics" \
   ghcr.io/technoguyfication/tesla-metrics-agent:master

Or with docker-compose:

version: "3.8"

services:
 collector:
   image: ghcr.io/technoguyfication/tesla-metrics-agent:master
   environment:
     TESLA_REFRESH_TOKEN: "See repository readme to obtain your refresh token"
     INFLUXDB_URL: "https://your-influx-db.example.com"
     INFLUXDB_TOKEN: "your-token-here"
     INFLUXDB_ORG: "your-org-here"
     INFLUXDB_BUCKET: "tesla-metrics"
     VERBOSE: false # If you're having issues, change this to true to output more data
   restart: unless-stopped

Standalone Installation

Bare metal installation isn't supported yet! You can always download the source code yourself and figure it out.

Screenshots

InfluxDB Explorer:

image

Example Charging Dashboard in Grafana:

image

Obtaining a Token

Tesla uses a non-traditional OAuth flow, and currently the easiest way to obtain a token is by using one of the following mobile apps:

You need the refresh token generated by these apps. The access token can be ignored when setting up this software.

If you would like to attempt to get your token manually, please read the following article on how the flow works.

References