TeslaMate logo

TeslaMate

Self-hosted data logger for your Tesla

Alternative to: teslafi


TeslaMate is a powerful, self-hosted data logger for your Tesla. It records high-precision drive and charging data without adding vampire drain, stores it in a Postgres database and visualizes it with bundled Grafana dashboards. Vehicle data is also published to a local MQTT broker for integrations such as Home Assistant and Node-RED.

TeslaMate Docker Compose example

Self-host TeslaMate on your own server, homelab, or VPS starting from this Docker Compose example. It runs TeslaMate in Docker containers using the official teslamate/teslamate:latest, postgres:18, teslamate/grafana:latest, eclipse-mosquitto:2 images, with persistent volumes and automatic restarts preconfigured. Review the environment variables and adjust them to your setup, save the file as compose.yml (or docker-compose.yml), and start the stack with docker compose up -d.

services:
  teslamate:
    image: teslamate/teslamate:latest
    restart: unless-stopped
    environment:
      # Key used to encrypt the Tesla API tokens stored in the database. Use a long, random value and keep it safe.
      ENCRYPTION_KEY: "changeme"
      # Database user.
      DATABASE_USER: "teslamate"
      # Database password. Must match POSTGRES_PASSWORD on the database service.
      DATABASE_PASS: "password"
      # Database name.
      DATABASE_NAME: "teslamate"
      # Database host (the bundled Postgres service).
      DATABASE_HOST: "database"
      # MQTT broker host (the bundled Mosquitto service).
      MQTT_HOST: "mosquitto"
      # Address the web interface listens on. Blank means all addresses (IPv6 dual-stack), which fails on hosts without IPv6; 0.0.0.0 listens on all IPv4 addresses.
      HTTP_BINDING_ADDRESS: "0.0.0.0"
    volumes:
      - import:/opt/app/import
    cap_drop:
      - all

  database:
    image: postgres:18
    restart: unless-stopped
    environment:
      # Database user created on first start.
      POSTGRES_USER: "teslamate"
      # Database password. Must match DATABASE_PASS on the teslamate and grafana services.
      POSTGRES_PASSWORD: "password"
      # Database created on first start.
      POSTGRES_DB: "teslamate"
    volumes:
      - teslamate-db:/var/lib/postgresql

  grafana:
    image: teslamate/grafana:latest
    restart: unless-stopped
    environment:
      # Database user Grafana reads TeslaMate data with.
      DATABASE_USER: "teslamate"
      # Database password. Must match POSTGRES_PASSWORD on the database service.
      DATABASE_PASS: "password"
      # Database name.
      DATABASE_NAME: "teslamate"
      # Database host (the bundled Postgres service).
      DATABASE_HOST: "database"
    volumes:
      - teslamate-grafana-data:/var/lib/grafana

  mosquitto:
    image: eclipse-mosquitto:2
    restart: unless-stopped
    command: mosquitto -c /mosquitto-no-auth.conf
    volumes:
      - mosquitto-conf:/mosquitto/config
      - mosquitto-data:/mosquitto/data

volumes:
  import:
  teslamate-db:
  teslamate-grafana-data:
  mosquitto-conf:
  mosquitto-data:

Values set to changeme are required — replace them with your own values before starting TeslaMate.

Prefer a managed setup? WinterFlow installs, configures, and updates TeslaMate for you using this same Docker Compose configuration.