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
-
Create a directory:
- Create a directory for TeslaMate:
-
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:
- Be sure to replace the terms 'secretkey' and 'password'. Any random string of characters will do, as long as you keep them safe.
-
Start TeslaMate:
-
Run the following command to start the services:
- 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:
-
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.
-
Copy the Tokens:
- After logging in, copy the generated
Access Token
andRefresh Token
and keep them secure. You will need these in the next step.
- After logging in, copy the generated
Step 3: Configure TeslaMate Settings
-
Access TeslaMate:
-
Open your browser and go to
http://<your-server-ip>:4000
. Replace<your-server-ip>
with the IP address of your server. -
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
-
Update Settings:
- Navigate to the TeslaMate settings by clicking on the gear icon in the top-right corner.
- 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
).
- Navigate to the TeslaMate settings by clicking on the gear icon in the top-right corner.
Step 4: Access Grafana Dashboards
-
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.
- Open your browser and go to
-
Explore Dashboards:
- Navigate to TeslaMate dashboards. Some examples include:
- Battery Health
- Trips
- Charge Efficiency
- 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!