How to Install TeslaMate on Your Synology NAS

How to Install TeslaMate on Your Synology NAS

TeslaMate is a data logger for your Tesla car. It will record all the information sent by your car such as charging, trips, sleep, updates etc. and present it to you with many statistics and beautiful graphics thanks to Grafana. In this step by step guide I will show you how to install TeslaMate on your Synology NAS with Docker & Portainer.

💡Note: This guide works perfectly with the latest version of TeslaMate v1.28.5

  • STEP 1

Please Support My work by Making a Donation.

  • STEP 2

Install Portainer using my step by step guide. If you already have Portainer installed on your Synology NAS, skip this STEP. Attention: Make sure you have installed the latest Portainer version.

  • STEP 3

Generate your own Tesla API Token and Refresh Token by downloading the Tesla Token application for Android or Apple iOS. You will need the API Token and Refresh Token later at STEP 16.

  • STEP 4

Go to File Station and open the docker folder. Inside the docker folder, create one new folder and name it teslamate. Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.

TeslaMate Synology NAS Set up 1

  • STEP 5

Now create five new folders inside the teslamate folder that you created at STEP 4 and name them datagrafana, db, mosqconf, mosqdata, mosqlogs. Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.

TeslaMate Synology NAS Set up 2

  • STEP 6

Right click on the teslamate folder that you have previously created at STEP 4 then click Properties. Follow the instructions in the image below.

TeslaMate Synology NAS Set up 3

  • STEP 7

Go to the Permission tab then click Advanced options. From the drop-down menu choose “Make inherited permissions explicit“. Follow the instructions in the image below.

TeslaMate Synology NAS Set up 4

  • STEP 8

Select Everyone then click the Edit tab. Follow the instructions in the image below.

TeslaMate Synology NAS Set up 5

  • STEP 9

Check all Read and Write Permissions. Click Done. Follow the instructions in the image below.

TeslaMate Synology NAS Set up 6

  • STEP 10

After you click Done on STEP 9, check “Apply to this folder, sub-folders and files“. Click Save. Follow the instructions in the image below.

TeslaMate Synology NAS Set up 7

  • STEP 11

Log into Portainer using your username and password. On the left sidebar in Portainer, click on Stacks then + Add stack. Follow the instructions in the image below.

1 Synology Portainer Add Stack

  • STEP 12

In the Name field type in teslamate. Follow the instructions in the image below.

Note: Copy Paste the code below in the Portainer Stacks Web editor.

version: "3.9"

services:
  teslamate:
    image: ghcr.io/teslamate-org/teslamate:latest
    container_name: TeslaMate
    restart: on-failure:5
    environment:
      - ENCRYPTION_KEY=MariushostingMariushostingMari13
      - DATABASE_USER=teslamate
      - DATABASE_PASS=mariushosting
      - DATABASE_NAME=teslamate
      - DATABASE_HOST=database
      - MQTT_HOST=mosquitto
    ports:
      - 20002:4000
    cap_drop:
      - all

  database:
    image: postgres:14
    container_name: TeslaMate-DB
    restart: on-failure:5
    environment:
      - POSTGRES_USER=teslamate
      - POSTGRES_PASSWORD=mariushosting
      - POSTGRES_DB=teslamate
    volumes:
      - /volume1/docker/teslamate/db:/var/lib/postgresql/data:rw

  grafana:
    image: teslamate/grafana:latest
    container_name: TeslaMate-GRAFANA
    restart: on-failure:5
    environment:
      - DATABASE_USER=teslamate
      - DATABASE_PASS=mariushosting
      - DATABASE_NAME=teslamate
      - DATABASE_HOST=database
    ports:
      - 20003:3000
    volumes:
      - /volume1/docker/teslamate/datagrafana:/var/lib/grafana:rw

  mosquitto:
    image: eclipse-mosquitto:2
    container_name: TeslaMate-MOSQUITTO
    restart: on-failure:5
    command: mosquitto -c /mosquitto-no-auth.conf
    # ports:
    #   - 1883:1883
    volumes:
      - /volume1/docker/teslamate/mosqconf:/mosquitto/config:rw
      - /volume1/docker/teslamate/mosqdata:/mosquitto/data:rw
      - /volume1/docker/teslamate/mosqlogs:/mosquitto/log:rw

Note: Before you paste the code above in the Web editor area below, change the value for ENCRYPTION_KEY and add your own Encryption Key. MariushostingMariushostingMari13 is an example for an ENCRYPTION_KEY. You should invent your own Value. Add 32 random characters, both letters and numbers.
Note: Before you paste the code above in the Web editor area below, change the values for DATABASE_PASS, POSTGRES_PASSWORD, DATABASE_PASS and type in your own password. mariushosting is an example for a password. All values should have the same identical password.

