ownlife-web-logo
ReviewTeslaOpen SourcePrivacyAugust 28, 20267 min read

Self-Hosting Tesla Data with TeslaMate: A Step-by-Step Setup Guide

Set up TeslaMate on a Raspberry Pi or NUC to log your Tesla's battery, charging, and drive data. Covers Docker Compose, API token auth, vampire drain fixes, and dashboard uses.

Sponsor

Photo by Alexander Shatov on Unsplash

Self-Hosting Tesla Data with TeslaMate: A Step-by-Step Setup Guide

Your Tesla generates a constant stream of telemetry. TeslaMate lets you capture it on your own hardware, with dashboards that surface data the Tesla app never shows you.

If you've owned a Tesla for more than a year, you've probably wondered about your battery's degradation curve, your real charging costs, or how your efficiency shifts between summer and winter. The Tesla app gives you a simplified snapshot. TeslaMate, an open-source project built around Tesla's API, gives you the full picture — logged to a Postgres database on hardware you control, visualized through Grafana, and exportable whenever you want.

I've been running this setup, covered in our earlier guide, on a Raspberry Pi for over a year. This piece is the practical walkthrough: what hardware you need, how to get it running, where you'll hit problems, and what the data actually looks like once it's flowing.

What TeslaMate Actually Does

TeslaMate connects to Tesla's unofficial API using your account credentials, polls your vehicle at regular intervals, and writes the telemetry to a PostgreSQL database. A bundled Grafana instance turns that data into pre-built dashboards covering drives, charges, battery health, visited locations, and efficiency over time.

The key categories of data you get access to:

  • Battery state of charge and degradation tracked over months and years
  • Every charge session with energy added, cost (if configured), and charge rate curves
  • Drive logs with efficiency, elevation, speed, and route mapping
  • Climate and tire pressure readings
  • Vehicle state including software version history, sentry mode activations, and sleep/wake cycles

None of this requires modifying your car. It's all pulled through Tesla's API, the same interface the official app uses.

Hardware and Software Requirements

TeslaMate runs as a set of Docker containers, which makes deployment straightforward on almost anything that runs Linux. Here's what you need:

Minimum hardware:

  • Raspberry Pi 4 (4GB RAM) or any x86 machine with comparable specs
  • 32GB+ microSD card or, preferably, an SSD (SD cards degrade under constant database writes)
  • Stable internet connection

Recommended for long-term use:

  • Raspberry Pi 5 or a small NUC/mini PC
  • 128GB+ SSD connected via USB 3.0 or NVMe
  • UPS or battery backup to prevent database corruption during power loss

Software stack:

  • Docker and Docker Compose
  • TeslaMate (pulls PostgreSQL, Grafana, and Mosquitto MQTT broker as containers)

If you're running this on a Raspberry Pi, use Raspberry Pi OS Lite (64-bit). Skip the desktop environment. You want headroom for the database, not a GUI you'll never look at.

Step-by-Step Setup

1. Install Docker

On a fresh Raspberry Pi OS or Ubuntu install:

curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker $USER

Log out and back in, then install Docker Compose:

sudo apt install docker-compose-plugin

2. Create the Docker Compose File

Create a directory for TeslaMate and add a docker-compose.yml. The TeslaMate project documentation provides a reference file, but the essentials are four services: TeslaMate itself, PostgreSQL, Grafana, and an MQTT broker (Mosquitto).

Set your database password and encryption key as environment variables. Don't hardcode credentials in the compose file — use a .env file or Docker secrets.

3. Authentication and Tesla API Tokens

This is where most people hit their first wall. Tesla moved to a third-party OAuth flow, which means TeslaMate can no longer directly accept your Tesla username and password. Instead, you need to generate Tesla API tokens through Tesla's authentication flow.

TeslaMate handles this through a built-in web interface. On first launch, navigate to http://<your-server-ip>:4000 and follow the sign-in flow. The app will store your access and refresh tokens locally.

Critical detail: Tesla's refresh tokens expire. If TeslaMate loses its token and can't refresh it — because your server was offline for an extended period, or Tesla revoked the session — you'll need to re-authenticate manually. Set up a monitoring alert (even a simple cron job that checks the TeslaMate health endpoint) so you catch token failures before you lose days of data.

4. Start the Stack

docker compose up -d

Grafana will be available at port 3000, TeslaMate's admin interface at port 4000. Default Grafana credentials are admin/admin — change them immediately, especially if this machine is reachable from your network.

