mirror of
https://github.com/lildude/ha-addon-teslamate.git
synced 2026-10-13 21:19:16 -04:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
04eb3228bd | ||
|
|
a5180bcb8e | ||
|
|
f2d6fcd514 | ||
|
|
540732b90a | ||
|
|
33d50cce75 | ||
|
|
b5ab114562 | ||
|
|
b17ded97f6 | ||
|
|
3a9e27e9ac | ||
|
|
fb4eff6570 | ||
|
|
d54d94a480 |
@@ -35,14 +35,14 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
uses: docker/login-action@v3.3.0
|
uses: docker/login-action@v3.4.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@2024.08.2
|
uses: home-assistant/builder@2025.02.0
|
||||||
with:
|
with:
|
||||||
args: |
|
args: |
|
||||||
--${{ matrix.arch }} \
|
--${{ matrix.arch }} \
|
||||||
|
|||||||
@@ -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.0.8
|
uses: softprops/action-gh-release@v2.2.1
|
||||||
with:
|
with:
|
||||||
tag_name: v${{ steps.semver.outputs.semver }}
|
tag_name: v${{ steps.semver.outputs.semver }}
|
||||||
body_path: CHANGELOG.txt
|
body_path: CHANGELOG.txt
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4.2.2
|
uses: actions/checkout@v4.2.2
|
||||||
|
|
||||||
- name: Build add-on
|
- name: Build add-on
|
||||||
uses: home-assistant/builder@2024.08.2
|
uses: home-assistant/builder@2025.02.0
|
||||||
with:
|
with:
|
||||||
args: |
|
args: |
|
||||||
--test \
|
--test \
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ This add-on allows you to run [TeslaMate][teslamate] on your Home Assistant serv
|
|||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
The configuration is self-explanatory, but essentially we need details about accessing the PostgreSQL database, Grafana and optionally MQTT.
|
The configuration is self-explanatory, but essentially we need details about accessing the PostgreSQL database, Grafana and optionally MQTT.
|
||||||
|
You will also need to configure TeslaMate (see "TeslaMate Configuration" below) so the links to TeslaMate in the Grafana dashboards work.
|
||||||
|
|
||||||
### Options
|
### Options
|
||||||
|
|
||||||
@@ -105,6 +106,8 @@ _Note_ that the security admin password and usernames can only be set on the fir
|
|||||||
|
|
||||||
Once you have Grafana up and running, you'll need to configure a data source to read data from the PostgreSQL database:
|
Once you have Grafana up and running, you'll need to configure a data source to read data from the PostgreSQL database:
|
||||||
|
|
||||||
|
‼️ **Note**: The name must be `TeslaMate` as all the dashboards expect the datasource to use this name.
|
||||||
|
|
||||||
![Grafana Postgres data source][grafana-datasource]
|
![Grafana Postgres data source][grafana-datasource]
|
||||||
|
|
||||||
#### Other Options
|
#### Other Options
|
||||||
@@ -124,6 +127,30 @@ Once you have Grafana up and running, you'll need to configure a data source to
|
|||||||
|
|
||||||
Note: These will also overwrite any environment variable set using the configuration options above.
|
Note: These will also overwrite any environment variable set using the configuration options above.
|
||||||
|
|
||||||
|
## TeslaMate Configuration
|
||||||
|
|
||||||
|
In order for the links in the Grafana dashboards and the TeslaMate UI to link to the correct locations, you will also need to configure TeslaMate.
|
||||||
|
Once you have started the addon, look at the log output for the section which looks like this and take note of the two lines with `=>`:
|
||||||
|
|
||||||
|
```
|
||||||
|
[09:26:32] INFO: Configure TeslaMate settings by adding these values
|
||||||
|
to the URL you use to access your Home Assistant instance:
|
||||||
|
|
||||||
|
=> Web App: /api/hassio_ingress/ljiIc6sOVGOSQfTRjscvLVJJS5Rxp33gsdEtf9y3oQY
|
||||||
|
=> Dashboards: /api/hassio_ingress/G9ocwA44wt9Bcba8LvP8tDhlfFiFnnPftOZBwp-Pgzs
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
From the addon Info tab, click "Open Web UI", enter the Tesla API access and refresh tokens if you haven't already, and then go to TeslaMate's Settings.
|
||||||
|
Scroll to the very bottom and set each of the URLs to the URL you use to access your Home Assistant instance with each of the above appended.
|
||||||
|
|
||||||
|
For example, if you access your Home Assistant instance at `https://ha.example.com`, set each as follows:
|
||||||
|
|
||||||
|
- Web App: `https://ha.example.com/api/hassio_ingress/ljiIc6sOVGOSQfTRjscvLVJJS5Rxp33gsdEtf9y3oQY`
|
||||||
|
- Dashboards: `https://ha.example.com/api/hassio_ingress/G9ocwA44wt9Bcba8LvP8tDhlfFiFnnPftOZBwp-Pgzs`
|
||||||
|
|
||||||
|
Do _not_ use these values. Use the values from your log output.
|
||||||
|
|
||||||
## Data Import from TeslaFi
|
## Data Import from TeslaFi
|
||||||
|
|
||||||
It is now possible to import CSV data from TeslaFi, refer to the [official docs][teslafi-import].
|
It is now possible to import CSV data from TeslaFi, refer to the [official docs][teslafi-import].
|
||||||
|
|||||||
+4
-4
@@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"build_from": {
|
"build_from": {
|
||||||
"aarch64": "teslamate/teslamate:1.31.1",
|
"aarch64": "teslamate/teslamate:1.32.0",
|
||||||
"amd64": "teslamate/teslamate:1.31.1",
|
"amd64": "teslamate/teslamate:1.32.0",
|
||||||
"armv7": "teslamate/teslamate:1.31.1"
|
"armv7": "teslamate/teslamate:1.32.0"
|
||||||
},
|
},
|
||||||
"args": {
|
"args": {
|
||||||
"teslamate_version": "1.31.1"
|
"teslamate_version": "1.32.0"
|
||||||
},
|
},
|
||||||
"codenotary": {
|
"codenotary": {
|
||||||
"signer": "colin@symr.io"
|
"signer": "colin@symr.io"
|
||||||
|
|||||||
@@ -54,6 +54,24 @@ backup() {
|
|||||||
|
|
||||||
|
|
||||||
restore() {
|
restore() {
|
||||||
|
bashio::log.info "Checking for Grafana datasource: TeslaMate"
|
||||||
|
datasources=$(curl --silent --show-error \
|
||||||
|
--user "$LOGIN" -H "Content-Type: application/json" \
|
||||||
|
"$URL/api/datasources")
|
||||||
|
|
||||||
|
if [[ $datasources == *"statusCode"* ]]; then
|
||||||
|
bashio::log.error "Error getting Grafana datasources: $(echo "$datasources" | jq -r .message)"
|
||||||
|
bashio::log.debug "$datasources"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
DS=$(echo "$datasources" | jq ".[] | select(.name==\"TeslaMate\")")
|
||||||
|
|
||||||
|
if [[ -z "$DS" ]]; then
|
||||||
|
bashio::log.error "'TeslaMate' datasource not found. Please create or rename your datasource. It must be named 'TeslaMate'."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
bashio::log.info "Checking for Grafana folder: $FOLDER_NAME"
|
bashio::log.info "Checking for Grafana folder: $FOLDER_NAME"
|
||||||
folders=$(curl --silent --show-error \
|
folders=$(curl --silent --show-error \
|
||||||
--user "$LOGIN" -H "Content-Type: application/json" \
|
--user "$LOGIN" -H "Content-Type: application/json" \
|
||||||
|
|||||||
@@ -59,9 +59,9 @@ fi
|
|||||||
|
|
||||||
# Create the PostgreSQL database if it doesn't exist
|
# Create the PostgreSQL database if it doesn't exist
|
||||||
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 "Creating database '$DATABASE_NAME' on $DATABASE_HOST"
|
bashio::log.info "Checking for database '$DATABASE_NAME' on $DATABASE_HOST"
|
||||||
|
|
||||||
if [[ -n $(PGPASSWORD="$DATABASE_PASS" psql -h "$DATABASE_HOST" -p "$DATABASE_PORT" -U "$DATABASE_USER" postgres -Atqc "\list \"$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"
|
||||||
else
|
else
|
||||||
if PGPASSWORD="$DATABASE_PASS" psql -h "$DATABASE_HOST" -p "$DATABASE_PORT" -U "$DATABASE_USER" postgres -qc "CREATE DATABASE \"$DATABASE_NAME\""; then
|
if PGPASSWORD="$DATABASE_PASS" psql -h "$DATABASE_HOST" -p "$DATABASE_PORT" -U "$DATABASE_USER" postgres -qc "CREATE DATABASE \"$DATABASE_NAME\""; then
|
||||||
@@ -76,6 +76,17 @@ else
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
||||||
|
teslamate_ingress=$(bashio::addon.ingress_entry)
|
||||||
|
grafana_ingress=$(bashio::addon.ingress_entry $(bashio::supervisor.addons | grep grafana))
|
||||||
|
|
||||||
|
bashio::log.info "Configure TeslaMate settings by adding these values
|
||||||
|
to the URL you use to access your Home Assistant instance:
|
||||||
|
|
||||||
|
=> Web App: $teslamate_ingress
|
||||||
|
=> Dashboards: $grafana_ingress
|
||||||
|
"
|
||||||
|
fi
|
||||||
ulimit -n 1048576
|
ulimit -n 1048576
|
||||||
|
|
||||||
bashio::log.info "Starting TeslaMate..."
|
bashio::log.info "Starting TeslaMate..."
|
||||||
|
|||||||
Reference in New Issue
Block a user