TeslaMate Synology NAS Set up 8 new 2024

  • STEP 13

Scroll down on the page until you see a button named Deploy the stack. Click on it. Follow the instructions in the image below. The installation process can take up to a few minutes. It will depend on your Internet speed connection.

TeslaMate Synology NAS Set up 9

  • STEP 14

If everything goes right, you will see the following message at the top right of your screen: “Success Stack successfully deployed“.

TeslaMate Synology NAS Set up 10

  • STEP 15

Go back to STEP 1 or you will deal with karma 🙂

  • STEP 16

The installation process can take up to a few seconds/minutes. It will depend on your Internet speed connection. Now open your browser and type in http://Synology-ip-address:20002 Paste your own API Access Token and Refresh Token that you have previously generated at STEP 3. Click Sign in. Follow the instructions in the image below. Note: A big thank you to the mariushosting fan Petr who gave me his Tesla API Key for testing.

TeslaMate Synology NAS Set up 11

  • STEP 17

If everything goes right, you will see the following message at the top of your screen: “Signed in successfully“.

TeslaMate Synology NAS Set up 12

  • STEP 18

Now open your browser and type in http://Synology-ip-address:20003 Type in the default username and password, then click Log in.

⚠️Warning: the default username is admin and the default password is admin

TeslaMate Synology NAS Set up 13

  • STEP 19

After you click Log in on STEP 18, you will be prompted to change the password. Choose your favorite password, then click Submit. Follow the instructions in the image below.

TeslaMate Synology NAS Set up 14

  • STEP 20

Now go back to your TeslaMate page at http://Synology-ip-address:20002 and click Settings at the top right of the page. Follow the instructions in the image below.

TeslaMate Synology NAS Set up 15

  • STEP 21

Scroll down to the bottom of the page. Follow the instructions in the image below.

TeslaMate Synology NAS Set up 16

  • STEP 22

On the Dashboards field type in http:// followed by your NASIP:20003 Follow the instructions in the image below.

TeslaMate Synology NAS Set up 17

  • STEP 23

On the TeslaMate page a new menu called Dashboards will appear at the top. Here you have different statistics for your Tesla car. Click on a statistic you are interested in to see the data.

TeslaMate Synology NAS Set up 18

  • STEP 24

Once you click on a statistic, you will be automatically redirected to the respective grafana dashboard graphical interface. You will see some examples below. 🚀Note: The data is not real-time data. The information is updated every 5 minutes or so. And you need to drive your car, charge your battery etc. in order to have any information logged for you to assess.

Overview Statistic.

TeslaMate Synology NAS Set up 19

Locations statistic.

TeslaMate Synology NAS Set up 20

Drive Stats statistic.

TeslaMate Synology NAS Set up 21

Efficiency statistic.

TeslaMate Synology NAS Set up 22

Current State statistic.

TeslaMate Synology NAS Set up 23

Charge Level statistic.

TeslaMate Synology NAS Set up 24

Enjoy TeslaMate!

Note: If you want to run the TeslaMate container over HTTPS, check out my guide on How to Run Docker Containers Over HTTPS. If you decide to use your TeslaMate over https, remember to change the Dashboards address at STEP 22 with the respective grafana https link. So you will need 2 Reverse Proxies, one for the TeslaMate at port 20002 and one for Grafana at port 20003. In order to make TeslaMate and Grafana work over https, it’s also mandatory to set up WebSocket.

Note: Can I run Docker on my Synology NAS? See the supported models.
Note: How to Back Up Docker Containers on your Synology NAS.
Note: Find out how to update the TeslaMate container with the latest image.
Note: How to Free Disk Space on Your NAS if You Run Docker.
Note: How to Schedule Start & Stop For Docker Containers.
Note: How to Activate Email Notifications.
Note: How to Add Access Control Profile on Your NAS.
Note: How to Change Docker Containers Restart Policy.
Note: How to Use Docker Containers With VPN.
Note: Convert Docker Run Into Docker Compose.
Note: How to Clean Docker.
Note: How to Clean Docker Automatically.
Note: Best Practices When Using Docker and DDNS.
Note: Some Docker Containers Need WebSocket.
Note: Find out the Best NAS Models For Docker.
Note: Activate Gmail SMTP For Docker Containers.

This post was updated on Thursday / March 28th, 2024 at 11:38 PM