Self-hosted service
teslamate-org/teslamate avatar
teslamate-org/teslamate

TeslaMate: Self-Hosted Tesla Logging With Postgres, Grafana and MQTT

A self-hosted data logger for your Tesla 🚘 [main maintainer=@JakobLichterfeld]

8,990 stars1,004 forksElixirAGPL-3.0

At a glance

What is it?
TeslaMate is an Elixir application that polls the Tesla API, writes vehicle telemetry into Postgres, publishes it over MQTT and ships Grafana dashboards for it. The trade-off is operational: you own the database, the dashboards and the upgrade path.
Who is it for?
Adopt TeslaMate if you already run Docker and Postgres somewhere and want vehicle telemetry you can query with SQL instead of exporting CSV from a vendor portal. Do not adopt it if you want a managed service, a mobile app, or a logging setup you never have to patch.
Can I use it commercially?
Yes, with strict conditions. AGPL-3.0 is a network copyleft licence: if people use a modified version over a network, for example as a hosted service, you must offer them its source code under the same licence.
Is it still maintained?
Yes. The repository last received commits 4 days ago.
What is it written in?
Mainly Elixir, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 15, 2026, and from our analysis. They are not legal advice.

DEEP OPEN-SOURCE ANALYSIS

What TeslaMate Records That the Tesla App Does Not Keep

The Tesla mobile app shows current state. It does not give you a queryable history of every drive, charge session and sleep period. TeslaMate exists to fill that gap: it is a self-hosted logger that records vehicle data continuously and stores it in a Postgres database you control. The README lists the feature set plainly: high precision drive data recording, charge cost tracking, automatic address lookup, geofencing for custom locations, support for multiple vehicles per Tesla account, and import from TeslaFi and tesla-apiscraper. The bundled dashboards cover battery health, charge level, charge details, charging stats, drive stats, efficiency, mileage, projected range, states, timeline, trips, updates and vampire drain. That last one matters because the README makes a specific claim about the polling design: no additional vampire drain, with the car falling asleep as soon as possible. Anyone who has watched a third-party polling app keep a Tesla awake will recognise why that is stated as a feature rather than an implementation detail. The audience is narrow but well defined: people who run Docker at home, are comfortable with a Postgres connection string, and want their driving history in a form they can join against their own tables.

Elixir Polls, Postgres Stores, Grafana Draws, MQTT Broadcasts

The architecture is four moving parts, each named in the README. The application itself is written in Elixir and handles authentication against the Tesla API and the polling loop. Vehicle data lands in a Postgres database, which is the system of record; every dashboard, every query and every export reads from there. Grafana is the visualization layer, and the repository ships dashboards for it rather than asking you to build charts from scratch. Separately, vehicle data is published to a local MQTT broker, which is how the README says Home Assistant, Node-Red and Telegram integrations are wired. That split is the design decision worth noting. Grafana is for looking at history; MQTT is for reacting to the present. If you want a notification when charging starts, you subscribe to a topic. If you want to know how much energy that charge added three months ago, you query Postgres. Some projects try to do both through one interface and end up doing neither well. TeslaMate keeps them separate, which also means an MQTT outage does not stop logging and a Grafana outage does not stop your automations. The README also mentions SRTM and OpenStreetMap in the topic list, which is consistent with the automatic address lookup feature, though the README does not describe the lookup pipeline in detail.

Running It: Docker Images, Compose and the Environment Variables You Must Set

TeslaMate is distributed as a Docker image, teslamate/teslamate, and the README links to Docker Hub for both the current version and the image size. The documented path is Docker Compose: the docs site at docs.teslamate.org carries the installation instructions, and the standard deployment brings up the TeslaMate container alongside Postgres and Grafana. You supply Tesla account credentials and a database connection so the application can authenticate and persist. The README does not reproduce the compose file or the full environment variable list, so the exact key names belong to the documentation rather than to this article; treat the docs as the source for ENCRYPTION_KEY, DATABASE_USER, DATABASE_PASS, DATABASE_NAME and DATABASE_HOST rather than copying them from a blog post. There is also a Nix flake, given the nix and nix-flake topics, which is the route for people who already manage services declaratively. Two operational notes from the README are worth repeating. First, the security warning is explicit: obtain TeslaMate only from the official repository and documentation, because deceptive sites and unofficial mobile apps have used the name to distribute modified versions, and the README states that credentials and vehicle data may be at risk. Second, the import feature means you can migrate existing TeslaFi or tesla-apiscraper history rather than starting from an empty database.

