Setting Up TeslaMate: A Complete Guide
If you're a Tesla owner who loves data (and who doesn't?), TeslaMate is an absolute game-changer. This self-hosted solution gives you incredibly detailed insights into your vehicle's performance, efficiency, and usage patterns. Here's my complete guide to getting it up and running.
What You'll Need
- A server or computer that can run 24/7 (Raspberry Pi 4 works great)
- Docker and Docker Compose installed
- Your Tesla account credentials
- About 30-60 minutes of setup time
Step 1: Installing Docker
First, we need to install Docker on your server. If you're using Ubuntu or Debian:
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $USER
Step 2: Setting Up the Docker Compose File
Create a new directory for TeslaMate and create a docker-compose.yml file:
mkdir ~/teslamate
cd ~/teslamate
nano docker-compose.yml
Here's my complete docker-compose.yml configuration:
version: '3'
services:
teslamate:
image: teslamate/teslamate:latest
restart: always
environment:
- ENCRYPTION_KEY=your-secret-key-here
- DATABASE_USER=teslamate
- DATABASE_PASS=secret
- DATABASE_NAME=teslamate
- DATABASE_HOST=database
- MQTT_HOST=mosquitto
ports:
- 4000:4000
volumes:
- ./import:/opt/app/import
depends_on:
- database
- mosquitto
database:
image: postgres:14
restart: always
environment:
- POSTGRES_USER=teslamate
- POSTGRES_PASSWORD=secret
- POSTGRES_DB=teslamate
volumes:
- teslamate-db:/var/lib/postgresql/data
grafana:
image: teslamate/grafana:latest
restart: always
environment:
- DATABASE_USER=teslamate
- DATABASE_PASS=secret
- DATABASE_NAME=teslamate
- DATABASE_HOST=database
ports:
- 3000:3000
volumes:
- teslamate-grafana-data:/var/lib/grafana
mosquitto:
image: eclipse-mosquitto:2
restart: always
command: mosquitto -c /mosquitto-no-auth.conf
volumes:
- mosquitto-conf:/mosquitto/config
- mosquitto-data:/mosquitto/data
volumes:
teslamate-db:
teslamate-grafana-data:
mosquitto-conf:
mosquitto-data:
Step 3: Starting the Services
Now let's start everything up:
docker-compose up -d
This will download all the necessary Docker images and start the services. You can check if everything is running with:
docker-compose ps
Step 4: Initial Configuration
Open your browser and navigate to http://your-server-ip:4000. You'll see the TeslaMate setup page where you'll need to enter your Tesla credentials.
Important: I highly recommend using a refresh token instead of your actual Tesla password. You can generate one using the Tesla Auth app.
Step 5: Exploring Grafana Dashboards
The real magic happens in Grafana. Navigate to http://your-server-ip:3000 and log in with:
- Username: admin
- Password: admin
You'll find pre-configured dashboards for:
- Drive efficiency and consumption
- Charging statistics and costs
- Battery degradation over time
- Climate control impact on range
- Trip history and statistics
- And much more!
Advanced Tips
Setting Up Reverse Proxy
For secure external access, I use Nginx as a reverse proxy with SSL certificates from Let's Encrypt. This allows me to access my dashboards from anywhere securely.
Backup Strategy
Don't forget to backup your data! I run a nightly backup of the PostgreSQL database:
docker exec teslamate_database_1 pg_dump -U teslamate teslamate > backup.sql
Custom Dashboards
While the default dashboards are excellent, you can create custom ones in Grafana. I've built specialized dashboards for tracking Supercharger usage and comparing seasonal efficiency.
Troubleshooting Common Issues
Tesla API Rate Limiting
If you see authentication errors, you might be hitting Tesla's rate limits. TeslaMate handles this gracefully, but you can adjust the polling interval in the settings.
Database Connection Issues
If Grafana can't connect to the database, ensure all services are on the same Docker network and the credentials match.
Missing Data
TeslaMate needs time to collect data. Don't worry if dashboards look empty initially - they'll populate after a few drives.
Privacy Considerations
Since TeslaMate is self-hosted, all your data stays on your server. However, consider these privacy aspects:
- Use strong passwords for all services
- Keep your server updated
- Consider geo-fence settings to hide sensitive locations
- Regular backups protect against data loss
Conclusion
TeslaMate has completely transformed how I understand my Model 3's performance and costs. The insights it provides have helped me optimize my driving habits, understand charging patterns, and track the true cost of ownership.
The setup might seem complex initially, but once running, it's incredibly stable and requires minimal maintenance. The value of the data you'll collect makes it absolutely worth the effort.
Have questions about setting up TeslaMate or want to share your experience? Feel free to reach out!