Skip to main content

TeslaMate

teslamate.png

A powerful, self-hosted data logger for your Tesla.

Website: https://github.com/teslamate-org/teslamate

docker-compose.yaml
services:
  teslamate:
    container_name: teslamate
    image: teslamate/teslamate:latest
    restart: always
    environment:
      - ENCRYPTION_KEY=myencryptionkey #replace with a secure key to encrypt your Tesla API tokens
      - DATABASE_USER=teslamate
      - DATABASE_PASS=mydbpassword #insert your secure database password!
      - DATABASE_NAME=teslamate
      - DATABASE_HOST=database
      - MQTT_HOST=mosquitto
    ports:
      - 4000:4000
    volumes:
      - ./import:/opt/app/import
    cap_drop:
      - all

  database:
    container_name: teslamate-pg
    image: postgres:16
    restart: always
    environment:
      - POSTGRES_USER=teslamate
      - POSTGRES_PASSWORD=mydbpassword #insert your secure database password!
      - POSTGRES_DB=teslamate
    volumes:
      - teslamate-db:/var/lib/postgresql/data

  grafana:
    container_name: teslamate-grafana
    image: teslamate/grafana:latest
    restart: always
    environment:
      - DATABASE_USER=teslamate
      - DATABASE_PASS=mydbpassword #insert your secure database password!
      - DATABASE_NAME=teslamate
      - DATABASE_HOST=database
    ports:
      - 3000:3000
    volumes:
      - teslamate-grafana-data:/var/lib/grafana

  mosquitto:
    container_name: teslamate-mosquitto
    image: eclipse-mosquitto:2
    restart: always
    command: mosquitto -c /mosquitto-no-auth.conf
    # ports:
    #   - 1883:1883
    volumes:
      - mosquitto-conf:/mosquitto/config
      - mosquitto-data:/mosquitto/data

volumes:
  teslamate-db:
    driver: local
    driver_opts:
      type: none
      device: /path/to/tesla/data
      o: bind
  teslamate-grafana-data:
    driver: local
    driver_opts:
      type: none
      device: /path/to/tesla/grafana-data
      o: bind
  mosquitto-conf:
    driver: local
    driver_opts:
      type: none
      device: /path/to/tesla/mosquitto/conf
      o: bind  
  mosquitto-data:
    driver: local
    driver_opts:
      type: none
      device: /path/to/tesla/mosquitto/data
      o: bind

notes:

  • Replace encryption key, database password and paths to volumes by your own values