Where Self-Hosting TeslaMate Gets Expensive

The cost is not the licence. It is the operational surface. A TeslaMate deployment is a Postgres database that grows continuously, a Grafana instance that needs its dashboards kept in sync with the application version, and a container that must be reachable and running for logging to happen. If the host is down, the data for that window is gone; TeslaMate is a logger, not a backfill service, and the README does not claim otherwise. Upgrades are the second cost. The recent release history shows v4.1.0 and v4.1.1 on the same day, followed by v4.2.0 about nine days later. That cadence is normal for an actively maintained project, and it means you should expect to move versions rather than install once and forget. The documentation is the place to check for migration steps between releases, because the README does not carry them. The third cost is knowledge: debugging a failed poll means reading Elixir application logs and checking database state, which is a different skill set from reading a vendor's status page. None of this is a flaw. It is the honest price of owning the data, and it should be priced in before the first docker compose up.

AGPL-3.0, the Trademark Policy and What They Mean for Forks

TeslaMate is licensed under the GNU Affero General Public License v3.0, and the README is unusually direct about the intent. Modifications must be released under the same licence. The copyleft obligation applies whether you distribute the software or offer its functionality over a network as a service. The README states that closed-source commercial products using TeslaMate or its components are not permitted, and that if your software interacts with or relies on TeslaMate it must be open source. Attribution requirements mean copyright notices and licence information stay intact. Contributors sign a Contributor License Agreement, handled automatically through cla-assistant.io on the first pull request. Separately, the TeslaMate name and logo are governed by a trademark policy in TRADEMARK.md, which is a different document from the licence and covers branding rather than code. For a private home deployment none of this changes anything: you are not distributing, so the copyleft triggers do not fire. For anyone wrapping TeslaMate into a hosted product, the network-service clause is the one to read carefully, and that reading is a job for a lawyer rather than for this article.

TeslaMate Versus TeslaFi and the Vendor-Hosted Model

The obvious comparison is TeslaFi, which the README names directly by offering an import path from it. TeslaFi is a hosted service: someone else runs the polling infrastructure, stores your history and maintains the interface, and you pay a subscription for that. TeslaMate inverts every part of that arrangement. You run the poller, you own the Postgres database, you maintain Grafana, and you pay in server time and attention instead of a monthly fee. The difference in approach shows up in what you can do with the data. A hosted service gives you the queries its interface exposes. TeslaMate gives you a database, which means arbitrary SQL, joins against your own tables, and exports that do not depend on an API being available. The trade is real in both directions. Hosted services handle upgrades, uptime and support; TeslaMate leaves those to you, and a failed disk on your home server is your incident, not a support ticket. The import feature matters here because it lowers the switching cost in one direction only: TeslaMate documents importing from TeslaFi, not the reverse. Choosing it is closer to a one-way door than the feature list makes it look.

Who Should Run TeslaMate, and What to Check Before the First Container Starts

TeslaMate fits engineers who already operate a home server or a small VPS with Docker, who are comfortable with Postgres, and who want vehicle history they can query rather than browse. It also fits Home Assistant users, since MQTT is a first-class output and the README lists that integration explicitly. It does not fit anyone who wants a managed service, a polished mobile app, or a system that never needs patching; the release cadence and the self-hosted architecture both argue against that expectation. Before deploying, verify three things. Confirm the image and documentation come from the official repository and docs.teslamate.org, per the security warning. Read the current installation page for the environment variables and compose layout, since the README does not reproduce them. And decide where the Postgres data directory lives and how it is backed up, because that database is the entire product; the Grafana dashboards are replaceable, the drive history is not. If you cannot answer the backup question, the deployment is not ready.

Editorial conclusion

Adopt TeslaMate if you already run Docker and Postgres somewhere and want vehicle telemetry you can query with SQL instead of exporting CSV from a vendor portal. Do not adopt it if you want a managed service, a mobile app, or a logging setup you never have to patch. Before committing, read the security warning in the README about unofficial forks and App Store apps using the TeslaMate name, confirm the Docker image you pull is teslamate/teslamate, and check whether the AGPL-3.0 copyleft terms fit how you intend to redistribute or host the software.

Official sources

  1. License: AGPL-3.0
  2. Project website
  3. README
  4. Releases
  5. teslamate-org/teslamate on GitHub
Community notes

Community notes