要求
- Docker(如果不熟悉 Docker,请参阅安装 Docker 和 Docker Compose)
- 一台始终开启的机器,因此 TeslaMate 可以持续获取数据
- 计算机上至少有 1 GB 的 RAM 才能成功安装。
- 外部互联网访问,与 tesla.com 交谈
创建一个名为以下内容的文件:docker-compose.yml
[root@csy-2210240119 test2]# vim docker-compose.yml
grafana:
image: teslamate/grafana:latest
restart: always
environment:
- DATABASE_USER=teslamate
- DATABASE_PASS=password
- 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/noauth.conf
# Uncomment the line below if you want to expose the MQTT port
# ports:
# - 1883:1883
volumes:
- mosquitto-conf:/mosquitto/config
- mosquitto-data:/mosquitto/data
volumes:
teslamate-db:
teslamate-grafana-data:
mosquitto-conf:
mosquitto-data:
- 选择一个安全加密密钥,该密钥将用于加密您的 Tesla API 令牌(插入为 )。ENCRYPTION_KEY
- 选择您的安全数据库密码,并在每次出现 and 时插入它DATABASE_PASSPOSTGRES_PASSWORD
- 使用 启动 docker 容器。若要在后台运行容器,请添加以下标志:docker compose up-d
用法
- 打开 Web 界面 http://your-ip-address:4000
- 使用您的 Tesla 账户登录
- Grafana 仪表板位于 http://your-ip-address:3000。使用默认用户(初始密码)登录并输入安全密码。adminadmin
[root@csy-2210240119 test2]# docker-compose up -d
Creating network "test2_default" with the default driver
Creating volume "test2_teslamate-db" with default driver
Creating volume "test2_teslamate-grafana-data" with default driver
Creating volume "test2_mosquitto-conf" with default driver
Creating volume "test2_mosquitto-data" with default driver
Pulling teslamate (teslamate/teslamate:latest)...
latest: Pulling from teslamate/teslamate
f11c1adaa26e: Pull complete
5dc7fa16ae16: Pull complete
fdc678bcf528: Pull complete
a6a78ef53b3d: Pull complete
3145d4af35ba: Pull complete
57dd574b0bfd: Pull complete
Digest: sha256:21b53b2490f88805a48c03998a1a307edfc908dec6323f5221097639bcb846bf
Status: Downloaded newer image for teslamate/teslamate:latest
Pulling database (postgres:16)...
16: Pulling from library/postgres
efc2b5ad9eec: Pull complete
b33c47d38f22: Pull complete
87cb89a22d1e: Pull complete
fd66d978bf1a: Pull complete
d1723030f70f: Pull complete
4ed8886da429: Pull complete
2c0a96a00eeb: Pull complete
224e967d7685: Pull complete
4774bf58af6a: Pull complete
5f45270309c1: Pull complete
60cb0fc6dcac: Pull complete
abcf585d57b0: Pull complete
87cb29313a81: Pull complete
2e7f0c5387bd: Pull complete
Digest: sha256:d0f363f8366fbc3f52d172c6e76bc27151c3d643b870e1062b4e8bfe65baf609
Status: Downloaded newer image for postgres:16
Pulling grafana (teslamate/grafana:latest)...
latest: Pulling from teslamate/grafana
4abcf2066143: Pull complete
90a5b5b688c9: Pull complete
b4d3df5fce20: Pull complete
7323f95dae0a: Pull complete
37e7a9762f6b: Pull complete
58a42d0fddd0: Pull complete
44e28e264aaf: Pull complete
f2fa4af3d6e2: Pull complete
2ca7067e7a0f: Pull complete
c9eeabca0418: Pull complete
73f4e886e7b2: Pull complete
79dc48c4848d: Pull complete
85a5834f7451: Pull complete
a68af531adff: Pull complete
2e04094360e9: Pull complete
ed8a60656a39: Pull complete
6da819cd0144: Pull complete
4f7c49c21dd0: Pull complete
Digest: sha256:8c44b15fa5c57989004ee935fbad21ae070d75457d8beb432d2adedb44802e38
Status: Downloaded newer image for teslamate/grafana:latest
Pulling mosquitto (eclipse-mosquitto:2)...
2: Pulling from library/eclipse-mosquitto
930bdd4d222e: Pull complete
085c6f8a3a47: Pull complete
3c10f08c3bc8: Pull complete
Digest: sha256:0dade801eb979962bcfebe7545296be24f4b25aad26df63e0140f6b2161471a2
Status: Downloaded newer image for eclipse-mosquitto:2
Creating test2_database_1 ... done
Creating test2_teslamate_1 ... done
Creating test2_grafana_1 ... done
Creating test2_mosquitto_1 ... done
访问测试