Skip to content

Install TeslaMate with Docker Compose

(Written December 2024)

Abstract

TeslaMate is a self-hosted data logger for Tesla vehicles. In this guide, I'll walk you through setting up TeslaMate using Docker Compose, generating Tesla API tokens, and accessing the Grafana dashboards to monitor your car’s data.

Prerequisites

Hardware requirements

  • In my experience 1 Gb of RAM is enough
  • A single CPU core is enough

Install TeslaMate

Step 1: Prepare Docker Compose

  1. Create a directory:

    • Create a directory for TeslaMate:
      mkdir teslamate
      
  2. Create a Docker Compose File:

    • Navigate to the TeslaMate installation page.
    • Copy the default Docker Compose YAML configuration.
    • Create a compose file to paste in the Docker Compose configuration:
      nano compose.yml
      
    • Be sure to replace the terms 'secretkey' and 'password'. Any random string of characters will do, as long as you keep them safe.
  3. Start TeslaMate:

  4. Run the following command to start the services:

    docker-compose up -d
    

  5. This will download the necessary Docker images and start the TeslaMate services.

Step 2: Generate Tesla API Tokens

TeslaMate requires API tokens for third-party access to your Tesla vehicle. Follow these steps to generate the tokens:

  1. Generate Tokens:

    • Visit the website Tesla Auth and download for your OS.
    • Download the recommended application for generating API tokens.
    • Use the application to log in with your Tesla credentials. Note that you may need to wake up your car by opening the Tesla app or physically going to your car.
  2. Copy the Tokens:

    • After logging in, copy the generated Access Token and Refresh Token and keep them secure. You will need these in the next step.

Step 3: Configure TeslaMate Settings

  1. Access TeslaMate:

  2. Open your browser and go to http://<your-server-ip>:4000. Replace <your-server-ip> with the IP address of your server.

  3. Log in:

    • The default credentials are:
    • Username: admin
    • Password: admin
    • Upon first login, you will be prompted to change your password. Follow the instructions to update it for better security.
    • Fill in the access and refresh token
      NGINX Proxy Manager NGINX Proxy Manager
  4. Update Settings:

    • Navigate to the TeslaMate settings by clicking on the gear icon in the top-right corner. NGINX Proxy Manager
    • Enable data collection and sleep mode under "Data Collection."
    • Configure other settings like charge costs, preferred range units (e.g., kilometers or miles), and language preferences.
    • At the bottom of the settings page, specify the Grafana dashboard URL (e.g., http://<your-server-ip>:3000). NGINX Proxy Manager

Step 4: Access Grafana Dashboards

  1. Log in to Grafana:

    • Open your browser and go to http://<your-server-ip>:3000.
    • Use the default credentials to log in:
    • Username: admin
    • Password: admin
    • Change the default password when prompted. NGINX Proxy Manager
  2. Explore Dashboards:

    • Navigate to TeslaMate dashboards. Some examples include:
    • Battery Health
    • Trips
    • Charge Efficiency NGINX Proxy Manager
    • Initially, some metrics may appear empty. This is normal if the car has not been driven since installation.

Step 5: Optional Configuration

  • Wake the Car:

    If TeslaMate fails to retrieve data, you may need to wake up your car by opening the Tesla app or physically accessing the vehicle.

  • Advanced Settings:

    Add geofences to track locations. Enable the Streaming API for real-time updates.

Conclusion

You have successfully installed TeslaMate using Docker Compose, configured the necessary settings, and accessed Grafana dashboards. Over time, as you drive your car, TeslaMate will collect data and populate the dashboards with detailed insights into your vehicle’s performance.

Feel free to explore the settings and dashboards to tailor the experience to your needs. Enjoy monitoring your Tesla with TeslaMate!