Compare commits

...
32 Commits
Author SHA1 Message Date
renovate[bot] 2456784d56 Update actions/checkout action to v6.0.2 (#125)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-03-06 15:08:06 +00:00
renovate[bot] f7b4745a20 Update TeslaMate to v3 (#129)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-03-06 15:07:49 +00:00
renovate[bot] bdc682d040 Update docker/login-action action to v4 (#130)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-03-04 09:56:41 +00:00
renovate[bot] 0bd729517b Update home-assistant/builder action to v2026.02.1 (#128)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-02-24 17:53:21 +00:00
renovate[bot] 145e7e6807 Update home-assistant/builder action to v2026 (#127)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-02-24 13:07:11 +00:00
renovate[bot] d42b7aa0e8 Update docker/login-action action to v3.7.0 (#126)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-28 15:51:16 +00:00
renovate[bot] 320389ea16 Update actions/checkout action to v6.0.1 (#121) 2025-12-03 07:48:05 +00:00
renovate[bot] 61c0a0fada Update softprops/action-gh-release action to v2.5.0 (#116)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-01 09:41:09 +00:00
renovate[bot] d7cea32f07 Update home-assistant/builder action to v2025.11.0 (#120)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-27 10:13:33 +00:00
renovate[bot] 1baaf635f5 Update actions/checkout action to v6 (#119)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-20 18:13:09 +00:00
renovate[bot] eec7ac2822 Update actions/checkout action to v5.0.1 (#118)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-18 09:21:35 +00:00
renovate[bot] 7a86a1f0c3 Update TeslaMate to v2.2.0 (#114)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-08 12:24:13 +00:00
Colin Seymour 83c29fbed8 Drop armv7 support and codenotary (#115)
* Drop armv7

* Remove codenotary
2025-11-08 12:19:26 +00:00
Colin Seymour ee6faf280d Add note for clearing TeslaMate config to re-show config links (#113)
Add note for clearing TeslaMate config for logs

Added note about clearing TeslaMate configuration for log visibility.
2025-10-17 10:43:50 +01:00
Niels 2421d0a805 Remove duplicated custom_plugins: [] (#110) 2025-10-14 09:45:12 +01:00
renovate[bot] aa5dee6c4a Update softprops/action-gh-release action to v2.4.1 (#109)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-13 10:33:48 +01:00
renovate[bot] 77e7510e3b Update softprops/action-gh-release action to v2.4.0 (#108)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-07 09:18:43 +01:00
renovate[bot] 6031fe6fa4 Update docker/login-action action to v3.6.0 (#106)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-05 07:22:50 +01:00
renovate[bot] eb7945344e Update softprops/action-gh-release action to v2.3.4 (#107)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-05 07:22:36 +01:00
renovate[bot] e9c77210b7 Update home-assistant/builder action to v2025.09.0 (#104)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-09-16 09:52:27 +01:00
renovate[bot] 64cbe20138 Update softprops/action-gh-release action to v2.3.3 (#103)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-09-07 12:20:32 +01:00
renovate[bot] 1c521e808c Update TeslaMate to v2.1.1 (#100)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-09-05 09:34:41 +01:00
renovate[bot] 0d7507b3d9 Update actions/checkout action to v5 (#98)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-11 14:56:40 +01:00
renovate[bot] d8aa9cb7d9 Update actions/checkout action to v4.3.0 (#97)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-11 14:53:25 +01:00
renovate[bot] 2dfda5bbc0 Update docker/login-action action to v3.5.0 (#96)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-04 16:43:20 +01:00
renovate[bot] 522e9890ca Update TeslaMate to v2.1.0 (#94)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-07-21 16:19:45 +01:00
Colin Seymour 453252d864 Only set file limit to a max of 524288 (#93) 2025-07-07 09:14:42 +01:00
renovate[bot]andColin Seymour 800d3ee3ab Update TeslaMate to v2 (#85)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Colin Seymour <colin@symr.io>
2025-07-06 09:22:01 +01:00
Colin Seymour 562fd279b0 Prep for TeslaMate v2 update (#91)
* Prep docs for v2

* Add pg version check

* Import dashboards after DB

* Assume compatible

* Emphasis version

* Use 2 spaces for ident

* Improve logging
2025-07-06 09:13:44 +01:00
renovate[bot] 9d0729c9bf Update softprops/action-gh-release action to v2.3.2 (#90) 2025-06-11 08:49:21 +01:00
renovate[bot] e3a352b44d Update softprops/action-gh-release action to v2.3.0 (#89) 2025-06-10 07:53:17 +01:00
renovate[bot] fc5f6d6c2d Update softprops/action-gh-release action to v2.2.2 (#84) 2025-04-19 07:11:51 +01:00
10 changed files with 151 additions and 117 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: ⤵️ Check out code from GitHub - name: ⤵️ Check out code from GitHub
uses: actions/checkout@v4.2.2 uses: actions/checkout@v6.0.2
- name: 🚀 Run Home Assistant Add-on Lint - name: 🚀 Run Home Assistant Add-on Lint
uses: frenck/action-addon-linter@v2 uses: frenck/action-addon-linter@v2
+4 -4
View File
@@ -19,11 +19,11 @@ jobs:
packages: write packages: write
strategy: strategy:
matrix: matrix:
arch: ["amd64", "armv7", "aarch64"] arch: ["amd64", "aarch64"]
steps: steps:
- name: Checkout the repository - name: Checkout the repository
uses: actions/checkout@v4.2.2 uses: actions/checkout@v6.0.2
- name: Get version - name: Get version
run: | run: |
@@ -35,14 +35,14 @@ jobs:
fi fi
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@v3.4.0 uses: docker/login-action@v4.0.0
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and publish - name: Build and publish
uses: home-assistant/builder@2025.03.0 uses: home-assistant/builder@2026.02.1
with: with:
args: | args: |
--${{ matrix.arch }} \ --${{ matrix.arch }} \
+3 -3
View File
@@ -19,7 +19,7 @@ jobs:
packages: write packages: write
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v6
with: with:
path: teslamate path: teslamate
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -52,7 +52,7 @@ jobs:
git push --tags git push --tags
working-directory: ${{ github.workspace }}/teslamate working-directory: ${{ github.workspace }}/teslamate
- name: Create release - name: Create release
uses: softprops/action-gh-release@v2.2.1 uses: softprops/action-gh-release@v2.5.0
with: with:
tag_name: v${{ steps.semver.outputs.semver }} tag_name: v${{ steps.semver.outputs.semver }}
body_path: CHANGELOG.txt body_path: CHANGELOG.txt
@@ -61,7 +61,7 @@ jobs:
prerelease: false prerelease: false
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout addon repo - name: Checkout addon repo
uses: actions/checkout@v4.2.2 uses: actions/checkout@v6.0.2
with: with:
path: repo path: repo
repository: lildude/ha-addons repository: lildude/ha-addons
+3 -3
View File
@@ -28,14 +28,14 @@ jobs:
name: Build add-on name: Build add-on
strategy: strategy:
matrix: matrix:
arch: ["amd64", "armv7", "aarch64"] arch: ["amd64", "aarch64"]
steps: steps:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v4.2.2 uses: actions/checkout@v6.0.2
- name: Build add-on - name: Build add-on
uses: home-assistant/builder@2025.03.0 uses: home-assistant/builder@2026.02.1
with: with:
args: | args: |
--test \ --test \
+8 -5
View File
@@ -7,7 +7,7 @@ A self-hosted data logger for your Tesla 🚘
[TeslaMate][teslamate] is a powerful, self-hosted data logger for your Tesla. [TeslaMate][teslamate] is a powerful, self-hosted data logger for your Tesla.
- Written in **[Elixir][elixir]** - Written in **[Elixir][elixir]**
- Data is stored in a **Postgres** database - Data is stored in a **PostgreSQL** database
- Visualization and data analysis with **Grafana** - Visualization and data analysis with **Grafana**
- Vehicle data is published to a local **MQTT** Broker - Vehicle data is published to a local **MQTT** Broker
@@ -77,7 +77,6 @@ custom_plugins:
- name: panodata-map-panel - name: panodata-map-panel
url: https://github.com/panodata/panodata-map-panel/releases/download/0.16.0/panodata-map-panel-0.16.0.zip url: https://github.com/panodata/panodata-map-panel/releases/download/0.16.0/panodata-map-panel-0.16.0.zip
unsigned: true unsigned: true
custom_plugins: []
env_vars: env_vars:
- name: GF_SECURITY_ADMIN_USER - name: GF_SECURITY_ADMIN_USER
value: <youruser> value: <youruser>
@@ -108,7 +107,7 @@ Once you have Grafana up and running, you'll need to configure a data source to
‼️ **Note**: The name must be `TeslaMate` as all the dashboards expect the datasource to use this name. ‼️ **Note**: The name must be `TeslaMate` as all the dashboards expect the datasource to use this name.
![Grafana Postgres data source][grafana-datasource] ![Grafana PostgreSQL data source][grafana-datasource]
#### Other Options #### Other Options
@@ -151,7 +150,9 @@ For example, if you access your Home Assistant instance at `https://ha.example.c
Do _not_ use these values. Use the values from your log output. Do _not_ use these values. Use the values from your log output.
## Migrate TeslaMate to a Different PostreSQL Server **Note:** If you do not see the links in your add-on logs, clear the values in the TeslaMate configuration and restart the add-on.
## Migrate TeslaMate to a Different PostgreSQL Server
In order to migrate TeslaMate to a different PostgreSQL server, you will need to make a backup of the original data and then restore it to the destination server. In order to migrate TeslaMate to a different PostgreSQL server, you will need to make a backup of the original data and then restore it to the destination server.
This isn't much of a challenge for the seasoned sysadmin familiar with Docker, PostgreSQL and the command line, however most Home Assistant users aren't expert sysadmins so this guide if for you. This isn't much of a challenge for the seasoned sysadmin familiar with Docker, PostgreSQL and the command line, however most Home Assistant users aren't expert sysadmins so this guide if for you.
@@ -201,7 +202,7 @@ If you have made a backup of a TeslaMate installation as per the [TeslaMate back
1. Install this TeslaMate add-on if you haven't already, but don't start it. 1. Install this TeslaMate add-on if you haven't already, but don't start it.
2. Install a PostgreSQL server and start it if you haven't already. 2. Install a PostgreSQL server and start it if you haven't already.
We recommend the [PostgreSQL add-on][alexbelgium-postgres] from @alexbelgium's repository . We recommend the [PostgreSQL 17 add-on][alexbelgium-postgres] from @alexbelgium's repository, or [TimescaleDB][timescaledb] (for advanced users).
3. Perform steps 3, 4 and 5 from [Migrate TeslaMate to a Different PostreSQL Server][migrate-psql] above. 3. Perform steps 3, 4 and 5 from [Migrate TeslaMate to a Different PostreSQL Server][migrate-psql] above.
@@ -232,6 +233,7 @@ Follow this process:
5. Once imported sucessfully, delete the CSV files to avoid the import screen being presented. 5. Once imported sucessfully, delete the CSV files to avoid the import screen being presented.
[alexbelgium-postgres]: https://github.com/alexbelgium/hassio-addons/tree/master/postgres_17
[docker]: https://hub.docker.com/r/teslamate/teslamate [docker]: https://hub.docker.com/r/teslamate/teslamate
[elixir]: https://elixir-lang.org/ [elixir]: https://elixir-lang.org/
[grafana-addon]: https://github.com/hassio-addons/addon-grafana [grafana-addon]: https://github.com/hassio-addons/addon-grafana
@@ -245,6 +247,7 @@ Follow this process:
[teslafi-import]: https://docs.teslamate.org/docs/import/teslafi [teslafi-import]: https://docs.teslamate.org/docs/import/teslafi
[teslamate]: https://github.com/teslamate-org/teslamate/ [teslamate]: https://github.com/teslamate-org/teslamate/
[teslamate-backup]: https://docs.teslamate.org/docs/maintenance/backup_restore/#backup [teslamate-backup]: https://docs.teslamate.org/docs/maintenance/backup_restore/#backup
[timescaledb]: https://github.com/expaso/hassos-addon-timescaledb
[^1]: [^1]:
If the backup or restore fails due to a `server version mismatch` error, you will need to select the latest version of PostgreSQL in pgAdmin4 by going to File -> Paths -> Binary paths and add the correct path for each version. If the backup or restore fails due to a `server version mismatch` error, you will need to select the latest version of PostgreSQL in pgAdmin4 by going to File -> Paths -> Binary paths and add the correct path for each version.
+1 -2
View File
@@ -33,8 +33,7 @@ RUN \
tzdata \ tzdata \
xz-utils \ xz-utils \
&& S6_ARCH="${BUILD_ARCH}" \ && S6_ARCH="${BUILD_ARCH}" \
&& if [ "${BUILD_ARCH}" = "amd64" ]; then S6_ARCH="x86_64"; \ && if [ "${BUILD_ARCH}" = "amd64" ]; then S6_ARCH="x86_64"; fi \
elif [ "${BUILD_ARCH}" = "armv7" ]; then S6_ARCH="arm"; fi \
&& curl -Ls "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz" | tar xpJ -C / \ && curl -Ls "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz" | tar xpJ -C / \
&& curl -Ls "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_ARCH}.tar.xz" | tar xpJ -C / \ && curl -Ls "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_ARCH}.tar.xz" | tar xpJ -C / \
&& curl -Ls "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-noarch.tar.xz" | tar Jxp -C / \ && curl -Ls "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-noarch.tar.xz" | tar Jxp -C / \
+13 -4
View File
@@ -7,7 +7,7 @@ A self-hosted data logger for your Tesla 🚘
[TeslaMate][teslamate] is a powerful, self-hosted data logger for your Tesla. [TeslaMate][teslamate] is a powerful, self-hosted data logger for your Tesla.
- Written in **[Elixir][elixir]** - Written in **[Elixir][elixir]**
- Data is stored in a **Postgres** database - Data is stored in a **PostgreSQL** database
- Visualization and data analysis with **Grafana** - Visualization and data analysis with **Grafana**
- Vehicle data is published to a local **MQTT** Broker - Vehicle data is published to a local **MQTT** Broker
@@ -24,8 +24,8 @@ Thanks to @matt-FFFFFF for maintaining this add-on in the past.
## Requirements ## Requirements
TeslaMate needs a PostgreSQL database. **TeslaMate v2 needs a PostgreSQL 16.7 or 17.3 or later database.**
I recommend using the [PostgreSQL add-on][alexbelgium-postgres] from @alexbelgium's repository if you aren't already using Postgres. I recommend using the [PostgreSQL 17 add-on][alexbelgium-postgres] from @alexbelgium's repository, or [TimescaleDB][timescaledb] (for advanced users), if you aren't already using PostgreSQL.
To get the full experience, it is recommended that you also install the community [Grafana add-on][grafana-addon] and [MQTT integration][mqtt]. To get the full experience, it is recommended that you also install the community [Grafana add-on][grafana-addon] and [MQTT integration][mqtt].
@@ -46,6 +46,13 @@ To get the full experience, it is recommended that you also install the communit
1. Check the logs of the add-on to see if everything went well. 1. Check the logs of the add-on to see if everything went well.
1. Click the `OPEN WEB UI` button to open TeslaMate. 1. Click the `OPEN WEB UI` button to open TeslaMate.
## Upgrading this add-on from v1 to v2
TeslaMate v2 introduced a hard requirement on the version of PostgreSQL database.
**You will need to use PostgreSQL 16.7 or 17.3 or later.**
If you are currently using an earlier version of PostgreSQL, you will need to backup your TeslaMate data, upgrade the database, and then restore the data.
You can find details on how to do this in the "_Migrate TeslaMate to a Different Postres Server_" section of this add-on's documentation tab or in the [DOCS.md][docs-md] file in the add-on repository.
## Migrating to this version of the add-on ## Migrating to this version of the add-on
Migrating to this version of the add-on should not result in any loss of data, but you can never be too careful, so I recommend you take a full backup of your Home Assistant instance and also a direct backup of the TeslaMate database as detailed in the [TeslaMate documentation][teslamate-backup] before proceeding. Migrating to this version of the add-on should not result in any loss of data, but you can never be too careful, so I recommend you take a full backup of your Home Assistant instance and also a direct backup of the TeslaMate database as detailed in the [TeslaMate documentation][teslamate-backup] before proceeding.
@@ -67,9 +74,10 @@ Everything should pick up where it was before.
[addon]: https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2Flildude%2Fha-addons [addon]: https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2Flildude%2Fha-addons
[addons-repo]: https://github.com/lildude/ha-addons [addons-repo]: https://github.com/lildude/ha-addons
[alexbelgium-postgres]: https://github.com/alexbelgium/hassio-addons/tree/master/postgres [alexbelgium-postgres]: https://github.com/alexbelgium/hassio-addons/tree/master/postgres_17
[archs]: https://img.shields.io/badge/dynamic/json?color=green&label=Arch&query=%24.arch&url=https%3A%2F%2Fraw.githubusercontent.com%2Flildude%2Fha-addon-teslamate%2Fmain%2Fconfig.json [archs]: https://img.shields.io/badge/dynamic/json?color=green&label=Arch&query=%24.arch&url=https%3A%2F%2Fraw.githubusercontent.com%2Flildude%2Fha-addon-teslamate%2Fmain%2Fconfig.json
[docker]: https://hub.docker.com/r/teslamate/teslamate [docker]: https://hub.docker.com/r/teslamate/teslamate
[docs-md]: https://github.com/lildude/ha-addon-teslamate/blob/main/DOCS.md#migrate-teslamate-to-a-different-postgresql-server
[elixir]: https://elixir-lang.org/ [elixir]: https://elixir-lang.org/
[grafana-addon]: https://github.com/hassio-addons/addon-grafana [grafana-addon]: https://github.com/hassio-addons/addon-grafana
[ingres-badge]: https://img.shields.io/badge/dynamic/json?label=Ingress&query=%24.ingress&url=https%3A%2F%2Fraw.githubusercontent.com%2Flildude%2Fha-addon-teslamate%2Fmain%2Fconfig.json [ingres-badge]: https://img.shields.io/badge/dynamic/json?label=Ingress&query=%24.ingress&url=https%3A%2F%2Fraw.githubusercontent.com%2Flildude%2Fha-addon-teslamate%2Fmain%2Fconfig.json
@@ -79,3 +87,4 @@ Everything should pick up where it was before.
[teslamate-backup]: https://docs.teslamate.org/docs/maintenance/backup_restore [teslamate-backup]: https://docs.teslamate.org/docs/maintenance/backup_restore
[teslamate-version]: https://img.shields.io/badge/dynamic/json?label=TeslaMate%20Version&url=https%3A%2F%2Fraw.githubusercontent.com%2Flildude%2Fha-addon-teslamate%2Fmain%2Fbuild.json&query=%24.args.teslamate_version [teslamate-version]: https://img.shields.io/badge/dynamic/json?label=TeslaMate%20Version&url=https%3A%2F%2Fraw.githubusercontent.com%2Flildude%2Fha-addon-teslamate%2Fmain%2Fbuild.json&query=%24.args.teslamate_version
[teslamate]: https://github.com/teslamate-org/teslamate/ [teslamate]: https://github.com/teslamate-org/teslamate/
[timescaledb]: https://github.com/expaso/hassos-addon-timescaledb
+3 -7
View File
@@ -1,14 +1,10 @@
{ {
"build_from": { "build_from": {
"aarch64": "teslamate/teslamate:1.33.0", "aarch64": "teslamate/teslamate:3.0.0",
"amd64": "teslamate/teslamate:1.33.0", "amd64": "teslamate/teslamate:3.0.0"
"armv7": "teslamate/teslamate:1.33.0"
}, },
"args": { "args": {
"teslamate_version": "1.33.0" "teslamate_version": "3.0.0"
},
"codenotary": {
"signer": "colin@symr.io"
}, },
"labels":{ "labels":{
"maintainer": "Colin Seymour (https://github.com/lildude)", "maintainer": "Colin Seymour (https://github.com/lildude)",
+75 -75
View File
@@ -1,77 +1,77 @@
{ {
"name": "TeslaMate", "name": "TeslaMate",
"version": "dev", "version": "dev",
"slug": "teslamate", "slug": "teslamate",
"description": "A self-hosted data logger for your Tesla.", "description": "A self-hosted data logger for your Tesla.",
"url": "https://github.com/lildude/ha-addon-teslamate", "url": "https://github.com/lildude/ha-addon-teslamate",
"arch": [ "arch": [
"armv7", "aarch64",
"aarch64", "amd64"
"amd64" ],
], "hassio_api": true,
"hassio_api": true, "ingress": true,
"ingress": true, "init": false,
"init": false, "panel_icon": "mdi:car-connected",
"panel_icon": "mdi:car-connected", "panel_title": "TeslaMate",
"panel_title": "TeslaMate", "options": {
"options": { "database_user": null,
"database_user": null, "database_pass": null,
"database_pass": null, "database_name": "teslamate",
"database_name": "teslamate", "database_host": null,
"database_host": null, "database_port": 5432,
"database_port": 5432, "database_ssl": false,
"database_ssl": false, "grafana_import_dashboards": true,
"grafana_import_dashboards": true, "grafana_folder_name": "TeslaMate",
"grafana_folder_name": "TeslaMate", "grafana_host": "a0d7b954-grafana",
"grafana_host": "a0d7b954-grafana", "grafana_port": 3000,
"grafana_port": 3000, "grafana_user": "",
"grafana_user": "", "grafana_pass": "",
"grafana_pass": "", "disable_mqtt": false,
"disable_mqtt": false, "mqtt_host": "core-mosquitto",
"mqtt_host": "core-mosquitto", "mqtt_user": "",
"mqtt_user": "", "mqtt_pass": "",
"mqtt_pass": "", "mqtt_tls": false,
"mqtt_tls": false, "mqtt_tls_accept_invalid_certs": false,
"mqtt_tls_accept_invalid_certs": false, "mqtt_namespace": "",
"mqtt_namespace": "", "timezone": "Europe/London",
"timezone": "Europe/London", "import_dir": "/share/teslamate",
"import_dir": "/share/teslamate", "default_geofence": "",
"default_geofence": "", "encryption_key": "",
"encryption_key": "", "env_vars": []
"env_vars": [] },
}, "schema": {
"schema": { "database_user": "str",
"database_user": "str", "database_pass": "password",
"database_pass": "password", "database_name": "str",
"database_name": "str", "database_host": "str",
"database_host": "str", "database_ssl": "bool",
"database_ssl": "bool", "database_port": "int",
"database_port": "int", "grafana_import_dashboards": "bool",
"grafana_import_dashboards": "bool", "grafana_folder_name": "str",
"grafana_folder_name": "str", "grafana_host": "str",
"grafana_host": "str", "grafana_port": "int",
"grafana_port": "int", "grafana_user": "str?",
"grafana_user": "str?", "grafana_pass": "password?",
"grafana_pass": "password?", "disable_mqtt": "bool",
"disable_mqtt": "bool", "mqtt_host": "str?",
"mqtt_host": "str?", "mqtt_user": "str?",
"mqtt_user": "str?", "mqtt_pass": "password?",
"mqtt_pass": "password?", "mqtt_tls": "bool",
"mqtt_tls": "bool", "mqtt_tls_accept_invalid_certs": "bool",
"mqtt_tls_accept_invalid_certs": "bool", "mqtt_namespace": "str?",
"mqtt_namespace": "str?", "timezone": "str",
"timezone": "str", "import_dir": "str",
"import_dir": "str", "default_geofence": "str?",
"default_geofence": "str?", "encryption_key": "password?",
"encryption_key": "password?", "env_vars": [
"env_vars": [{ {
"name": "str?", "name": "str?",
"value": "str?" "value": "str?"
}] }
}, ]
"map": [ },
"share:rw" "map": [
], "share:rw"
"codenotary": "colin@symr.io", ],
"image": "ghcr.io/lildude/ha-addon-teslamate-{arch}" "image": "ghcr.io/lildude/ha-addon-teslamate-{arch}"
} }
+40 -13
View File
@@ -52,14 +52,30 @@ for env_var in $(bashio::config 'env_vars|keys'); do
export "${name}=${value}" export "${name}=${value}"
done done
# Import dashboards
if bashio::config.true 'grafana_import_dashboards'; then
/dashboards.sh restore || bashio::log.error "Failed to import dashboards"
fi
# Create the PostgreSQL database if it doesn't exist # Create the PostgreSQL database if it doesn't exist
bashio::log.info "Checking for database '$DATABASE_NAME' on $DATABASE_HOST"
if pg_isready -h "$DATABASE_HOST" -p "$DATABASE_PORT" > /dev/null 2>&1; then if pg_isready -h "$DATABASE_HOST" -p "$DATABASE_PORT" > /dev/null 2>&1; then
bashio::log.info "Checking for database '$DATABASE_NAME' on $DATABASE_HOST" # Check the version of PostgreSQL database is v16.7 or later or v17.3 or later
pg_version=$(PGPASSWORD="$DATABASE_PASS" psql -h "$DATABASE_HOST" -p "$DATABASE_PORT" -U "$DATABASE_USER" postgres -Atqc "SELECT regexp_replace(version(), 'PostgreSQL ([^ ]+) .*', '\\1') AS version")
major_version=$(echo "$pg_version" | cut -d '.' -f 1)
minor_version=$(echo "$pg_version" | cut -d '.' -f 2)
compat=true
case "$major_version" in
16)
[[ "$minor_version" -lt 7 ]] && compat=false
;;
17)
[[ "$minor_version" -lt 3 ]] && compat=false
;;
*)
[[ "$major_version" -lt 16 ]] && compat=false
;;
esac
if [ $compat = false ]; then
bashio::log.error "PostgreSQL version $pg_version is not supported. Please upgrade to v16.7 or later or v17.3 or later."
exit 1
fi
if [[ -n $(PGPASSWORD="$DATABASE_PASS" psql -h "$DATABASE_HOST" -p "$DATABASE_PORT" -U "$DATABASE_USER" postgres -Atqc "SELECT datname FROM pg_database WHERE datname = '$DATABASE_NAME'") ]]; then if [[ -n $(PGPASSWORD="$DATABASE_PASS" psql -h "$DATABASE_HOST" -p "$DATABASE_PORT" -U "$DATABASE_USER" postgres -Atqc "SELECT datname FROM pg_database WHERE datname = '$DATABASE_NAME'") ]]; then
bashio::log.info "Database $DATABASE_NAME already exists" bashio::log.info "Database $DATABASE_NAME already exists"
@@ -76,21 +92,32 @@ else
exit 1 exit 1
fi fi
# Import dashboards
if bashio::config.true 'grafana_import_dashboards'; then
bashio::log.info "Importing Grafana dashboards..."
/dashboards.sh restore || bashio::log.error "Failed to import dashboards"
fi
if [[ -z $(PGPASSWORD="$DATABASE_PASS" psql -h "$DATABASE_HOST" -p "$DATABASE_PORT" -U "$DATABASE_USER" "$DATABASE_NAME" -Atqc "SELECT 1 FROM settings WHERE base_url LIKE '%api/hassio_ingress%'" 2> /dev/null ) ]]; then if [[ -z $(PGPASSWORD="$DATABASE_PASS" psql -h "$DATABASE_HOST" -p "$DATABASE_PORT" -U "$DATABASE_USER" "$DATABASE_NAME" -Atqc "SELECT 1 FROM settings WHERE base_url LIKE '%api/hassio_ingress%'" 2> /dev/null ) ]]; then
teslamate_ingress=$(bashio::addon.ingress_entry) teslamate_ingress=$(bashio::addon.ingress_entry)
grafana_ingress=$(bashio::addon.ingress_entry $(bashio::supervisor.addons | grep grafana)) grafana_ingress=$(bashio::addon.ingress_entry "$(bashio::supervisor.addons | grep grafana)")
if [[ "$teslamate_ingress" == "$grafana_ingress" ]]; then if [[ "$teslamate_ingress" == "$grafana_ingress" ]]; then
grafana_ingress="** Grafana addon not found. Ensure the addon is installed and running. **" grafana_ingress="** Grafana addon not found. Ensure the addon is installed and running. **"
fi fi
bashio::log.info "Configure TeslaMate settings by adding these values bashio::log.notice ""
to the URL you use to access your Home Assistant instance: bashio::log.notice "Configure TeslaMate settings by adding these values"
bashio::log.notice "to the URL you use to access your Home Assistant instance:"
bashio::log.notice ""
bashio::log.notice "=> Web App: $teslamate_ingress"
bashio::log.notice "=> Dashboards: $grafana_ingress"
bashio::log.notice ""
fi
=> Web App: $teslamate_ingress # Set max open file limit to avoid memory allocation issues
=> Dashboards: $grafana_ingress if [ "$(ulimit -Hn)" -gt 524288 ]; then
" ulimit -n 524288
fi fi
ulimit -n 1048576
bashio::log.info "Starting TeslaMate..." bashio::log.info "Starting TeslaMate..."