5. Remote Access

If you want to check your dashboards away from home, don't expose ports directly to the internet. Use Tailscale or WireGuard to create a private tunnel to your home network. Tailscale is the easier option: install it on your server and your phone, and you can reach Grafana from anywhere without opening firewall ports. It's a common, reliable pattern in the TeslaMate community.

Common Pitfalls

Vampire Drain from Polling

This is the biggest practical concern. TeslaMate polls your car to collect data, and polling prevents the car from entering deep sleep. A Tesla that never sleeps can lose several miles of range per day just sitting in your garage, a dynamic documented in Unit Economics' analysis of Model S energy consumption.

TeslaMate has built-in sleep detection: when it notices the car is idle, it backs off polling and lets the vehicle sleep. But if you've misconfigured the idle timeout, or if other apps (like the Tesla app itself) are also waking the car, you'll see phantom drain.

Fix: Set TeslaMate's suspend settings to allow sleep after 15–20 minutes of inactivity. Avoid opening the Tesla app unnecessarily. If you're tracking drain, TeslaMate's own dashboards will show you exactly when the car is sleeping and when it's being kept awake.

API Rate Limits

Tesla enforces rate limits on its API. Aggressive polling intervals — anything under about 5 seconds — risk getting your tokens throttled or temporarily blocked. TeslaMate's defaults are reasonable, but if you've modified polling intervals, keep them conservative.

Database Growth

A year of logging for a single vehicle produces a database in the low single-digit gigabytes. That's manageable, but if you're running on an SD card, the constant writes will eventually kill the card. Move to an SSD. Set up automated PostgreSQL backups to a separate drive or cloud storage. Losing a year of telemetry data because your storage failed is the kind of mistake you only make once.

Software Updates

TeslaMate is actively maintained, but Tesla occasionally changes its API. When that happens, TeslaMate may break until the maintainers push an update. Pin to stable releases, watch the project's GitHub for breaking changes, and don't update blindly.

What You Can Actually Do With the Data

Once you've accumulated a few months of logs, the dashboards become genuinely useful.

Battery degradation tracking is the standout feature. TeslaMate plots your battery's estimated full charge capacity over time, giving you a clear picture of how your pack is aging. This is data Tesla doesn't surface in the app, and it's valuable both for your own planning and as documentation if you ever sell the car.

Charging cost analysis lets you see exactly what you're spending per kWh across different chargers and times of day. If you're on a time-of-use electricity plan, you can verify that your scheduled charging is actually hitting the cheap rate window.

Efficiency dashboards break down your Wh/mi (or Wh/km) by trip, by season, and by driving style. Over a full year, you'll see clear seasonal patterns — cold weather efficiency drops are dramatic and well-documented, but seeing your own data makes it concrete.

MQTT integration opens up home automation possibilities. TeslaMate publishes vehicle state to an MQTT broker, which means Home Assistant or any MQTT-compatible system can react to your car's status. Trigger your garage lights when the car arrives. Send a notification when charging completes. Adjust your home thermostat based on your car's location.

Why This Matters More Now

Self-hosting your Tesla's data isn't just a hobbyist exercise — recent developments make it more relevant.

The context for self-hosted vehicle data is shifting. Nevada just approved Tesla to deploy up to 5,000 robotaxis in Clark County over the next year, alongside permits for Waymo and Uber, TechCrunch reported. Tesla's Cybercab chief engineer Eric Early told the transportation authority, according to Engadget, that 2,500 units by next year would make the company "extremely happy." As Tesla's fleet becomes increasingly autonomous and data-driven, understanding what your own vehicle is reporting — and keeping your own copy — is a reasonable thing to want.

Meanwhile, security researchers have shown that Tesla's onboard computers can be extracted from salvaged vehicles and booted on a desk, raising questions about what data persists on hardware after a car is sold or scrapped. Self-hosted logging doesn't solve that problem, but it does give you an independent record that you control regardless of what happens to the physical vehicle.

TeslaMate won't appeal to every Tesla owner. It requires a home server, basic Docker knowledge, and a willingness to maintain the setup over time. But if you're the kind of person who wants to understand your car the way you understand your home network, it's the best tool available. The data is already being generated. The question is whether you're the one collecting it.

What's your next step?

Every journey begins with a single step. Which insight from this article will you act on first?

Sponsor