diff --git a/.github/workflows/buildx.yml b/.github/workflows/buildx.yml index 8dcbefc0a3..d87579288f 100644 --- a/.github/workflows/buildx.yml +++ b/.github/workflows/buildx.yml @@ -46,7 +46,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Buildx uses: ./.github/actions/build with: @@ -65,7 +65,7 @@ jobs: if: needs.check_paths.outputs.githubfolder != 'true' || github.event_name == 'schedule' steps: - name: Checkout - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Login to Docker Hub uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 @@ -88,7 +88,7 @@ jobs: timeout-minutes: 10 steps: - name: Checkout - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Login to Docker Hub uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 diff --git a/.github/workflows/check_paths.yml b/.github/workflows/check_paths.yml index 701433b7f7..b9f0b46dd5 100644 --- a/.github/workflows/check_paths.yml +++ b/.github/workflows/check_paths.yml @@ -17,7 +17,7 @@ jobs: outputs: githubfolder: ${{ steps.filter.outputs.githubfolder }} steps: - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 id: filter diff --git a/.github/workflows/elixir_dep_verification_and_static_analysis.yml b/.github/workflows/elixir_dep_verification_and_static_analysis.yml index 147da6d43a..0cc1b936aa 100644 --- a/.github/workflows/elixir_dep_verification_and_static_analysis.yml +++ b/.github/workflows/elixir_dep_verification_and_static_analysis.yml @@ -21,7 +21,7 @@ jobs: contents: read steps: - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Setup Elixir and Cache Dependencies id: setup-elixir-and-cache-deps @@ -43,7 +43,7 @@ jobs: - name: Restore PLT cache id: plt_cache - uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 + uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 with: key: | ${{ runner.os }}-${{ steps.setup-elixir-and-cache-deps.outputs.elixir-version }}-${{ steps.setup-elixir-and-cache-deps.outputs.otp-version }}-plt @@ -58,7 +58,7 @@ jobs: - name: Save PLT cache id: plt_cache_save - uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 + uses: actions/cache/save@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 if: steps.plt_cache.outputs.cache-hit != 'true' with: key: | diff --git a/.github/workflows/elixir_test.yml b/.github/workflows/elixir_test.yml index afead572fe..458f6f2d11 100644 --- a/.github/workflows/elixir_test.yml +++ b/.github/workflows/elixir_test.yml @@ -29,7 +29,7 @@ jobs: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 steps: - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Setup Elixir and Cache Dependencies id: setup-elixir-and-cache-deps diff --git a/.github/workflows/ensure_linting.yml b/.github/workflows/ensure_linting.yml index 6892c44922..813c459003 100644 --- a/.github/workflows/ensure_linting.yml +++ b/.github/workflows/ensure_linting.yml @@ -10,10 +10,10 @@ jobs: check_linting: runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Install Nix - uses: cachix/install-nix-action@ba0dd844c9180cbf77aa72a116d6fbc515d0e87b #v27 + uses: cachix/install-nix-action@08dcb3a5e62fa31e2da3d490afc4176ef55ecd72 #v30 with: github_access_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ghcr_build.yml b/.github/workflows/ghcr_build.yml index 38f7789ffc..76007a445b 100644 --- a/.github/workflows/ghcr_build.yml +++ b/.github/workflows/ghcr_build.yml @@ -41,9 +41,9 @@ jobs: runs-on: ${{ matrix.runs_on }} timeout-minutes: 10 steps: - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 if: ${{ github.event_name != 'pull_request_target' }} - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 if: ${{ github.event_name == 'pull_request_target' }} with: ref: ${{github.event.pull_request.head.ref}} @@ -70,7 +70,7 @@ jobs: timeout-minutes: 10 steps: - name: Checkout - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Login to GitHub Container Registry uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 with: @@ -88,9 +88,9 @@ jobs: if: needs.check_paths.outputs.githubfolder != 'true' runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 if: ${{ github.event_name != 'pull_request_target' }} - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 if: ${{ github.event_name == 'pull_request_target' }} with: ref: ${{github.event.pull_request.head.ref}} diff --git a/.github/workflows/spell_check.yml b/.github/workflows/spell_check.yml index 5fbecbe1a1..0717ed224f 100644 --- a/.github/workflows/spell_check.yml +++ b/.github/workflows/spell_check.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Spell check uses: crate-ci/typos@6802cc60d4e7f78b9d5454f6cf3935c042d5e1e3 # v1.26.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index 9082cf996c..1e35132f70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,16 +6,35 @@ ### Improvements and bug fixes +- feat: use Grafana 11.2.3 (#4338 - @swiffer) + #### Build, CI, internal - ci: remove unknown flag --ref for gh cache delete in cleanup_caches workflow ([3a515df](https://github.com/teslamate-org/teslamate/commit/3a515df5aa400139acf8ef638e5ae37339c553cf) - @JakobLichterfeld) +- build(deps): bump actions/checkout from 4.2.1 to 4.2.2 (#4340) +- build(deps): bump actions/cache from 4.0.2 to 4.1.2 (#4341) +- build(deps): bump cachix/install-nix-action from 27 to 30 (#4342) +- build(deps): bump tesla from 1.12.1 to 1.13.0 (#4335) +- build(deps): bump floki from 0.36.2 to 0.36.3 (#4336) +- feat: add CONTRIBUTING file to exclusion lists for treefmt (#4359 - @JakobLichterfeld) #### Dashboards +- fix: allow editing of dashboards - [changes will be overwritten on update](https://grafana.com/docs/grafana/latest/administration/provisioning/#making-changes-to-a-provisioned-dashboard) (#4338 - @swiffer) +- fix: ensure max speed panels are converted according to length unit setting in drive stats dashboard (#4338 - @swiffer) +- perf: speed up queries used to calculate max speed in drive stats dashboard (#4338 - @swiffer) +- feat: add a welcome dashboard (#4338 - @swiffer) +- fix: Charges Dashboard -> Range added renamed to Ø Charge rate (#4349 - @swiffer) +- fix: Axis Labels for XY Chart in Battery Health and reduces Query count in Visited (#4364 - @swiffer) + #### Translations #### Documentation +docs: add contributing guidelines link for GitHub (#4345 - @JakobLichterfeld) +docs: update Home Assistant integration documentation with configuration URL and model name hints (#4359 - @JakobLichterfeld) +docs: Remove availability from Home Assistant MQTT sensors, as it can be misleading and prevent sensors from receiving updated values (#4362 - @longzheng) + ## [1.31.1] - 2024-10-29 This release primarily prevents beam.smp from overloading the CPU on ARM hosts. It also includes a number of other bug fixes and performance improvements. Enjoy it. diff --git a/CONTRIBUTING b/CONTRIBUTING new file mode 100644 index 0000000000..592e63e8b3 --- /dev/null +++ b/CONTRIBUTING @@ -0,0 +1,3 @@ +# Contributing Guidelines + +see [Development and Contributing](https://docs.teslamate.org/docs/development/) diff --git a/grafana/Dockerfile b/grafana/Dockerfile index a4d0a79542..fa5090d2bc 100644 --- a/grafana/Dockerfile +++ b/grafana/Dockerfile @@ -1,6 +1,6 @@ # Ensure selecting a tag that is available for arm/v7, arm64, and amd64 # https://hub.docker.com/r/grafana/grafana/tags -FROM grafana/grafana:11.0.6-security-01 +FROM grafana/grafana:11.2.3 ENV GF_ANALYTICS_REPORTING_ENABLED=false \ GF_AUTH_ANONYMOUS_ENABLED=false \ @@ -12,6 +12,7 @@ ENV GF_ANALYTICS_REPORTING_ENABLED=false \ GF_USERS_ALLOW_SIGN_UP=false \ GF_USERS_DEFAULT_LANGUAGE=detect \ GF_DATE_FORMATS_USE_BROWSER_LOCALE=true \ + GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH=/dashboards_internal/home.json \ DATABASE_PORT=5432 \ DATABASE_SSL_MODE=disable diff --git a/grafana/dashboards.yml b/grafana/dashboards.yml index c093235f08..6c9e3f7bf8 100644 --- a/grafana/dashboards.yml +++ b/grafana/dashboards.yml @@ -7,7 +7,7 @@ providers: folderUid: Nr4ofiDZk type: file disableDeletion: false - editable: true + allowUiUpdates: true updateIntervalSeconds: 86400 options: path: /dashboards @@ -17,7 +17,7 @@ providers: folderUid: Nr5ofiDZk type: file disableDeletion: false - editable: true + allowUiUpdates: true updateIntervalSeconds: 86400 options: path: /dashboards_internal @@ -27,7 +27,7 @@ providers: folderUid: Nr6ofiDZk type: file disableDeletion: false - editable: true + allowUiUpdates: true updateIntervalSeconds: 86400 options: path: /dashboards_reports diff --git a/grafana/dashboards/battery-health.json b/grafana/dashboards/battery-health.json index 25af196210..cd29209a0c 100644 --- a/grafana/dashboards/battery-health.json +++ b/grafana/dashboards/battery-health.json @@ -17,7 +17,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.1.0" + "version": "11.2.3" }, { "type": "datasource", @@ -150,7 +150,7 @@ "textMode": "value_and_name", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -298,7 +298,7 @@ "textMode": "value_and_name", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -402,7 +402,7 @@ "textMode": "value_and_name", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -414,7 +414,7 @@ "hide": false, "rawQuery": true, "rawSql": "select ROUND(convert_km(sum(distance)::numeric, '$length_unit'),0)|| ' $length_unit' as \"Logged\"\r\nfrom drives \r\nwhere car_id = $car_id;\r\n", - "refId": "Looged", + "refId": "Logged", "sql": { "columns": [ { @@ -658,7 +658,6 @@ "sort": "none" } }, - "pluginVersion": "8.5.6", "targets": [ { "datasource": { @@ -774,7 +773,7 @@ "showThresholdMarkers": true, "sizing": "auto" }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -873,7 +872,7 @@ "sizing": "auto", "valueMode": "color" }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -999,7 +998,7 @@ "textMode": "value_and_name", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1246,7 +1245,7 @@ "text": {}, "valueMode": "color" }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1441,7 +1440,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1453,7 +1452,7 @@ "hide": false, "rawQuery": true, "rawSql": "SELECT ('$aux'::json -> 'RatedEfficiency')::text::float * \r\n CASE \r\n WHEN '$length_unit' = 'km' THEN 10\r\n WHEN '$length_unit' = 'mi' THEN 16.0934 \r\n END AS efficiency_$length_unit", - "refId": "Looged", + "refId": "Logged", "sql": { "columns": [ { @@ -1541,7 +1540,7 @@ "text": {}, "valueMode": "color" }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1631,14 +1630,17 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "fillOpacity": 50, "hideFrom": { "legend": false, "tooltip": false, "viz": false }, + "pointShape": "circle", "pointSize": { "fixed": 6 }, + "pointStrokeWidth": 1, "scaleDistribution": { "type": "linear" }, @@ -1675,6 +1677,33 @@ "value": "lines" } ] + }, + { + "matcher": { + "id": "byName", + "options": "kWh" + }, + "properties": [ + { + "id": "custom.pointSize.fixed", + "value": 5 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "M-kWh" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "dark-red", + "mode": "fixed" + } + } + ] } ] }, @@ -1692,37 +1721,62 @@ "placement": "bottom", "showLegend": false }, + "mapping": "manual", "series": [ { - "name": "Odometer", - "pointColor": { - "field": "kWh" + "color": { + "matcher": { + "id": "byName", + "options": "kWh" + } }, - "pointSize": { - "fixed": 5, - "max": 100, - "min": 1 + "frame": { + "matcher": { + "id": "byIndex", + "options": 0 + } }, - "x": "Odometer", - "y": "kWh" + "x": { + "matcher": { + "id": "byName", + "options": "Odometer" + } + }, + "y": { + "matcher": { + "id": "byName", + "options": "kWh" + } + } }, { - "name": "Median Odometer", - "pointColor": { - "fixed": "dark-red" + "frame": { + "matcher": { + "id": "byIndex", + "options": 1 + } }, - "x": "M-Odometer", - "y": "M-kWh" + "x": { + "matcher": { + "id": "byName", + "options": "M-Odometer" + } + }, + "y": { + "matcher": { + "id": "byName", + "options": "M-kWh" + } + } } ], - "seriesMapping": "manual", "tooltip": { "maxHeight": 600, "mode": "single", "sort": "none" } }, - "pluginVersion": "8.5.6", + "pluginVersion": "11.2.3", "targets": [ { "alias": "", @@ -1844,14 +1898,14 @@ "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, - "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC", + "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC", "hide": 0, "includeAll": false, "label": "Car", "multi": false, "name": "car_id", "options": [], - "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC", + "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC", "refresh": 1, "regex": "", "skipUrlSync": false, @@ -1999,6 +2053,6 @@ "timezone": "browser", "title": "Battery Health", "uid": "jchmRiqUfXgTM", - "version": 11, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/charge-level.json b/grafana/dashboards/charge-level.json index 78edf73920..723664f58d 100644 --- a/grafana/dashboards/charge-level.json +++ b/grafana/dashboards/charge-level.json @@ -5,7 +5,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.1.0" + "version": "11.2.3" }, { "type": "datasource", @@ -96,6 +96,7 @@ "axisLabel": "Charge Level", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 10, "gradientMode": "opacity", @@ -163,7 +164,6 @@ "sort": "none" } }, - "pluginVersion": "8.5.4", "targets": [ { "alias": "", @@ -323,14 +323,14 @@ "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, - "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "hide": 2, "includeAll": true, "label": "Car", "multi": false, "name": "car_id", "options": [], - "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "refresh": 1, "regex": "", "skipUrlSync": false, @@ -365,7 +365,7 @@ }, { "current": { - "selected": true, + "selected": false, "text": "2h", "value": "7200" }, @@ -399,7 +399,7 @@ }, { "current": { - "selected": true, + "selected": false, "text": "yes", "value": "1" }, @@ -427,7 +427,7 @@ }, { "current": { - "selected": true, + "selected": false, "text": "1/6 of interval", "value": "6" }, @@ -507,6 +507,6 @@ "timezone": "", "title": "Charge Level", "uid": "WopVO_mgz", - "version": 22, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/charges.json b/grafana/dashboards/charges.json index d68cd2a66a..be2f4c83cc 100644 --- a/grafana/dashboards/charges.json +++ b/grafana/dashboards/charges.json @@ -5,7 +5,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.0.6+security-01" + "version": "11.2.3" }, { "type": "datasource", @@ -150,6 +150,7 @@ "graphMode": "none", "justifyMode": "center", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "sum" @@ -161,7 +162,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.0.6+security-01", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -247,6 +248,7 @@ "graphMode": "none", "justifyMode": "center", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "sum" @@ -258,7 +260,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.0.6+security-01", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -345,6 +347,7 @@ "graphMode": "none", "justifyMode": "center", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "sum" @@ -356,7 +359,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.0.6+security-01", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -444,6 +447,7 @@ "graphMode": "none", "justifyMode": "center", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -455,7 +459,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.0.6+security-01", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -534,7 +538,7 @@ { "targetBlank": false, "title": "View charge details", - "url": "d/BHhxFeZRz?from=${__data.fields.start_date_ts.numeric}&to=${__data.fields.end_date_ts.numeric}&var-car_id=${__data.fields.car_id.numeric}&var-charging_process_id=${__data.fields.id.numeric}" + "url": "d/BHhxFeZRz/charge-details?from=${__data.fields.start_date_ts.numeric}&to=${__data.fields.end_date_ts.numeric}&var-car_id=${__data.fields.car_id.numeric}&var-charging_process_id=${__data.fields.id.numeric}" } ] }, @@ -720,7 +724,7 @@ }, { "id": "custom.minWidth", - "value": 60 + "value": 70 } ] }, @@ -777,16 +781,36 @@ { "matcher": { "id": "byName", - "options": "distance_km" + "options": "range_added_km" }, "properties": [ { "id": "displayName", - "value": "Driven (km)" + "value": "Range gained" + }, + { + "id": "decimals", + "value": 0 + }, + { + "id": "custom.minWidth", + "value": 120 }, { "id": "unit", - "value": "none" + "value": "lengthkm" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "range_added_mi" + }, + "properties": [ + { + "id": "displayName", + "value": "Range gained" }, { "id": "decimals", @@ -794,7 +818,11 @@ }, { "id": "custom.minWidth", - "value": 95 + "value": 120 + }, + { + "id": "unit", + "value": "lengthmi" } ] }, @@ -806,7 +834,7 @@ "properties": [ { "id": "displayName", - "value": "Power avg" + "value": "Ø Power" }, { "id": "unit", @@ -856,7 +884,7 @@ "properties": [ { "id": "displayName", - "value": "Range added" + "value": "Ø Charge rate" }, { "id": "unit", @@ -922,26 +950,6 @@ } ] }, - { - "matcher": { - "id": "byName", - "options": "distance_mi" - }, - "properties": [ - { - "id": "displayName", - "value": "Driven (mi)" - }, - { - "id": "decimals", - "value": 0 - }, - { - "id": "custom.minWidth", - "value": 95 - } - ] - }, { "matcher": { "id": "byName", @@ -950,7 +958,7 @@ "properties": [ { "id": "displayName", - "value": "Range added" + "value": "Ø Charge rate" }, { "id": "unit", @@ -1133,13 +1141,45 @@ }, { "matcher": { - "id": "byRegexp", - "options": "/odometer_.*/" + "id": "byName", + "options": "odometer_km" + }, + "properties": [ + { + "id": "unit", + "value": "km" + }, + { + "id": "displayName", + "value": "Odometer" + }, + { + "id": "custom.width", + "value": 95 + }, + { + "id": "decimals", + "value": 0 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "odometer_mi" }, "properties": [ + { + "id": "unit", + "value": "mi" + }, { "id": "displayName", - "value": "Odometer ($length_unit)" + "value": "Odometer" + }, + { + "id": "custom.width", + "value": 95 }, { "id": "decimals", @@ -1169,7 +1209,7 @@ "showHeader": true, "sortBy": [] }, - "pluginVersion": "11.0.6+security-01", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1181,7 +1221,7 @@ "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "WITH data AS (\n SELECT\n (round(extract(epoch FROM start_date) - 10) * 1000) AS start_date_ts,\n (round(extract(epoch FROM end_date) + 10) * 1000) AS end_date_ts,\n start_date,\n end_date,\n CONCAT_WS(', ', COALESCE(addresses.name, nullif(CONCAT_WS(' ', addresses.road, addresses.house_number), '')), addresses.city) AS address,\n g.name as geofence_name,\n g.id as geofence_id,\n p.latitude,\n p.longitude,\n cp.charge_energy_added,\n cp.charge_energy_used,\n duration_min,\n start_battery_level,\n end_battery_level,\n start_${preferred_range}_range_km,\n end_${preferred_range}_range_km,\n outside_temp_avg,\n cp.id,\n lag(end_${preferred_range}_range_km) OVER (ORDER BY start_date) - start_${preferred_range}_range_km AS range_loss,\n p.odometer - lag(p.odometer) OVER (ORDER BY start_date) AS distance,\n cars.efficiency,\n cp.car_id,\n cost,\n max(c.charger_voltage) as max_charger_voltage,\n CASE WHEN NULLIF(mode() within group (order by charger_phases),0) is null THEN 'DC' ELSE 'AC' END AS charge_type,\n p.odometer as odometer\n FROM\n charging_processes cp\n\t LEFT JOIN charges c ON cp.id = c.charging_process_id\n LEFT JOIN positions p ON p.id = cp.position_id\n LEFT JOIN cars ON cars.id = cp.car_id\n LEFT JOIN addresses ON addresses.id = cp.address_id\n LEFT JOIN geofences g ON g.id = geofence_id\nWHERE \n cp.car_id = $car_id AND\n $__timeFilter(start_date) AND\n (cp.charge_energy_added IS NULL OR cp.charge_energy_added > 0) AND\n ('${geofence:pipe}' = '-1' OR geofence_id in ($geofence))\nGROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,12,13,14,15,16,17,18,21,p.odometer\nORDER BY\n start_date\n)\nSELECT\n start_date_ts,\n end_date_ts,\n CASE WHEN geofence_id IS NULL THEN CONCAT('new?lat=', latitude, '&lng=', longitude)\n WHEN geofence_id IS NOT NULL THEN CONCAT(geofence_id, '/edit')\n END as path,\n car_id,\n id,\n -- Columns\n start_date,\n end_date,\n COALESCE(geofence_name, address) as address, \n charge_type,\n duration_min,\n cost,\n cost / NULLIF(greatest(charge_energy_added, charge_energy_used), 0) as cost_per_kwh,\n charge_energy_added,\n charge_energy_used,\n CASE WHEN charge_energy_used IS NULL THEN NULL ELSE LEAST(charge_energy_added / NULLIF(charge_energy_used, 0), 1.0) END as charging_efficiency,\n convert_celsius(outside_temp_avg, '$temp_unit') AS outside_temp_avg_$temp_unit,\n charge_energy_added * 60 / NULLIF (duration_min, 0) AS charge_energy_added_per_hour,\n convert_km((end_${preferred_range}_range_km - start_${preferred_range}_range_km) * 60 / NULLIF (duration_min, 0), '$length_unit') AS range_added_per_hour_$length_unit,\n start_battery_level,\n end_battery_level,\n convert_km(distance::numeric, '$length_unit') AS distance_$length_unit,\n convert_km(odometer::numeric, '$length_unit') AS odometer_$length_unit\n FROM\n data\nWHERE\n (distance >= 0 OR distance IS NULL)\n AND duration_min >= '$min_duration_min'\n AND \n CASE\n WHEN '$cost' !~ '^[0-9]+$' THEN TRUE \n ELSE cost >= COALESCE(NULLIF('$cost', '')::NUMERIC, 0) \n END\n AND charge_type = ANY(CASE WHEN array_to_string(ARRAY[$charge_type], ',') = 'DC' THEN ARRAY['DC'] WHEN array_to_string(ARRAY[$charge_type], ',') = 'AC' THEN ARRAY['AC'] ELSE ARRAY['DC', 'AC'] END)\n AND address ILIKE '%$location%'\nORDER BY\n start_date DESC;", + "rawSql": "WITH data AS (\n SELECT\n (round(extract(epoch FROM start_date) - 10) * 1000) AS start_date_ts,\n (round(extract(epoch FROM end_date) + 10) * 1000) AS end_date_ts,\n start_date,\n end_date,\n CONCAT_WS(', ', COALESCE(addresses.name, nullif(CONCAT_WS(' ', addresses.road, addresses.house_number), '')), addresses.city) AS address,\n g.name as geofence_name,\n g.id as geofence_id,\n p.latitude,\n p.longitude,\n cp.charge_energy_added,\n cp.charge_energy_used,\n duration_min,\n start_battery_level,\n end_battery_level,\n end_${preferred_range}_range_km - start_${preferred_range}_range_km as range_added,\n outside_temp_avg,\n cp.id,\n p.odometer - lag(p.odometer) OVER (ORDER BY start_date) AS distance,\n cars.efficiency,\n cp.car_id,\n cost,\n max(c.charger_voltage) as max_charger_voltage,\n CASE WHEN NULLIF(mode() within group (order by charger_phases),0) is null THEN 'DC' ELSE 'AC' END AS charge_type,\n p.odometer as odometer\n FROM\n charging_processes cp\n\tLEFT JOIN charges c ON cp.id = c.charging_process_id\n LEFT JOIN positions p ON p.id = cp.position_id\n LEFT JOIN cars ON cars.id = cp.car_id\n LEFT JOIN addresses ON addresses.id = cp.address_id\n LEFT JOIN geofences g ON g.id = geofence_id\n WHERE \n cp.car_id = $car_id AND\n $__timeFilter(start_date) AND\n (cp.charge_energy_added IS NULL OR cp.charge_energy_added > 0) AND\n ('${geofence:pipe}' = '-1' OR geofence_id in ($geofence))\n GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, p.odometer\n ORDER BY\n start_date\n)\nSELECT\n start_date_ts,\n end_date_ts,\n CASE WHEN geofence_id IS NULL THEN CONCAT('new?lat=', latitude, '&lng=', longitude)\n WHEN geofence_id IS NOT NULL THEN CONCAT(geofence_id, '/edit')\n END as path,\n car_id,\n id,\n -- Columns\n start_date,\n end_date,\n COALESCE(geofence_name, address) as address, \n charge_type,\n duration_min,\n cost,\n cost / NULLIF(greatest(charge_energy_added, charge_energy_used), 0) as cost_per_kwh,\n charge_energy_added,\n charge_energy_used,\n CASE WHEN charge_energy_used IS NULL THEN NULL ELSE LEAST(charge_energy_added / NULLIF(charge_energy_used, 0), 1.0) END as charging_efficiency,\n convert_celsius(outside_temp_avg, '$temp_unit') AS outside_temp_avg_$temp_unit,\n charge_energy_added * 60 / NULLIF (duration_min, 0) AS charge_energy_added_per_hour,\n convert_km(range_added * 60 / NULLIF (duration_min, 0), '$length_unit') AS range_added_per_hour_$length_unit,\n convert_km(range_added, '$length_unit') AS range_added_$length_unit,\n start_battery_level,\n end_battery_level,\n convert_km(odometer::numeric, '$length_unit') AS odometer_$length_unit\n FROM\n data\nWHERE\n (distance >= 0 OR distance IS NULL)\n AND duration_min >= '$min_duration_min'\n AND \n CASE\n WHEN '$cost' !~ '^[0-9]+$' THEN TRUE \n ELSE cost >= COALESCE(NULLIF('$cost', '')::NUMERIC, 0) \n END\n AND charge_type = ANY(CASE WHEN array_to_string(ARRAY[$charge_type], ',') = 'DC' THEN ARRAY['DC'] WHEN array_to_string(ARRAY[$charge_type], ',') = 'AC' THEN ARRAY['AC'] ELSE ARRAY['DC', 'AC'] END)\n AND address ILIKE '%$location%'\nORDER BY\n start_date DESC;", "refId": "A", "select": [ [ @@ -1257,7 +1297,7 @@ "content": "From here you can check if you have \nincomplete data of **Charges** (charges without ending date)\nIf so, you may follow the official \nguide by Manually fixing data", "mode": "markdown" }, - "pluginVersion": "11.0.6+security-01", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1318,8 +1358,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] } @@ -1346,7 +1385,7 @@ }, "showHeader": true }, - "pluginVersion": "11.0.6+security-01", + "pluginVersion": "11.2.3", "targets": [ { "alias": "", @@ -1398,14 +1437,14 @@ "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, - "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "hide": 0, "includeAll": false, "label": "Car", "multi": false, "name": "car_id", "options": [], - "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "refresh": 1, "regex": "", "skipUrlSync": false, @@ -1634,7 +1673,6 @@ "from": "now-3M", "to": "now" }, - "timeRangeUpdatedDuringEditOrView": false, "timepicker": { "refresh_intervals": [ "5s", @@ -1663,6 +1701,6 @@ "timezone": "", "title": "Charges", "uid": "TSmNYvRRk", - "version": 7, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/charging-stats.json b/grafana/dashboards/charging-stats.json index 433e50edbc..2e144f40ba 100644 --- a/grafana/dashboards/charging-stats.json +++ b/grafana/dashboards/charging-stats.json @@ -11,7 +11,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.1.0" + "version": "11.2.3" }, { "type": "datasource", @@ -139,7 +139,7 @@ }, "gridPos": { "h": 3, - "w": 5, + "w": 3, "x": 0, "y": 1 }, @@ -167,7 +167,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -228,8 +228,8 @@ }, "gridPos": { "h": 3, - "w": 5, - "x": 5, + "w": 3, + "x": 3, "y": 1 }, "id": 10, @@ -256,7 +256,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -319,7 +319,7 @@ "gridPos": { "h": 3, "w": 3, - "x": 10, + "x": 6, "y": 1 }, "id": 14, @@ -346,7 +346,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -381,7 +381,7 @@ ] } ], - "title": "Charging Cost at SuC", + "title": "SuC Charging Cost", "type": "stat" }, { @@ -409,7 +409,7 @@ "gridPos": { "h": 3, "w": 3, - "x": 13, + "x": 9, "y": 1 }, "id": 27, @@ -436,7 +436,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -498,8 +498,8 @@ }, "gridPos": { "h": 3, - "w": 2, - "x": 16, + "w": 3, + "x": 12, "y": 1 }, "id": 26, @@ -520,7 +520,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -573,7 +573,7 @@ ] } ], - "title": "Cost per 100 $length_unit", + "title": "Ø Cost per 100 $length_unit", "type": "stat" }, { @@ -602,8 +602,8 @@ }, "gridPos": { "h": 3, - "w": 2, - "x": 18, + "w": 3, + "x": 15, "y": 1 }, "id": 31, @@ -624,7 +624,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -649,7 +649,7 @@ ] } ], - "title": "Average Cost per kWh", + "title": "Ø Cost per kWh", "type": "stat" }, { @@ -678,8 +678,8 @@ }, "gridPos": { "h": 3, - "w": 2, - "x": 20, + "w": 3, + "x": 18, "y": 1 }, "id": 32, @@ -700,7 +700,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -743,7 +743,7 @@ ] } ], - "title": "DC Avg Cost per kWh", + "title": "Ø Cost per kWh DC", "type": "stat" }, { @@ -772,8 +772,8 @@ }, "gridPos": { "h": 3, - "w": 2, - "x": 22, + "w": 3, + "x": 21, "y": 1 }, "id": 33, @@ -794,7 +794,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -837,7 +837,7 @@ ] } ], - "title": "AC Avg Cost per kWh", + "title": "Ø Cost per kWh AC", "type": "stat" }, { @@ -929,7 +929,7 @@ "unit": "short" } }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "reverseYBuckets": false, "targets": [ { @@ -1001,6 +1001,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 35, "gradientMode": "none", @@ -1102,7 +1103,6 @@ "sort": "desc" } }, - "pluginVersion": "8.5.4", "targets": [ { "datasource": { @@ -1472,7 +1472,7 @@ "zoom": 15 } }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1672,14 +1672,17 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "fillOpacity": 50, "hideFrom": { "legend": false, "tooltip": false, "viz": false }, + "pointShape": "circle", "pointSize": { "fixed": 3 }, + "pointStrokeWidth": 1, "scaleDistribution": { "type": "linear" }, @@ -1713,11 +1716,23 @@ "value": [ { "title": "Show charge details", - "url": "d/BHhxFeZRz?from=${__data.fields.start_date.numeric}&to=${__data.fields.end_date.numeric}&var-car_id=${car_id}&var-charging_process_id=${__data.fields.charging_process_id.numeric}" + "url": "d/BHhxFeZRz/charge-details?from=${__data.fields.start_date.numeric}&to=${__data.fields.end_date.numeric}&var-car_id=${car_id}&var-charging_process_id=${__data.fields.charging_process_id.numeric}" } ] } ] + }, + { + "matcher": { + "id": "byName", + "options": "B - Avg Power [kW]" + }, + "properties": [ + { + "id": "custom.pointSize.fixed", + "value": 15 + } + ] } ] }, @@ -1729,47 +1744,86 @@ }, "id": 29, "options": { - "dims": { - "exclude": [ - "charging_process_id" - ], - "frame": 0 - }, "legend": { "calcs": [], "displayMode": "list", "placement": "bottom", "showLegend": false }, + "mapping": "manual", "series": [ { - "pointColor": { - "field": "Power [kW]" + "color": { + "matcher": { + "id": "byName", + "options": "Power [kW]" + } }, - "x": "SOC [%]", - "y": "Power [kW]" + "frame": { + "matcher": { + "id": "byIndex", + "options": 0 + } + }, + "x": { + "matcher": { + "id": "byName", + "options": "SOC [%]" + } + }, + "y": { + "exclude": { + "id": "byNames", + "options": [ + "charging_process_id" + ] + }, + "matcher": { + "id": "byName", + "options": "Power [kW]" + } + } }, { - "pointColor": { - "field": "B - Avg Power [kW]" + "color": { + "matcher": { + "id": "byName", + "options": "B - Avg Power [kW]" + } }, - "pointSize": { - "fixed": 15, - "max": 100, - "min": 1 + "frame": { + "matcher": { + "id": "byIndex", + "options": 1 + } }, - "x": "B - SOC [%]", - "y": "B - Avg Power [kW]" + "x": { + "matcher": { + "id": "byName", + "options": "B - SOC [%]" + } + }, + "y": { + "exclude": { + "id": "byNames", + "options": [ + "charging_process_id" + ] + }, + "matcher": { + "id": "byName", + "options": "B - Avg Power [kW]" + } + } } ], - "seriesMapping": "manual", "tooltip": { "maxHeight": 600, "mode": "single", "sort": "none" } }, - "pluginVersion": "7.5.11", + "pluginVersion": "11.2.3", "targets": [ { "alias": "", @@ -1870,7 +1924,8 @@ "cellOptions": { "type": "auto" }, - "inspect": false + "inspect": false, + "minWidth": 50 }, "mappings": [], "thresholds": { @@ -1892,7 +1947,7 @@ "properties": [ { "id": "custom.width", - "value": 70 + "value": 50 }, { "id": "displayName", @@ -1924,7 +1979,8 @@ "id": "custom.cellOptions", "value": { "mode": "gradient", - "type": "gauge" + "type": "gauge", + "valueDisplayMode": "text" } }, { @@ -1933,6 +1989,10 @@ { "id": "min", "value": 0 + }, + { + "id": "custom.align", + "value": "left" } ] } @@ -1958,7 +2018,7 @@ "showHeader": true, "sortBy": [] }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -2062,7 +2122,8 @@ "cellOptions": { "type": "auto" }, - "inspect": false + "inspect": false, + "minWidth": 50 }, "mappings": [], "thresholds": { @@ -2122,7 +2183,7 @@ }, { "id": "custom.width", - "value": 70 + "value": 50 } ] }, @@ -2146,6 +2207,10 @@ { "id": "min", "value": 0 + }, + { + "id": "custom.align", + "value": "left" } ] } @@ -2171,7 +2236,7 @@ "showHeader": true, "sortBy": [] }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -2290,7 +2355,7 @@ }, "showHeader": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -2413,7 +2478,7 @@ }, "showHeader": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -2465,14 +2530,14 @@ "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, - "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "hide": 2, "includeAll": true, "label": "Car", "multi": false, "name": "car_id", "options": [], - "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "refresh": 1, "regex": "", "skipUrlSync": false, @@ -2562,6 +2627,6 @@ "timezone": "", "title": "Charging Stats", "uid": "-pkIkhmRz", - "version": 11, + "version": 2, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/drive-stats.json b/grafana/dashboards/drive-stats.json index 6f439001a6..e0631a5f2d 100644 --- a/grafana/dashboards/drive-stats.json +++ b/grafana/dashboards/drive-stats.json @@ -1,6 +1,12 @@ { "__elements": {}, "__requires": [ + { + "type": "panel", + "id": "barchart", + "name": "Bar chart", + "version": "" + }, { "type": "panel", "id": "bargauge", @@ -11,7 +17,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.0.1" + "version": "11.2.3" }, { "type": "datasource", @@ -118,7 +124,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -250,7 +256,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -357,7 +363,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -497,7 +503,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -630,7 +636,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -696,7 +702,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -784,6 +790,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "last" @@ -795,7 +802,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -807,7 +814,7 @@ "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT max(speed) AS speed_[[length_unit]]h\nFROM positions\nWHERE car_id = $car_id AND $__timeFilter(date);", + "rawSql": "SELECT convert_km(max(speed_max), '$length_unit') AS speed_${length_unit}h\nFROM drives\nWHERE car_id = $car_id and $__timeFilter(start_date);", "refId": "A", "select": [ [ @@ -925,6 +932,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "last" @@ -936,7 +944,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -948,7 +956,7 @@ "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT max(speed) AS speed_[[length_unit]]h\nFROM positions\nWHERE car_id = $car_id AND $__timeFilter(date);", + "rawSql": "SELECT convert_km(max(speed_max), '$length_unit') AS speed_${length_unit}h\nFROM drives\nWHERE car_id = $car_id and $__timeFilter(start_date);", "refId": "A", "select": [ [ @@ -1067,6 +1075,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "last" @@ -1078,7 +1087,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1090,7 +1099,7 @@ "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT max(speed) AS speed_[[length_unit]]h\nFROM positions\nWHERE car_id = $car_id AND $__timeFilter(date);", + "rawSql": "SELECT convert_km(max(speed_max), '$length_unit') AS speed_${length_unit}h\nFROM drives\nWHERE car_id = $car_id and $__timeFilter(start_date);", "refId": "A", "select": [ [ @@ -1233,7 +1242,6 @@ "xTickLabelRotation": 0, "xTickLabelSpacing": 0 }, - "pluginVersion": "10.4.0", "targets": [ { "datasource": { @@ -1245,7 +1253,7 @@ "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "WITH drivedata AS (\r\n SELECT\r\n ROUND(convert_km(p.speed::numeric, '$length_unit') / 10, 0) * 10 AS speed_section_$length_unit,\r\n EXTRACT(EPOCH FROM (LEAD(p.\"date\") OVER (ORDER BY p.\"date\") - p.\"date\")) AS seconds_elapsed\r\n FROM drives d\r\n INNER JOIN positions p ON p.drive_id = d.id\r\n WHERE d.car_id = $car_id AND $__timeFilter(d.start_date) AND p.ideal_battery_range_km IS NOT NULL\r\n),\r\nTotalDuration AS (\r\n SELECT SUM(seconds_elapsed) AS total_elapsed_time\r\n FROM drivedata\r\n WHERE speed_section_$length_unit > 0\r\n)\r\nSELECT \r\n speed_section_$length_unit AS \"Speed\",\r\n SUM(seconds_elapsed) * 100 / (SELECT total_elapsed_time FROM TotalDuration) AS \"Elapsed\", \r\n TO_CHAR((SUM(seconds_elapsed) || ' second')::interval, 'HH24:MI:SS') AS \"Time\"\r\nFROM drivedata\r\nWHERE speed_section_$length_unit > 0\r\nGROUP BY speed_section_$length_unit\r\nORDER BY speed_section_$length_unit;\r\n", + "rawSql": "WITH drivedata AS (\r\n SELECT\r\n ROUND(convert_km(p.speed::numeric, '$length_unit') / 10, 0) * 10 AS speed_section_${length_unit},\r\n EXTRACT(EPOCH FROM (LEAD(p.\"date\") OVER (PARTITION BY p.drive_id ORDER BY p.\"date\") - p.\"date\")) AS seconds_elapsed\r\n FROM positions p\r\n WHERE p.car_id = $car_id AND $__timeFilter(p.date) AND p.ideal_battery_range_km IS NOT NULL\r\n)\r\n\r\nSELECT \r\n speed_section_${length_unit} AS \"Speed\",\r\n SUM(seconds_elapsed) * 100 / SUM(SUM(seconds_elapsed)) OVER () AS \"Elapsed\", \r\n TO_CHAR((SUM(seconds_elapsed) || ' second')::interval, 'HH24:MI:SS') AS \"Time\"\r\nFROM drivedata\r\nWHERE speed_section_${length_unit} > 0\r\nGROUP BY speed_section_${length_unit}\r\nORDER BY speed_section_${length_unit};\r\n", "refId": "A", "select": [ [ @@ -1378,7 +1386,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1511,7 +1519,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1614,7 +1622,7 @@ "sizing": "auto", "valueMode": "color" }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1684,14 +1692,14 @@ "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, - "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "hide": 0, "includeAll": false, "label": "Car", "multi": false, "name": "car_id", "options": [], - "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "refresh": 1, "regex": "", "skipUrlSync": false, @@ -1863,6 +1871,6 @@ "timezone": "", "title": "Drive Stats", "uid": "_7WkNSyWk", - "version": 14, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/drives.json b/grafana/dashboards/drives.json index 996ce83168..82a33af9d9 100644 --- a/grafana/dashboards/drives.json +++ b/grafana/dashboards/drives.json @@ -5,7 +5,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.0.1" + "version": "11.2.3" }, { "type": "datasource", @@ -151,6 +151,7 @@ "graphMode": "none", "justifyMode": "center", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "sum" @@ -162,7 +163,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -250,6 +251,7 @@ "graphMode": "none", "justifyMode": "center", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "sum" @@ -261,7 +263,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -368,6 +370,7 @@ "graphMode": "none", "justifyMode": "center", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "sum" @@ -379,7 +382,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -488,6 +491,7 @@ "graphMode": "none", "justifyMode": "center", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [], "fields": "", @@ -497,7 +501,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -593,7 +597,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null } ] } @@ -619,7 +624,7 @@ { "targetBlank": false, "title": "View drive details", - "url": "d/zm7wN6Zgz?from=${__data.fields.start_date_ts.numeric}&to=${__data.fields.end_date_ts.numeric}&var-car_id=${__data.fields.car_id.numeric}&var-drive_id=${__data.fields.drive_id.numeric}" + "url": "d/zm7wN6Zgz/drive-details?from=${__data.fields.start_date_ts.numeric}&to=${__data.fields.end_date_ts.numeric}&var-car_id=${__data.fields.car_id.numeric}&var-drive_id=${__data.fields.drive_id.numeric}" } ] }, @@ -742,7 +747,8 @@ "mode": "absolute", "steps": [ { - "color": "super-light-green" + "color": "super-light-green", + "value": null }, { "color": "green", @@ -858,7 +864,8 @@ "mode": "absolute", "steps": [ { - "color": "super-light-blue" + "color": "super-light-blue", + "value": null }, { "color": "super-light-green", @@ -1078,7 +1085,8 @@ "mode": "absolute", "steps": [ { - "color": "super-light-blue" + "color": "super-light-blue", + "value": null }, { "color": "super-light-green", @@ -1404,7 +1412,7 @@ "showHeader": true, "sortBy": [] }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "alias": "", @@ -1417,7 +1425,7 @@ "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "WITH data AS (\n SELECT\n round(extract(epoch FROM start_date)) * 1000 AS start_date_ts,\n round(extract(epoch FROM end_date)) * 1000 AS end_date_ts,\n car.id as car_id,\n CASE WHEN start_geofence.id IS NULL THEN CONCAT('new?lat=', start_position.latitude, '&lng=', start_position.longitude)\n WHEN start_geofence.id IS NOT NULL THEN CONCAT(start_geofence.id, '/edit')\n END as start_path,\n CASE WHEN end_geofence.id IS NULL THEN CONCAT('new?lat=', end_position.latitude, '&lng=', end_position.longitude)\n WHEN end_geofence.id IS NOT NULL THEN CONCAT(end_geofence.id, '/edit')\n END as end_path,\n TO_CHAR((duration_min * INTERVAL '1 minute'), 'HH24:MI') as duration_str,\n drives.id as drive_id,\n -- Columns\n start_date,\n COALESCE(start_geofence.name, CONCAT_WS(', ', COALESCE(start_address.name, nullif(CONCAT_WS(' ', start_address.road, start_address.house_number), '')), start_address.city)) AS start_address,\n COALESCE(end_geofence.name, CONCAT_WS(', ', COALESCE(end_address.name, nullif(CONCAT_WS(' ', end_address.road, end_address.house_number), '')), end_address.city)) AS end_address,\n duration_min,\n distance,\n start_position.usable_battery_level as start_usable_battery_level,\n start_position.battery_level as start_battery_level,\n end_position.usable_battery_level as end_usable_battery_level,\n end_position.battery_level as end_battery_level,\n case when (start_position.battery_level != start_position.usable_battery_level OR end_position.battery_level != end_position.usable_battery_level) = true then true else false end as reduced_range,\n duration_min > 1 AND distance > 1 AND ( \n start_position.usable_battery_level IS NULL OR end_position.usable_battery_level IS NULL\tOR\n (end_position.battery_level - end_position.usable_battery_level) = 0 \n ) as is_sufficiently_precise,\n NULLIF(GREATEST(start_${preferred_range}_range_km - end_${preferred_range}_range_km, 0), 0) as range_diff,\n car.efficiency as car_efficiency,\n outside_temp_avg,\n distance / coalesce(NULLIF(duration_min, 0) * 60, extract(epoch from end_date - start_date)) * 3600 AS avg_speed,\n\tspeed_max,\n power_max\n FROM drives\n LEFT JOIN addresses start_address ON start_address_id = start_address.id\n LEFT JOIN addresses end_address ON end_address_id = end_address.id\n LEFT JOIN positions start_position ON start_position_id = start_position.id\n LEFT JOIN positions end_position ON end_position_id = end_position.id\n LEFT JOIN geofences start_geofence ON start_geofence_id = start_geofence.id\n LEFT JOIN geofences end_geofence ON end_geofence_id = end_geofence.id\n LEFT JOIN cars car ON car.id = drives.car_id\n WHERE $__timeFilter(start_date) AND drives.car_id = $car_id \n AND convert_km(distance::numeric, '$length_unit') >= $min_dist \n AND convert_km(distance::numeric, '$length_unit') / coalesce(NULLIF(duration_min, 0) * 60, extract(epoch from end_date - start_date)) * 3600 >= $min_speed \n AND ('${geofence:pipe}' = '-1' OR start_geofence.id in ($geofence) OR end_geofence.id in ($geofence)) \n ORDER BY start_date DESC\n)\nSELECT\n start_date_ts,\n end_date_ts,\n car_id,\n start_path,\n end_path,\n duration_str,\n drive_id,\n -- Columns\n start_date,\n start_address,\n end_address,\n duration_min,\n convert_km(distance::numeric, '$length_unit') AS distance_$length_unit,\n start_battery_level as \"% Start\",\n end_battery_level as \"% End\",\n convert_celsius(outside_temp_avg, '$temp_unit') AS outside_temp_$temp_unit,\n convert_km(avg_speed::numeric, '$length_unit') AS speed_avg_$length_unit,\n convert_km(speed_max::numeric, '$length_unit') AS speed_max_$length_unit,\n power_max,\n reduced_range as has_reduced_range,\n CASE WHEN is_sufficiently_precise THEN distance / range_diff\n ELSE NULL\n END AS efficiency,\n range_diff * car_efficiency as \"consumption_kWh\",\n CASE WHEN is_sufficiently_precise THEN range_diff * car_efficiency / distance * 1000 * CASE WHEN '$length_unit' = 'km' THEN 1\n WHEN '$length_unit' = 'mi' THEN 1.60934\n END\n END AS consumption_kWh_$length_unit\nFROM data\nWHERE\n start_address ILIKE '%$location%' OR end_address ILIKE '%$location%';", + "rawSql": "WITH data AS (\n SELECT\n round(extract(epoch FROM start_date)) * 1000 AS start_date_ts,\n round(extract(epoch FROM end_date)) * 1000 AS end_date_ts,\n car.id as car_id,\n CASE WHEN start_geofence.id IS NULL THEN CONCAT('new?lat=', start_position.latitude, '&lng=', start_position.longitude)\n WHEN start_geofence.id IS NOT NULL THEN CONCAT(start_geofence.id, '/edit')\n END as start_path,\n CASE WHEN end_geofence.id IS NULL THEN CONCAT('new?lat=', end_position.latitude, '&lng=', end_position.longitude)\n WHEN end_geofence.id IS NOT NULL THEN CONCAT(end_geofence.id, '/edit')\n END as end_path,\n TO_CHAR((duration_min * INTERVAL '1 minute'), 'HH24:MI') as duration_str,\n drives.id as drive_id,\n -- Columns\n start_date,\n COALESCE(start_geofence.name, CONCAT_WS(', ', COALESCE(start_address.name, nullif(CONCAT_WS(' ', start_address.road, start_address.house_number), '')), start_address.city)) AS start_address,\n COALESCE(end_geofence.name, CONCAT_WS(', ', COALESCE(end_address.name, nullif(CONCAT_WS(' ', end_address.road, end_address.house_number), '')), end_address.city)) AS end_address,\n duration_min,\n distance,\n start_position.usable_battery_level as start_usable_battery_level,\n start_position.battery_level as start_battery_level,\n end_position.usable_battery_level as end_usable_battery_level,\n end_position.battery_level as end_battery_level,\n case when (start_position.battery_level != start_position.usable_battery_level OR end_position.battery_level != end_position.usable_battery_level) = true then true else false end as reduced_range,\n duration_min > 1 AND distance > 1 AND ( \n start_position.usable_battery_level IS NULL OR end_position.usable_battery_level IS NULL\tOR\n (end_position.battery_level - end_position.usable_battery_level) = 0 \n ) as is_sufficiently_precise,\n NULLIF(GREATEST(start_${preferred_range}_range_km - end_${preferred_range}_range_km, 0), 0) as range_diff,\n car.efficiency as car_efficiency,\n outside_temp_avg,\n distance / coalesce(NULLIF(duration_min, 0) * 60, extract(epoch from end_date - start_date)) * 3600 AS avg_speed,\n\tspeed_max,\n power_max\n FROM drives\n LEFT JOIN addresses start_address ON start_address_id = start_address.id\n LEFT JOIN addresses end_address ON end_address_id = end_address.id\n LEFT JOIN positions start_position ON start_position_id = start_position.id\n LEFT JOIN positions end_position ON end_position_id = end_position.id\n LEFT JOIN geofences start_geofence ON start_geofence_id = start_geofence.id\n LEFT JOIN geofences end_geofence ON end_geofence_id = end_geofence.id\n LEFT JOIN cars car ON car.id = drives.car_id\n WHERE $__timeFilter(start_date) AND drives.car_id = $car_id \n AND convert_km(distance::numeric, '$length_unit') >= $min_dist \n AND convert_km(distance::numeric, '$length_unit') / coalesce(NULLIF(duration_min, 0) * 60, extract(epoch from end_date - start_date)) * 3600 >= $min_speed \n AND ('${geofence:pipe}' = '-1' OR start_geofence.id in ($geofence) OR end_geofence.id in ($geofence)) \n ORDER BY start_date DESC\n)\nSELECT\n start_date_ts,\n end_date_ts,\n car_id,\n start_path,\n end_path,\n duration_str,\n drive_id,\n -- Columns\n start_date,\n start_address,\n end_address,\n duration_min,\n convert_km(distance::numeric, '$length_unit') AS distance_$length_unit,\n start_battery_level as \"% Start\",\n end_battery_level as \"% End\",\n convert_celsius(outside_temp_avg, '$temp_unit') AS outside_temp_$temp_unit,\n convert_km(avg_speed::numeric, '$length_unit') AS speed_avg_$length_unit,\n convert_km(speed_max::numeric, '$length_unit') AS speed_max_$length_unit,\n power_max,\n reduced_range as has_reduced_range,\n CASE WHEN is_sufficiently_precise THEN distance / range_diff\n ELSE NULL\n END AS efficiency,\n range_diff * car_efficiency as \"consumption_kWh\",\n CASE WHEN is_sufficiently_precise THEN range_diff * car_efficiency / convert_km(distance::numeric, '$length_unit') * 1000\n END AS consumption_kWh_$length_unit\nFROM data\nWHERE\n start_address ILIKE '%$location%' OR end_address ILIKE '%$location%';", "refId": "A", "select": [ [ @@ -1493,7 +1501,7 @@ "content": "From here you can check if you have \nincomplete data of **Drives** (drives without ending date)\nIf so, you may follow the official \nguide by Manually fixing data", "mode": "markdown" }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1582,7 +1590,7 @@ }, "showHeader": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "alias": "", @@ -1633,14 +1641,14 @@ "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, - "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "hide": 0, "includeAll": false, "label": "Car", "multi": false, "name": "car_id", "options": [], - "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "refresh": 1, "regex": "", "skipUrlSync": false, @@ -1849,6 +1857,6 @@ "timezone": "", "title": "Drives", "uid": "Y8upc6ZRk", - "version": 6, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/efficiency.json b/grafana/dashboards/efficiency.json index 4289ce7fab..9143437293 100644 --- a/grafana/dashboards/efficiency.json +++ b/grafana/dashboards/efficiency.json @@ -5,7 +5,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.0.0" + "version": "11.2.3" }, { "type": "datasource", @@ -158,6 +158,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -169,18 +170,19 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, + "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "select \n sum((start_${preferred_range}_range_km - end_${preferred_range}_range_km) * cars.efficiency) / sum(distance) * 1000 * \n CASE WHEN '$length_unit' = 'km' THEN 1\n WHEN '$length_unit' = 'mi' THEN 1.60934\n END AS \"consumption_$length_unit\"\nfrom drives \ninner join cars on cars.id = car_id\nwhere \n distance is not null and\n start_${preferred_range}_range_km - end_${preferred_range}_range_km >= 0.1 and\n car_id = $car_id", + "rawSql": "select \n sum((start_${preferred_range}_range_km - end_${preferred_range}_range_km) * cars.efficiency) / convert_km(sum(distance)::numeric, '$length_unit') * 1000 AS \"consumption_$length_unit\"\nfrom drives \ninner join cars on cars.id = car_id\nwhere \n distance is not null and\n start_${preferred_range}_range_km - end_${preferred_range}_range_km >= 0.1 and\n car_id = $car_id", "refId": "A", "select": [ [ @@ -192,6 +194,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "addresses", "timeColumn": "inserted_at", "timeColumnType": "timestamp", @@ -272,6 +291,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -283,18 +303,19 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, + "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "WITH d1 AS (\n\tSELECT\n\t\tc.car_id,\n\t\tlag(end_${preferred_range}_range_km) OVER (ORDER BY start_date) - start_${preferred_range}_range_km AS range_loss,\n\t\tp.odometer - lag(p.odometer) OVER (ORDER BY start_date) AS distance\n\tFROM\n\t\tcharging_processes c\n\tLEFT JOIN positions p ON p.id = c.position_id \n\tWHERE\n\t end_date IS NOT NULL AND\n\t c.car_id = $car_id\n\tORDER BY\n\t\tstart_date\n),\nd2 AS (\nSELECT\n\tcar_id,\n\tsum(range_loss) AS range_loss,\n\tsum(distance) AS distance\nFROM\n\td1\nWHERE\n\tdistance >= 0 AND range_loss >= 0\nGROUP BY\n\tcar_id\n)\nSELECT\nrange_loss * c.efficiency / distance * 1000 *\n CASE WHEN '$length_unit' = 'km' THEN 1\n WHEN '$length_unit' = 'mi' THEN 1.60934\n END AS \"consumption_$length_unit\"\nFROM\n\td2\n\tLEFT JOIN cars c ON c.id = car_id", + "rawSql": "WITH d1 AS (\n\tSELECT\n\t\tc.car_id,\n\t\tlag(end_${preferred_range}_range_km) OVER (ORDER BY start_date) - start_${preferred_range}_range_km AS range_loss,\n\t\tp.odometer - lag(p.odometer) OVER (ORDER BY start_date) AS distance\n\tFROM\n\t\tcharging_processes c\n\tLEFT JOIN positions p ON p.id = c.position_id \n\tWHERE\n\t end_date IS NOT NULL AND\n\t c.car_id = $car_id\n\tORDER BY\n\t\tstart_date\n),\nd2 AS (\nSELECT\n\tcar_id,\n\tsum(range_loss) AS range_loss,\n\tsum(distance) AS distance\nFROM\n\td1\nWHERE\n\tdistance >= 0 AND range_loss >= 0\nGROUP BY\n\tcar_id\n)\nSELECT\nrange_loss * c.efficiency / convert_km(distance::numeric, '$length_unit') * 1000 AS \"consumption_$length_unit\"\nFROM\n\td2\n\tLEFT JOIN cars c ON c.id = car_id", "refId": "A", "select": [ [ @@ -306,6 +327,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "addresses", "timeColumn": "inserted_at", "timeColumnType": "timestamp", @@ -386,6 +424,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -397,7 +436,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -443,6 +482,7 @@ "fieldConfig": { "defaults": { "custom": { + "align": "auto", "cellOptions": { "type": "auto" }, @@ -701,18 +741,19 @@ } ] }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, + "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "WITH t AS (\n\tSELECT\n\t CASE WHEN '$temp_unit' = 'C' THEN ROUND(cast(outside_temp_avg AS numeric) / 5, 0) * 5 \n\t\t\t WHEN '$temp_unit' = 'F' THEN ROUND(cast(convert_celsius(outside_temp_avg, '$temp_unit') AS numeric) / 10, 0) * 10\n\t\tEND AS outside_temp,\n\t\tsum(start_ideal_range_km - end_ideal_range_km) AS total_ideal_range,\n\t\tsum(start_rated_range_km - end_rated_range_km) AS total_rated_range,\n\t\tsum(distance) AS total_distance,\n\t\tsum(duration_min) as duration,\n\t\tcar_id\n\tFROM\n\t\tdrives\n\tWHERE\n\t\tdistance IS NOT NULL\n\t\tAND car_id = $car_id\n\t\tAND convert_km(distance::numeric, '$length_unit') >= $min_distance \n\t\tAND start_${preferred_range}_range_km - end_${preferred_range}_range_km > 0.1\n\tGROUP BY\n\t\t1,\n\t\tcar_id\n)\n\nSELECT\n\toutside_temp as outside_temp_$temp_unit,\n total_distance / total_${preferred_range}_range AS efficiency,\n\ttotal_${preferred_range}_range / total_distance * c.efficiency * 1000 * \n CASE \n WHEN '$length_unit' = 'km' THEN 1 \n WHEN '$length_unit' = 'mi' THEN 1.60934 \n END AS consumption_$length_unit,\n convert_km(total_distance::numeric, '$length_unit') as total_distance_$length_unit,\n\t(total_distance / duration) * 60 / (CASE \n WHEN '$length_unit' = 'km' THEN 1 \n WHEN '$length_unit' = 'mi' THEN 1.60934 \n END) avg_speed_$length_unit\nFROM\n\tt\nJOIN cars c ON t.car_id = c.id\nWHERE outside_temp IS NOT NULL\norder by 1 desc\n", + "rawSql": "WITH t AS (\n\tSELECT\n\t CASE WHEN '$temp_unit' = 'C' THEN ROUND(cast(outside_temp_avg AS numeric) / 5, 0) * 5 \n\t\t\t WHEN '$temp_unit' = 'F' THEN ROUND(cast(convert_celsius(outside_temp_avg, '$temp_unit') AS numeric) / 10, 0) * 10\n\t\tEND AS outside_temp,\n\t\tsum(start_ideal_range_km - end_ideal_range_km) AS total_ideal_range,\n\t\tsum(start_rated_range_km - end_rated_range_km) AS total_rated_range,\n\t\tsum(distance) AS total_distance,\n\t\tsum(duration_min) as duration,\n\t\tcar_id\n\tFROM\n\t\tdrives\n\tWHERE\n\t\tdistance IS NOT NULL\n\t\tAND car_id = $car_id\n\t\tAND convert_km(distance::numeric, '$length_unit') >= $min_distance \n\t\tAND start_${preferred_range}_range_km - end_${preferred_range}_range_km > 0.1\n\tGROUP BY\n\t\t1,\n\t\tcar_id\n)\n\nSELECT\n\toutside_temp as outside_temp_$temp_unit,\n total_distance / total_${preferred_range}_range AS efficiency,\n\ttotal_${preferred_range}_range / convert_km(total_distance::numeric, '$length_unit') * c.efficiency * 1000 AS consumption_$length_unit,\n convert_km(total_distance::numeric, '$length_unit') as total_distance_$length_unit,\n\t(convert_km(total_distance::numeric, '$length_unit') / duration) * 60 as avg_speed_$length_unit\nFROM\n\tt\nJOIN cars c ON t.car_id = c.id\nWHERE outside_temp IS NOT NULL\norder by 1 desc\n", "refId": "A", "select": [ [ @@ -724,6 +765,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "addresses", "timeColumn": "inserted_at", "timeColumnType": "timestamp", @@ -804,6 +862,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -815,18 +874,19 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, + "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT\n\tCASE WHEN '$length_unit' = 'km' THEN efficiency\n\t WHEN '$length_unit' = 'mi' THEN efficiency * 1.60934\n\tEND * 1000 as \"efficiency_$length_unit\"\nFROM\n\tcars\nWHERE\n\tid = $car_id;", + "rawSql": "SELECT\n\tefficiency / convert_km(1, '$length_unit') * 1000 as \"efficiency_$length_unit\"\nFROM\n\tcars\nWHERE\n\tid = $car_id;", "refId": "A", "select": [ [ @@ -838,6 +898,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "charges", "timeColumn": "date", "timeColumnType": "timestamp", @@ -861,6 +938,7 @@ "fieldConfig": { "defaults": { "custom": { + "align": "auto", "cellOptions": { "type": "auto" }, @@ -932,18 +1010,19 @@ }, "showHeader": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, + "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT\n round((charge_energy_added / NULLIF(end_ideal_range_km - start_ideal_range_km, 0))::numeric *\n\t CASE WHEN '$length_unit' = 'km' THEN 1.0\n\t WHEN '$length_unit' = 'mi' THEN 1.60934\n\t END, 3) * 1000 as \"efficiency_$length_unit\",\n count(*) as count\nFROM\n charging_processes\nWHERE \n car_id = $car_id\n AND duration_min > 10\n AND end_battery_level <= 95\n AND start_ideal_range_km IS NOT NULL\n AND end_ideal_range_km IS NOT NULL\n AND charge_energy_added > 0\nGROUP BY\n 1\nORDER BY\n 2 DESC\nLIMIT 3", + "rawSql": "SELECT\n round((charge_energy_added / NULLIF(end_ideal_range_km - start_ideal_range_km, 0))::numeric / convert_km(1, '$length_unit'), 3) * 1000 as \"efficiency_$length_unit\",\n count(*) as count\nFROM\n charging_processes\nWHERE \n car_id = $car_id\n AND duration_min > 10\n AND end_battery_level <= 95\n AND start_ideal_range_km IS NOT NULL\n AND end_ideal_range_km IS NOT NULL\n AND charge_energy_added > 0\nGROUP BY\n 1\nORDER BY\n 2 DESC\nLIMIT 3", "refId": "A", "select": [ [ @@ -955,6 +1034,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "charges", "timeColumn": "date", "timeColumnType": "timestamp", @@ -978,6 +1074,7 @@ "fieldConfig": { "defaults": { "custom": { + "align": "auto", "cellOptions": { "type": "auto" }, @@ -1049,18 +1146,19 @@ }, "showHeader": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, + "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT\n round((charge_energy_added / NULLIF(end_rated_range_km - start_rated_range_km, 0))::numeric *\n\t CASE WHEN '$length_unit' = 'km' THEN 1.0\n\t WHEN '$length_unit' = 'mi' THEN 1.60934\n\t END, 3) * 1000 as \"efficiency_$length_unit\",\n\tcount(*) as count\nFROM\n charging_processes\nWHERE \n car_id = $car_id\n AND duration_min > 10\n AND end_battery_level <= 95\n AND start_rated_range_km IS NOT NULL\n AND end_rated_range_km IS NOT NULL\n AND charge_energy_added > 0\nGROUP BY\n 1\nORDER BY\n 2 DESC\nLIMIT 3", + "rawSql": "SELECT\n round((charge_energy_added / NULLIF(end_rated_range_km - start_rated_range_km, 0))::numeric / convert_km(1, '$length_unit'), 3) * 1000 as \"efficiency_$length_unit\",\n\tcount(*) as count\nFROM\n charging_processes\nWHERE \n car_id = $car_id\n AND duration_min > 10\n AND end_battery_level <= 95\n AND start_rated_range_km IS NOT NULL\n AND end_rated_range_km IS NOT NULL\n AND charge_energy_added > 0\nGROUP BY\n 1\nORDER BY\n 2 DESC\nLIMIT 3", "refId": "A", "select": [ [ @@ -1072,6 +1170,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "charges", "timeColumn": "date", "timeColumnType": "timestamp", @@ -1100,14 +1215,14 @@ "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, - "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "hide": 2, "includeAll": true, "label": "Car", "multi": false, "name": "car_id", "options": [], - "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "refresh": 1, "regex": "", "skipUrlSync": false, @@ -1257,7 +1372,6 @@ "from": "now-6h", "to": "now" }, - "timeRangeUpdatedDuringEditOrView": false, "timepicker": { "hidden": true, "refresh_intervals": [ @@ -1287,6 +1401,6 @@ "timezone": "", "title": "Efficiency", "uid": "fu4SiQgWz", - "version": 2, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/internal/charge-details.json b/grafana/dashboards/internal/charge-details.json index c3fe5257ee..b28a5ed0f9 100644 --- a/grafana/dashboards/internal/charge-details.json +++ b/grafana/dashboards/internal/charge-details.json @@ -11,7 +11,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "10.4.0" + "version": "11.2.3" }, { "type": "datasource", @@ -43,9 +43,9 @@ { "builtIn": 1, "datasource": "-- Grafana --", + "definition": "TeslaMate|U2FsdGVkX1/cEWK+8cz7pjEKXtzJnDN7b21ZDXt1MGneFGPWTLqOPtxKmu02mJPLzi/f29I+NBHd3vi0FB8R4Xn0+GtobWDgk6VAVSBTdSNniOKO8i2WPlhRaOsl2+hG7gnZ7wrf1Th2nxR7f1uYCrbwOek0IzkfLzrkjh7gkr6inT6bbDuJqrmogZajLxmAMrQ6V+/vHxBRGiwjJhgiEeq3hM1q2h04JKkNiZ8RHbsF5Cd/xd8Q9u0JVrZzIrtnhM/SFlaApU7RtRMu8CSj1llTX7WEOj6VDZAMSf+XUAanWdk725kEPN9MNu89o2zEq5P3E3cju8IbbBdPzXLV3oVuzD6/tMnxFToIIV1E/BrpF7s2RtNa8+KJJ1PF8xgs6m+/KTD2hy+WsP0636AgObRAmYg7+qotGrgNvpNPdE0EgrB7WHYlV7R/1q66bcq6tCe51X1Un70k+zo+K6AK0o4B1H6IyMlEVuRH/Fz8QVl9aYu2ztd08RbuKJlYVKpkH+pxVETAO9MclYQ90tzE6TfwDZrQZzsAlMenr4s1ZB1OlFXjLjVjnddnUilzO76cqv4yI2THQEuyQ47nuVQ4gUbx02K59vMQhns3C01JOAYokOaSXe66Y7QYdMlk09Lf|aes-256-cbc", "enable": true, "hide": true, - "definition": "TeslaMate|U2FsdGVkX1/cEWK+8cz7pjEKXtzJnDN7b21ZDXt1MGneFGPWTLqOPtxKmu02mJPLzi/f29I+NBHd3vi0FB8R4Xn0+GtobWDgk6VAVSBTdSNniOKO8i2WPlhRaOsl2+hG7gnZ7wrf1Th2nxR7f1uYCrbwOek0IzkfLzrkjh7gkr6inT6bbDuJqrmogZajLxmAMrQ6V+/vHxBRGiwjJhgiEeq3hM1q2h04JKkNiZ8RHbsF5Cd/xd8Q9u0JVrZzIrtnhM/SFlaApU7RtRMu8CSj1llTX7WEOj6VDZAMSf+XUAanWdk725kEPN9MNu89o2zEq5P3E3cju8IbbBdPzXLV3oVuzD6/tMnxFToIIV1E/BrpF7s2RtNa8+KJJ1PF8xgs6m+/KTD2hy+WsP0636AgObRAmYg7+qotGrgNvpNPdE0EgrB7WHYlV7R/1q66bcq6tCe51X1Un70k+zo+K6AK0o4B1H6IyMlEVuRH/Fz8QVl9aYu2ztd08RbuKJlYVKpkH+pxVETAO9MclYQ90tzE6TfwDZrQZzsAlMenr4s1ZB1OlFXjLjVjnddnUilzO76cqv4yI2THQEuyQ47nuVQ4gUbx02K59vMQhns3C01JOAYokOaSXe66Y7QYdMlk09Lf|aes-256-cbc", "iconColor": "rgba(0, 211, 255, 1)", "name": "Annotations & Alerts", "target": { @@ -61,6 +61,7 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, + "id": null, "links": [ { "icon": "dashboard", @@ -101,6 +102,7 @@ "axisSoftMax": 100, "axisSoftMin": 0, "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 10, "gradientMode": "opacity", @@ -392,7 +394,6 @@ "sort": "none" } }, - "pluginVersion": "8.5.4", "targets": [ { "alias": "", @@ -486,6 +487,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -497,7 +499,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "10.4.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -605,6 +607,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -616,7 +619,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "10.4.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -714,6 +717,7 @@ "graphMode": "area", "justifyMode": "center", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -725,7 +729,7 @@ "textMode": "value_and_name", "wideLayout": true }, - "pluginVersion": "10.4.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -957,7 +961,7 @@ "zoom": 15 } }, - "pluginVersion": "10.4.0", + "pluginVersion": "11.2.3", "targets": [ { "alias": "", @@ -1059,6 +1063,7 @@ "graphMode": "area", "justifyMode": "center", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -1070,7 +1075,7 @@ "textMode": "value_and_name", "wideLayout": true }, - "pluginVersion": "10.4.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1221,6 +1226,7 @@ "graphMode": "area", "justifyMode": "auto", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -1233,7 +1239,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "10.4.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1349,6 +1355,7 @@ "graphMode": "area", "justifyMode": "auto", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -1361,7 +1368,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "10.4.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1514,6 +1521,7 @@ "graphMode": "area", "justifyMode": "center", "orientation": "vertical", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -1526,7 +1534,7 @@ "textMode": "value_and_name", "wideLayout": true }, - "pluginVersion": "10.4.0", + "pluginVersion": "11.2.3", "targets": [ { "alias": "Real", @@ -1725,14 +1733,17 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", + "fillOpacity": 50, "hideFrom": { "legend": false, "tooltip": false, "viz": false }, + "pointShape": "circle", "pointSize": { "fixed": 5 }, + "pointStrokeWidth": 1, "scaleDistribution": { "type": "linear" }, @@ -1773,6 +1784,13 @@ { "id": "custom.lineWidth", "value": 1 + }, + { + "id": "color", + "value": { + "fixedColor": "blue", + "mode": "fixed" + } } ] } @@ -1792,27 +1810,55 @@ "placement": "bottom", "showLegend": false }, + "mapping": "manual", "series": [ { - "pointColor": {}, - "x": "SOC [%]", - "y": "Power [kW]" + "frame": { + "matcher": { + "id": "byIndex", + "options": 0 + } + }, + "x": { + "matcher": { + "id": "byName", + "options": "SOC [%]" + } + }, + "y": { + "matcher": { + "id": "byName", + "options": "Power [kW]" + } + } }, { - "pointColor": { - "fixed": "blue" + "frame": { + "matcher": { + "id": "byIndex", + "options": 1 + } }, - "x": "avg SOC [%]", - "y": "avg Power [kW]" + "x": { + "matcher": { + "id": "byName", + "options": "SOC [%]" + } + }, + "y": { + "matcher": { + "id": "byName", + "options": "Power [kW]" + } + } } ], - "seriesMapping": "manual", "tooltip": { "mode": "single", "sort": "none" } }, - "pluginVersion": "7.5.11", + "pluginVersion": "11.2.3", "targets": [ { "alias": "", @@ -1826,7 +1872,7 @@ "hide": false, "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT\n battery_level as \"SOC [%]\",\n charger_power as \"Power [kW]\"\nFROM\n charges c\njoin\n charging_processes p ON p.id = c.charging_process_id \nWHERE\n $__timeFilter(date)\n AND p.car_id = $car_id\n AND charger_power > 0\nORDER BY\n date ASC", + "rawSql": "SELECT\n battery_level as \"SOC [%]\",\n charger_power as \"Power [kW]\"\nFROM\n charges c\njoin\n charging_processes p ON p.id = c.charging_process_id \nWHERE\n $__timeFilter(date)\n AND p.car_id = $car_id\n AND charger_power > 0\nORDER BY\n date ASC", "refId": "A", "select": [ [ @@ -1869,12 +1915,13 @@ "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, + "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT\n battery_level as \"avg SOC [%]\",\n avg(charger_power) as \"avg Power [kW]\"\nFROM\n charges c\njoin\n charging_processes p ON p.id = c.charging_process_id \nWHERE\n $__timeFilter(date)\n AND p.car_id = $car_id\n AND charger_power > 0\nGROUP BY\n battery_level, fast_charger_present\nORDER BY\n battery_level ASC ", + "rawSql": "SELECT\n battery_level as \"SOC [%]\",\n avg(charger_power) as \"Power [kW]\"\nFROM\n charges c\njoin\n charging_processes p ON p.id = c.charging_process_id \nWHERE\n $__timeFilter(date)\n AND p.car_id = $car_id\n AND charger_power > 0\nGROUP BY\n battery_level, fast_charger_present\nORDER BY\n battery_level ASC ", "refId": "B", "select": [ [ @@ -1886,6 +1933,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "positions", "timeColumn": "date", "timeColumnType": "timestamp", @@ -1909,8 +1973,8 @@ { "current": { "selected": false, - "text": "NULL", - "value": "NULL" + "text": "330", + "value": "330" }, "hide": 2, "label": "", @@ -1922,7 +1986,7 @@ "value": "NULL" } ], - "query": "NULL", + "query": "330", "skipUrlSync": false, "type": "textbox" }, @@ -1955,14 +2019,14 @@ "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, - "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "hide": 0, "includeAll": false, "label": "Car", "multi": false, "name": "car_id", "options": [], - "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "refresh": 1, "regex": "", "skipUrlSync": false, @@ -2072,6 +2136,6 @@ "timezone": "", "title": "Charge Details", "uid": "BHhxFeZRz", - "version": 3, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/internal/drive-details.json b/grafana/dashboards/internal/drive-details.json index 6b2eebd874..abcca15d52 100644 --- a/grafana/dashboards/internal/drive-details.json +++ b/grafana/dashboards/internal/drive-details.json @@ -17,7 +17,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.0.0" + "version": "11.2.3" }, { "type": "datasource", @@ -109,6 +109,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 5, "gradientMode": "opacity", @@ -617,6 +618,49 @@ "showZoom": true }, "layers": [ + { + "config": { + "showLegend": false, + "style": { + "color": { + "fixed": "transparent" + }, + "opacity": 0, + "rotation": { + "fixed": 0, + "max": 360, + "min": -360, + "mode": "mod" + }, + "size": { + "fixed": 5, + "max": 15, + "min": 2 + }, + "symbol": { + "fixed": "img/icons/marker/circle.svg", + "mode": "fixed" + }, + "symbolAlign": { + "horizontal": "center", + "vertical": "center" + }, + "textConfig": { + "fontSize": 12, + "offsetX": 0, + "offsetY": 0, + "textAlign": "center", + "textBaseline": "middle" + } + } + }, + "location": { + "mode": "auto" + }, + "name": "Temp Fix Grafana Issue #89777", + "tooltip": false, + "type": "markers" + }, { "config": { "arrow": 0, @@ -675,7 +719,7 @@ "zoom": 15 } }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "alias": "", @@ -788,6 +832,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 5, "gradientMode": "opacity", @@ -951,6 +996,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 5, "gradientMode": "opacity", @@ -1222,6 +1268,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 5, "gradientMode": "opacity", @@ -1519,6 +1566,7 @@ "graphMode": "area", "justifyMode": "center", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -1530,7 +1578,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1632,6 +1680,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -1643,7 +1692,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1719,6 +1768,7 @@ "graphMode": "area", "justifyMode": "auto", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -1730,7 +1780,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1862,7 +1912,6 @@ "xTickLabelRotation": 0, "xTickLabelSpacing": 0 }, - "pluginVersion": "10.4.0", "targets": [ { "datasource": { @@ -2003,6 +2052,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -2014,7 +2064,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -2087,6 +2137,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "vertical", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -2099,7 +2150,7 @@ "textMode": "value_and_name", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -2251,6 +2302,7 @@ "graphMode": "none", "justifyMode": "center", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -2262,7 +2314,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -2370,6 +2422,7 @@ "graphMode": "area", "justifyMode": "auto", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -2381,7 +2434,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -2500,6 +2553,7 @@ "graphMode": "area", "justifyMode": "center", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -2511,7 +2565,7 @@ "textMode": "value", "wideLayout": false }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -2573,7 +2627,11 @@ "templating": { "list": [ { - "current": {}, + "current": { + "selected": false, + "text": "1475", + "value": "1475" + }, "hide": 2, "name": "drive_id", "options": [ @@ -2583,7 +2641,7 @@ "value": "NULL" } ], - "query": "", + "query": "1475", "skipUrlSync": false, "type": "textbox" }, @@ -2639,14 +2697,14 @@ "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, - "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "hide": 0, "includeAll": false, "label": "Car", "multi": false, "name": "car_id", "options": [], - "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "refresh": 1, "regex": "", "skipUrlSync": false, @@ -2764,6 +2822,10 @@ } ] }, + "time": { + "from": "now-12h", + "to": "now" + }, "timepicker": { "refresh_intervals": [], "time_options": [] @@ -2771,6 +2833,6 @@ "timezone": "", "title": "Drive Details", "uid": "zm7wN6Zgz", - "version": 6, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/internal/home.json b/grafana/dashboards/internal/home.json new file mode 100644 index 0000000000..f4fc189bbd --- /dev/null +++ b/grafana/dashboards/internal/home.json @@ -0,0 +1,144 @@ +{ + "__elements": {}, + "__requires": [ + { + "type": "panel", + "id": "dashlist", + "name": "Dashboard list", + "version": "" + }, + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "11.2.3" + }, + { + "type": "datasource", + "id": "grafana-postgresql-datasource", + "name": "PostgreSQL", + "version": "1.0.0" + }, + { + "type": "panel", + "id": "news", + "name": "News", + "version": "" + }, + { + "type": "panel", + "id": "text", + "name": "Text", + "version": "" + } + ], + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": null, + "links": [], + "panels": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "gridPos": { + "h": 20, + "w": 6, + "x": 0, + "y": 0 + }, + "id": 2, + "options": { + "folderUID": "Nr4ofiDZk", + "includeVars": false, + "keepTime": false, + "maxItems": 100, + "query": "", + "showFolderNames": false, + "showHeadings": false, + "showRecentlyViewed": false, + "showSearch": true, + "showStarred": false, + "tags": [] + }, + "pluginVersion": "11.2.3", + "type": "dashlist" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "gridPos": { + "h": 20, + "w": 16, + "x": 6, + "y": 0 + }, + "id": 1, + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "
", + "mode": "html" + }, + "pluginVersion": "11.2.3", + "type": "text" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "gridPos": { + "h": 20, + "w": 2, + "x": 22, + "y": 0 + }, + "id": 3, + "options": { + "feedUrl": "https://corsproxy.io/?https://github.com/teslamate-org/teslamate/tags.atom", + "showImage": false + }, + "title": "Releases", + "type": "news" + } + ], + "schemaVersion": 39, + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": {}, + "timezone": "browser", + "title": "Home", + "uid": "be2m9kga7b8qoc", + "version": 1, + "weekStart": "" +} \ No newline at end of file diff --git a/grafana/dashboards/locations.json b/grafana/dashboards/locations.json index b1050da443..9f6aaa5aec 100644 --- a/grafana/dashboards/locations.json +++ b/grafana/dashboards/locations.json @@ -11,7 +11,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.0.0" + "version": "11.2.3" }, { "type": "datasource", @@ -115,6 +115,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -126,9 +127,13 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -154,11 +159,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "title": "Total addresses", @@ -203,6 +204,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -214,9 +216,13 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -242,11 +248,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "title": "Cities", @@ -291,6 +293,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -302,9 +305,13 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -330,11 +337,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "title": "States", @@ -379,6 +382,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -390,9 +394,13 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -418,11 +426,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "title": "Countries", @@ -482,9 +486,13 @@ "sizing": "auto", "valueMode": "color" }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -508,11 +516,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "title": "Cities", @@ -572,9 +576,13 @@ "sizing": "auto", "valueMode": "color" }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -600,11 +608,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "title": "States", @@ -701,9 +705,13 @@ } ] }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -729,11 +737,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "title": "Last visited", @@ -967,9 +971,13 @@ }, "showHeader": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -995,11 +1003,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "title": "Addresses", @@ -1137,9 +1141,13 @@ }, "showHeader": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -1163,11 +1171,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "title": "Geo-fences", @@ -1194,14 +1198,14 @@ "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, - "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "hide": 1, "includeAll": true, "label": "Car", "multi": true, "name": "car_id", "options": [], - "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "refresh": 1, "regex": "", "skipUrlSync": false, @@ -1260,7 +1264,6 @@ "from": "now-30d", "to": "now" }, - "timeRangeUpdatedDuringEditOrView": false, "timepicker": { "hidden": true, "refresh_intervals": [ @@ -1290,6 +1293,6 @@ "timezone": "", "title": "Locations", "uid": "ZzhF-aRWz", - "version": 2, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/mileage.json b/grafana/dashboards/mileage.json index c3e50f8ff2..b307fe37bc 100644 --- a/grafana/dashboards/mileage.json +++ b/grafana/dashboards/mileage.json @@ -5,7 +5,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.0.0" + "version": "11.2.3" }, { "type": "datasource", @@ -95,6 +95,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 20, "gradientMode": "opacity", @@ -200,7 +201,6 @@ "sort": "none" } }, - "pluginVersion": "8.5.4", "targets": [ { "alias": "", @@ -252,14 +252,14 @@ "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, - "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "hide": 2, "includeAll": true, "label": "Car", "multi": false, "name": "car_id", "options": [], - "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "refresh": 1, "regex": "", "skipUrlSync": false, @@ -321,7 +321,6 @@ "from": "now-6M", "to": "now" }, - "timeRangeUpdatedDuringEditOrView": false, "timepicker": { "refresh_intervals": [ "5s", diff --git a/grafana/dashboards/overview.json b/grafana/dashboards/overview.json index 567db08c80..a56320899a 100644 --- a/grafana/dashboards/overview.json +++ b/grafana/dashboards/overview.json @@ -11,7 +11,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.1.0" + "version": "11.2.3" }, { "type": "datasource", @@ -148,7 +148,7 @@ "showThresholdMarkers": true, "sizing": "auto" }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -330,7 +330,7 @@ "showThresholdMarkers": true, "sizing": "auto" }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -417,7 +417,7 @@ "showThresholdMarkers": true, "sizing": "auto" }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -515,6 +515,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 10, "gradientMode": "opacity", @@ -590,7 +591,6 @@ "sort": "none" } }, - "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -723,7 +723,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -830,7 +830,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -945,7 +945,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1066,7 +1066,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1191,7 +1191,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1313,7 +1313,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1384,6 +1384,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 10, "gradientMode": "opacity", @@ -1550,7 +1551,6 @@ "sort": "none" } }, - "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -1670,7 +1670,7 @@ "showThresholdMarkers": true, "sizing": "auto" }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1786,7 +1786,7 @@ "showThresholdMarkers": true, "sizing": "auto" }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1891,7 +1891,7 @@ "showThresholdMarkers": true, "sizing": "auto" }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -2028,7 +2028,6 @@ "sort": "none" } }, - "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -2080,14 +2079,14 @@ "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, - "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "hide": 2, "includeAll": true, "label": "Car", "multi": false, "name": "car_id", "options": [], - "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "refresh": 1, "regex": "", "skipUrlSync": false, @@ -2222,6 +2221,6 @@ "timezone": "", "title": "Overview", "uid": "kOuP_Fggz", - "version": 14, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/projected-range.json b/grafana/dashboards/projected-range.json index af8895ab8a..257ddb6945 100644 --- a/grafana/dashboards/projected-range.json +++ b/grafana/dashboards/projected-range.json @@ -5,7 +5,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.0.0" + "version": "11.2.3" }, { "type": "datasource", @@ -111,6 +111,7 @@ "axisLabel": "Projected Range", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 30, "gradientMode": "opacity", @@ -201,7 +202,6 @@ "sort": "none" } }, - "pluginVersion": "10.2.1", "targets": [ { "alias": "", @@ -288,6 +288,7 @@ "axisLabel": "Projected Range", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 30, "gradientMode": "opacity", @@ -379,7 +380,6 @@ "sort": "none" } }, - "pluginVersion": "10.2.1", "targets": [ { "alias": "", @@ -602,7 +602,6 @@ "sort": "none" } }, - "pluginVersion": "10.2.1", "targets": [ { "alias": "", @@ -704,14 +703,14 @@ "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, - "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "hide": 2, "includeAll": true, "label": "Car", "multi": false, "name": "car_id", "options": [], - "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "refresh": 1, "regex": "", "skipUrlSync": false, @@ -867,7 +866,6 @@ "from": "now-6M", "to": "now" }, - "timeRangeUpdatedDuringEditOrView": false, "timepicker": { "refresh_intervals": [ "5s", @@ -896,6 +894,6 @@ "timezone": "", "title": "Projected Range", "uid": "riqUfXgRz", - "version": 2, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/reports/dutch-tax.json b/grafana/dashboards/reports/dutch-tax.json index 3ca8cd55e0..f3047e4191 100644 --- a/grafana/dashboards/reports/dutch-tax.json +++ b/grafana/dashboards/reports/dutch-tax.json @@ -5,7 +5,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.0.6+security-01" + "version": "11.2.3" }, { "type": "datasource", @@ -96,6 +96,7 @@ "fieldConfig": { "defaults": { "custom": { + "align": "auto", "cellOptions": { "type": "auto" }, @@ -348,7 +349,7 @@ } ] }, - "pluginVersion": "11.0.6+security-01", + "pluginVersion": "11.2.3", "targets": [ { "alias": "", @@ -396,14 +397,14 @@ "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, - "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "hide": 2, "includeAll": true, "label": "Car", "multi": false, "name": "car_id", "options": [], - "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "refresh": 1, "regex": "", "skipUrlSync": false, @@ -511,7 +512,6 @@ "from": "now-1y", "to": "now" }, - "timeRangeUpdatedDuringEditOrView": false, "timepicker": { "refresh_intervals": [ "5s", @@ -540,6 +540,6 @@ "timezone": "", "title": "Drives - Dutch tax", "uid": "lBIoQIggk", - "version": 2, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/states.json b/grafana/dashboards/states.json index a95e36e8f6..1a9ab6a520 100644 --- a/grafana/dashboards/states.json +++ b/grafana/dashboards/states.json @@ -5,7 +5,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.0.0" + "version": "11.2.3" }, { "type": "datasource", @@ -125,6 +125,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -136,9 +137,13 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -164,11 +169,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "title": "Last state change", @@ -214,6 +215,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -225,9 +227,13 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -253,11 +259,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "title": "Current State", @@ -315,6 +317,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -326,9 +329,13 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "time_series", "group": [], "metricColumn": "none", @@ -354,11 +361,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "title": "parked (%)", @@ -469,6 +472,10 @@ }, "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "time_series", "group": [], "metricColumn": "none", @@ -494,11 +501,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "title": "States", @@ -518,14 +521,14 @@ "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, - "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "hide": 2, "includeAll": true, "label": "Car", "multi": false, "name": "car_id", "options": [], - "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "refresh": 1, "regex": "", "skipUrlSync": false, @@ -564,7 +567,6 @@ "from": "now-2d", "to": "now" }, - "timeRangeUpdatedDuringEditOrView": false, "timepicker": { "refresh_intervals": [ "5s", diff --git a/grafana/dashboards/statistics.json b/grafana/dashboards/statistics.json index af763d73a9..ac27563f8f 100644 --- a/grafana/dashboards/statistics.json +++ b/grafana/dashboards/statistics.json @@ -5,7 +5,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.0.0" + "version": "11.2.3" }, { "type": "datasource", @@ -546,15 +546,20 @@ } ] }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "repeatDirection": "h", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, + "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "WITH data AS (\nSELECT\n duration_min > 1 AND\n distance > 1 AND\n ( \n start_position.usable_battery_level IS NULL OR\n (end_position.battery_level - end_position.usable_battery_level) = 0 \n ) AS is_sufficiently_precise,\n NULLIF(GREATEST(start_ideal_range_km - end_ideal_range_km, 0), 0) AS range_diff,\n date_trunc('$period', TIMEZONE('$__timezone', TIMEZONE('UTC', start_date))) as date,\n drives.*\nFROM drives\n LEFT JOIN positions start_position ON start_position_id = start_position.id\n LEFT JOIN positions end_position ON end_position_id = end_position.id)\nSELECT\n EXTRACT(EPOCH FROM TIMEZONE('$__timezone', date))*1000 AS date_from,\n EXTRACT(EPOCH FROM (TIMEZONE('$__timezone', date) + ('1 ' || '$period')::INTERVAL))*1000 AS date_to,\n CASE '$period'\n WHEN 'month' THEN to_char(date, 'YYYY Month')\n WHEN 'year' THEN to_char(date, 'YYYY')\n WHEN 'week' THEN 'week ' || to_char(date, 'WW') || ' starting ' || to_char(date, 'YYYY-MM-DD')\n ELSE to_char(date, 'YYYY-MM-DD')\n END AS display,\n TIMEZONE('$__timezone', date) AS date,\n sum(duration_min)*60 AS sum_duration_h, \n convert_km(max(end_km)::integer - min(start_km)::integer, '$length_unit') AS sum_distance_$length_unit,\n convert_celsius(avg(outside_temp_avg), '$temp_unit') AS avg_outside_temp_$temp_unit,\n count(*) AS cnt,\n sum(distance)/sum(range_diff) AS efficiency\nFROM data WHERE\n car_id = $car_id AND\n $__timeFilter(start_date)\nGROUP BY date\nORDER BY date", + "rawSql": "WITH data AS (\nSELECT\n duration_min > 1 AND\n distance > 1 AND\n ( \n start_position.usable_battery_level IS NULL OR\n (end_position.battery_level - end_position.usable_battery_level) = 0 \n ) AS is_sufficiently_precise,\n NULLIF(GREATEST(start_ideal_range_km - end_ideal_range_km, 0), 0) AS range_diff,\n date_trunc('$period', TIMEZONE('UTC', start_date)) as date,\n drives.*\nFROM drives\n LEFT JOIN positions start_position ON start_position_id = start_position.id\n LEFT JOIN positions end_position ON end_position_id = end_position.id)\nSELECT\n EXTRACT(EPOCH FROM date)*1000 AS date_from,\n EXTRACT(EPOCH FROM date + interval '1 $period')*1000 AS date_to,\n CASE '$period'\n WHEN 'month' THEN to_char(date, 'YYYY Month')\n WHEN 'year' THEN to_char(date, 'YYYY')\n WHEN 'week' THEN 'week ' || to_char(date, 'WW') || ' starting ' || to_char(date, 'YYYY-MM-DD')\n ELSE to_char(date, 'YYYY-MM-DD')\n END AS display,\n date,\n sum(duration_min)*60 AS sum_duration_h, \n convert_km(max(end_km)::integer - min(start_km)::integer, '$length_unit') AS sum_distance_$length_unit,\n convert_celsius(avg(outside_temp_avg), '$temp_unit') AS avg_outside_temp_$temp_unit,\n count(*) AS cnt,\n sum(distance)/sum(range_diff) AS efficiency\nFROM data WHERE\n car_id = $car_id AND\n $__timeFilter(start_date)\nGROUP BY date\nORDER BY date", "refId": "A", "select": [ [ @@ -566,6 +571,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "drives", "timeColumn": "start_date", "timeColumnType": "timestamp", @@ -575,18 +597,19 @@ "params": [], "type": "macro" } - ], + ] + }, + { "datasource": { "type": "grafana-postgresql-datasource", "uid": "TeslaMate" - } - }, - { + }, + "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "WITH data AS (\n SELECT\n charging_processes.*,\n \tdate_trunc('$period', TIMEZONE('$__timezone', TIMEZONE('UTC', start_date))) as date\n FROM charging_processes)\nSELECT\n EXTRACT(EPOCH FROM TIMEZONE('$__timezone', date))*1000 AS date_from,\n EXTRACT(EPOCH FROM (TIMEZONE('$__timezone', date) + ('1 ' || '$period')::INTERVAL))*1000 AS date_to,\n CASE '$period'\n WHEN 'month' THEN to_char(date, 'YYYY Month')\n WHEN 'year' THEN to_char(date, 'YYYY')\n WHEN 'week' THEN 'week ' || to_char(date, 'WW') || ' starting ' || to_char(date, 'YYYY-MM-DD')\n ELSE to_char(date, 'YYYY-MM-DD')\n END AS display,\n TIMEZONE('$__timezone', date) AS date,\n sum(greatest(charge_energy_added,charge_energy_used)) AS sum_consumption_kwh,\n sum(greatest(charge_energy_added,charge_energy_used)) / count(*) AS avg_consumption_kwh,\n sum(cost) AS cost_charges,\n count(*) AS cnt_charges\nFROM data WHERE\n car_id = $car_id AND\n $__timeFilter(start_date) AND\n (charge_energy_added IS NULL OR charge_energy_added > 0.1)\nGROUP BY date\nORDER BY date", + "rawSql": "WITH data AS (\n SELECT\n charging_processes.*,\n \tdate_trunc('$period', TIMEZONE('UTC', start_date)) as date\n FROM charging_processes)\nSELECT\n EXTRACT(EPOCH FROM date)*1000 AS date_from,\n EXTRACT(EPOCH FROM date + interval '1 $period')*1000 AS date_to,\n CASE '$period'\n WHEN 'month' THEN to_char(date, 'YYYY Month')\n WHEN 'year' THEN to_char(date, 'YYYY')\n WHEN 'week' THEN 'week ' || to_char(date, 'WW') || ' starting ' || to_char(date, 'YYYY-MM-DD')\n ELSE to_char(date, 'YYYY-MM-DD')\n END AS display,\n date,\n sum(greatest(charge_energy_added,charge_energy_used)) AS sum_consumption_kwh,\n sum(greatest(charge_energy_added,charge_energy_used)) / count(*) AS avg_consumption_kwh,\n sum(cost) AS cost_charges,\n count(*) AS cnt_charges\nFROM data WHERE\n car_id = $car_id AND\n $__timeFilter(start_date) AND\n (charge_energy_added IS NULL OR charge_energy_added > 0.1)\nGROUP BY date\nORDER BY date", "refId": "B", "select": [ [ @@ -598,6 +621,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "timeColumn": "time", "where": [ { @@ -605,19 +645,20 @@ "params": [], "type": "macro" } - ], + ] + }, + { "datasource": { "type": "grafana-postgresql-datasource", "uid": "TeslaMate" - } - }, - { + }, + "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, - "rawSql": "WITH data AS (\n SELECT\n drives.*,\n date_trunc('$period', TIMEZONE('$__timezone', TIMEZONE('UTC', start_date))) as date\n FROM drives)\nSELECT\n EXTRACT(EPOCH FROM TIMEZONE('$__timezone', date))*1000 AS date_from,\n EXTRACT(EPOCH FROM (TIMEZONE('$__timezone', date) + ('1 ' || '$period')::INTERVAL))*1000 AS date_to,\n CASE '$period'\n WHEN 'month' THEN to_char(date, 'YYYY Month')\n WHEN 'year' THEN to_char(date, 'YYYY')\n WHEN 'week' THEN 'week ' || to_char(date, 'WW') || ' starting ' || to_char(date, 'YYYY-MM-DD')\n ELSE to_char(date, 'YYYY-MM-DD')\n END AS display,\n TIMEZONE('$__timezone', date) AS date,\n sum(GREATEST(start_${preferred_range}_range_km - end_${preferred_range}_range_km, 0) * car.efficiency * 1000) / \n convert_km(sum(distance)::numeric, '$length_unit') as efficiency_net_$length_unit\nFROM data\nJOIN cars car ON car.id = car_id\nWHERE\n car_id = $car_id AND\n $__timeFilter(start_date)\nGROUP BY date\nORDER BY date", + "rawSql": "WITH data AS (\n SELECT\n drives.*,\n date_trunc('$period', TIMEZONE('UTC', start_date)) as date\n FROM drives)\nSELECT\n EXTRACT(EPOCH FROM date)*1000 AS date_from,\n EXTRACT(EPOCH FROM date + interval '1 $period')*1000 AS date_to,\n CASE '$period'\n WHEN 'month' THEN to_char(date, 'YYYY Month')\n WHEN 'year' THEN to_char(date, 'YYYY')\n WHEN 'week' THEN 'week ' || to_char(date, 'WW') || ' starting ' || to_char(date, 'YYYY-MM-DD')\n ELSE to_char(date, 'YYYY-MM-DD')\n END AS display,\n date,\n sum(GREATEST(start_${preferred_range}_range_km - end_${preferred_range}_range_km, 0) * car.efficiency * 1000) / \n convert_km(sum(distance)::numeric, '$length_unit') as efficiency_net_$length_unit\nFROM data\nJOIN cars car ON car.id = car_id\nWHERE\n car_id = $car_id AND\n $__timeFilter(start_date)\nGROUP BY date\nORDER BY date", "refId": "C", "select": [ [ @@ -629,6 +670,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "timeColumn": "time", "where": [ { @@ -636,11 +694,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "title": "per ${period}", @@ -842,14 +896,14 @@ "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, - "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "hide": 2, "includeAll": true, "label": "Car", "multi": false, "name": "car_id", "options": [], - "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "refresh": 1, "regex": "", "skipUrlSync": false, @@ -994,7 +1048,6 @@ "from": "now-10y", "to": "now" }, - "timeRangeUpdatedDuringEditOrView": false, "timepicker": { "refresh_intervals": [ "5s", diff --git a/grafana/dashboards/timeline.json b/grafana/dashboards/timeline.json index 7ba3344b12..218aa4088f 100644 --- a/grafana/dashboards/timeline.json +++ b/grafana/dashboards/timeline.json @@ -5,7 +5,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.1.0" + "version": "11.2.3" }, { "type": "datasource", @@ -567,7 +567,7 @@ } ] }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -688,14 +688,14 @@ "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, - "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "hide": 2, "includeAll": true, "label": "Car", "multi": false, "name": "car_id", "options": [], - "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "refresh": 1, "regex": "", "skipUrlSync": false, @@ -877,6 +877,6 @@ "timezone": "", "title": "Timeline", "uid": "SUBgwtigz", - "version": 6, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/trip.json b/grafana/dashboards/trip.json index 6cdc22d772..425f0814af 100644 --- a/grafana/dashboards/trip.json +++ b/grafana/dashboards/trip.json @@ -17,7 +17,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.0.0" + "version": "11.2.3" }, { "type": "datasource", @@ -87,7 +87,7 @@ "targetBlank": true, "title": "Select last three drives", "type": "link", - "url": "/d/FkUpJpQZk?from=$from" + "url": "/d/FkUpJpQZk/trip?from=$from" }, { "icon": "dashboard", @@ -177,6 +177,49 @@ "showZoom": true }, "layers": [ + { + "config": { + "showLegend": false, + "style": { + "color": { + "fixed": "transparent" + }, + "opacity": 0, + "rotation": { + "fixed": 0, + "max": 360, + "min": -360, + "mode": "mod" + }, + "size": { + "fixed": 5, + "max": 15, + "min": 2 + }, + "symbol": { + "fixed": "img/icons/marker/circle.svg", + "mode": "fixed" + }, + "symbolAlign": { + "horizontal": "center", + "vertical": "center" + }, + "textConfig": { + "fontSize": 12, + "offsetX": 0, + "offsetY": 0, + "textAlign": "center", + "textBaseline": "middle" + } + } + }, + "location": { + "mode": "auto" + }, + "name": "Temp Fix Grafana Issue #89777", + "tooltip": false, + "type": "markers" + }, { "config": { "arrow": 0, @@ -230,7 +273,7 @@ "zoom": 15 } }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -358,6 +401,7 @@ "graphMode": "area", "justifyMode": "auto", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -369,9 +413,13 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -397,11 +445,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "type": "stat" @@ -513,6 +557,10 @@ }, "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "time_series", "group": [], "metricColumn": "none", @@ -538,13 +586,13 @@ "params": [], "type": "macro" } - ], + ] + }, + { "datasource": { "type": "grafana-postgresql-datasource", "uid": "TeslaMate" - } - }, - { + }, "format": "time_series", "group": [], "metricColumn": "none", @@ -570,11 +618,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "type": "piechart" @@ -662,6 +706,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -673,9 +718,13 @@ "textMode": "value_and_name", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -701,11 +750,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "type": "stat" @@ -782,6 +827,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -793,9 +839,13 @@ "textMode": "value_and_name", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -821,11 +871,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "type": "stat" @@ -904,6 +950,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -916,9 +963,13 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -944,11 +995,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "type": "stat" @@ -1027,6 +1074,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -1038,9 +1086,13 @@ "textMode": "value_and_name", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -1066,11 +1118,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "type": "stat" @@ -1126,6 +1174,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -1137,9 +1186,13 @@ "textMode": "value_and_name", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -1165,11 +1218,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "type": "stat" @@ -1232,9 +1281,13 @@ "sizing": "auto", "valueMode": "color" }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -1260,13 +1313,13 @@ "params": [], "type": "macro" } - ], + ] + }, + { "datasource": { "type": "grafana-postgresql-datasource", "uid": "TeslaMate" - } - }, - { + }, "format": "table", "group": [], "hide": false, @@ -1293,11 +1346,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "type": "bargauge" @@ -1407,6 +1456,10 @@ }, "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "time_series", "group": [], "metricColumn": "none", @@ -1432,11 +1485,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "transparent": true, @@ -1498,7 +1547,7 @@ { "targetBlank": false, "title": "View drive details", - "url": "d/zm7wN6Zgz?from=${__data.fields.start_date_ts.numeric}&to=${__data.fields.end_date_ts.numeric}&var-car_id=${__data.fields.car_id.numeric}&var-drive_id=${__data.fields.drive_id.numeric}" + "url": "d/zm7wN6Zgz/drive-details?from=${__data.fields.start_date_ts.numeric}&to=${__data.fields.end_date_ts.numeric}&var-car_id=${__data.fields.car_id.numeric}&var-drive_id=${__data.fields.drive_id.numeric}" } ] }, @@ -1786,7 +1835,7 @@ } ] }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "alias": "", @@ -1794,11 +1843,12 @@ "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, + "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "WITH data AS (\n SELECT\n round(extract(epoch FROM start_date)) * 1000 AS start_date_ts,\n round(extract(epoch FROM end_date)) * 1000 AS end_date_ts,\n car.id as car_id,\n CASE WHEN start_geofence.id IS NULL THEN CONCAT('new?lat=', start_position.latitude, '&lng=', start_position.longitude)\n WHEN start_geofence.id IS NOT NULL THEN CONCAT(start_geofence.id, '/edit')\n END as start_path,\n CASE WHEN end_geofence.id IS NULL THEN CONCAT('new?lat=', end_position.latitude, '&lng=', end_position.longitude)\n WHEN end_geofence.id IS NOT NULL THEN CONCAT(end_geofence.id, '/edit')\n END as end_path,\n TO_CHAR((duration_min * INTERVAL '1 minute'), 'HH24:MI') as duration_str,\n drives.id as drive_id,\n -- Columns\n start_date,\n COALESCE(start_geofence.name, CONCAT_WS(', ', COALESCE(start_address.name, nullif(CONCAT_WS(' ', start_address.road, start_address.house_number), '')), start_address.city)) AS start_address,\n COALESCE(end_geofence.name, CONCAT_WS(', ', COALESCE(end_address.name, nullif(CONCAT_WS(' ', end_address.road, end_address.house_number), '')), end_address.city)) AS end_address,\n duration_min,\n distance,\n start_position.usable_battery_level as start_usable_battery_level,\n start_position.battery_level as start_battery_level,\n end_position.usable_battery_level as end_usable_battery_level,\n end_position.battery_level as end_battery_level,\n start_position.battery_level != start_position.usable_battery_level OR end_position.battery_level != end_position.usable_battery_level as reduced_range,\n duration_min > 1 AND distance > 1 AND ( \n start_position.usable_battery_level IS NULL OR end_position.usable_battery_level IS NULL\tOR\n (end_position.battery_level - end_position.usable_battery_level) = 0 \n ) as is_sufficiently_precise,\n NULLIF(GREATEST(start_${preferred_range}_range_km - end_${preferred_range}_range_km, 0), 0) as range_diff,\n car.efficiency as car_efficiency,\n outside_temp_avg,\n distance / NULLIF(duration_min, 0) * 60 AS avg_speed\n FROM drives\n LEFT JOIN addresses start_address ON start_address_id = start_address.id\n LEFT JOIN addresses end_address ON end_address_id = end_address.id\n LEFT JOIN positions start_position ON start_position_id = start_position.id\n LEFT JOIN positions end_position ON end_position_id = end_position.id\n LEFT JOIN geofences start_geofence ON start_geofence_id = start_geofence.id\n LEFT JOIN geofences end_geofence ON end_geofence_id = end_geofence.id\n LEFT JOIN cars car ON car.id = drives.car_id\n WHERE $__timeFilter(start_date) AND drives.car_id = $car_id\n ORDER BY start_date DESC\n)\nSELECT\n start_date_ts,\n end_date_ts,\n car_id,\n start_path,\n end_path,\n duration_str,\n drive_id,\n -- Columns\n start_date,\n start_address,\n end_address,\n duration_min,\n convert_km(distance::numeric, '$length_unit') AS distance_$length_unit,\n start_battery_level as \"% Start\",\n end_battery_level as \"% End\",\n CASE WHEN is_sufficiently_precise THEN range_diff * car_efficiency / distance * 1000 * CASE WHEN '$length_unit' = 'km' THEN 1\n WHEN '$length_unit' = 'mi' THEN 1.60934\n END\n END AS consumption_kWh_$length_unit\nFROM data;", + "rawSql": "WITH data AS (\n SELECT\n round(extract(epoch FROM start_date)) * 1000 AS start_date_ts,\n round(extract(epoch FROM end_date)) * 1000 AS end_date_ts,\n car.id as car_id,\n CASE WHEN start_geofence.id IS NULL THEN CONCAT('new?lat=', start_position.latitude, '&lng=', start_position.longitude)\n WHEN start_geofence.id IS NOT NULL THEN CONCAT(start_geofence.id, '/edit')\n END as start_path,\n CASE WHEN end_geofence.id IS NULL THEN CONCAT('new?lat=', end_position.latitude, '&lng=', end_position.longitude)\n WHEN end_geofence.id IS NOT NULL THEN CONCAT(end_geofence.id, '/edit')\n END as end_path,\n TO_CHAR((duration_min * INTERVAL '1 minute'), 'HH24:MI') as duration_str,\n drives.id as drive_id,\n -- Columns\n start_date,\n COALESCE(start_geofence.name, CONCAT_WS(', ', COALESCE(start_address.name, nullif(CONCAT_WS(' ', start_address.road, start_address.house_number), '')), start_address.city)) AS start_address,\n COALESCE(end_geofence.name, CONCAT_WS(', ', COALESCE(end_address.name, nullif(CONCAT_WS(' ', end_address.road, end_address.house_number), '')), end_address.city)) AS end_address,\n duration_min,\n distance,\n start_position.usable_battery_level as start_usable_battery_level,\n start_position.battery_level as start_battery_level,\n end_position.usable_battery_level as end_usable_battery_level,\n end_position.battery_level as end_battery_level,\n start_position.battery_level != start_position.usable_battery_level OR end_position.battery_level != end_position.usable_battery_level as reduced_range,\n duration_min > 1 AND distance > 1 AND ( \n start_position.usable_battery_level IS NULL OR end_position.usable_battery_level IS NULL\tOR\n (end_position.battery_level - end_position.usable_battery_level) = 0 \n ) as is_sufficiently_precise,\n NULLIF(GREATEST(start_${preferred_range}_range_km - end_${preferred_range}_range_km, 0), 0) as range_diff,\n car.efficiency as car_efficiency,\n outside_temp_avg,\n distance / NULLIF(duration_min, 0) * 60 AS avg_speed\n FROM drives\n LEFT JOIN addresses start_address ON start_address_id = start_address.id\n LEFT JOIN addresses end_address ON end_address_id = end_address.id\n LEFT JOIN positions start_position ON start_position_id = start_position.id\n LEFT JOIN positions end_position ON end_position_id = end_position.id\n LEFT JOIN geofences start_geofence ON start_geofence_id = start_geofence.id\n LEFT JOIN geofences end_geofence ON end_geofence_id = end_geofence.id\n LEFT JOIN cars car ON car.id = drives.car_id\n WHERE $__timeFilter(start_date) AND drives.car_id = $car_id\n ORDER BY start_date DESC\n)\nSELECT\n start_date_ts,\n end_date_ts,\n car_id,\n start_path,\n end_path,\n duration_str,\n drive_id,\n -- Columns\n start_date,\n start_address,\n end_address,\n duration_min,\n convert_km(distance::numeric, '$length_unit') AS distance_$length_unit,\n start_battery_level as \"% Start\",\n end_battery_level as \"% End\",\n CASE WHEN is_sufficiently_precise THEN range_diff * car_efficiency / convert_km(distance::numeric, '$length_unit') * 1000\n END AS consumption_kWh_$length_unit\nFROM data;", "refId": "A", "select": [ [ @@ -1810,6 +1860,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "timeColumn": "time", "where": [ { @@ -1878,7 +1945,7 @@ { "targetBlank": false, "title": "View charge details", - "url": "d/BHhxFeZRz?from=${__data.fields.start_date_ts.numeric}&to=${__data.fields.end_date_ts.numeric}&var-car_id=${__data.fields.car_id.numeric}&var-charging_process_id=${__data.fields.id.numeric:raw}" + "url": "d/BHhxFeZRz/charge-details?from=${__data.fields.start_date_ts.numeric}&to=${__data.fields.end_date_ts.numeric}&var-car_id=${__data.fields.car_id.numeric}&var-charging_process_id=${__data.fields.id.numeric:raw}" } ] }, @@ -2272,7 +2339,9 @@ }, "id": 36, "options": { + "cellHeight": "sm", "footer": { + "countRows": false, "fields": "", "reducer": [ "sum" @@ -2287,7 +2356,7 @@ } ] }, - "pluginVersion": "8.5.4", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -2342,9 +2411,13 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 10, "gradientMode": "opacity", @@ -2353,6 +2426,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -2475,7 +2549,6 @@ "sort": "none" } }, - "pluginVersion": "8.5.4", "targets": [ { "datasource": { @@ -2524,9 +2597,13 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 10, "gradientMode": "opacity", @@ -2535,6 +2612,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -2635,7 +2713,6 @@ "sort": "none" } }, - "pluginVersion": "8.5.4", "targets": [ { "datasource": { @@ -2687,14 +2764,14 @@ "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, - "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "hide": 2, "includeAll": true, "label": "Car", "multi": false, "name": "car_id", "options": [], - "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "refresh": 1, "regex": "", "skipUrlSync": false, @@ -2844,10 +2921,9 @@ ] }, "time": { - "from": "now/d", + "from": "2024-11-02T13:34:36.487Z", "to": "now" }, - "timeRangeUpdatedDuringEditOrView": false, "timepicker": { "refresh_intervals": [ "5s", @@ -2876,6 +2952,6 @@ "timezone": "", "title": "Trip", "uid": "FkUpJpQZk", - "version": 2, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/updates.json b/grafana/dashboards/updates.json index aefce9b4e2..e4997885b4 100644 --- a/grafana/dashboards/updates.json +++ b/grafana/dashboards/updates.json @@ -5,7 +5,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.1.0" + "version": "11.2.3" }, { "type": "datasource", @@ -129,9 +129,13 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -157,11 +161,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "title": "Updates", @@ -213,9 +213,13 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -241,11 +245,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "title": "Median time between updates", @@ -511,7 +511,7 @@ } ] }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "scroll": true, "showHeader": true, "sort": { @@ -626,7 +626,7 @@ "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "with u as (\r\n select *, coalesce(lag(start_date) over(order by start_date desc), now()) as next_start_date \r\n from updates\r\n where car_id = $car_id and $__timeFilter(start_date)\r\n),\r\nrng as (\r\n SELECT\r\n\t date_trunc('hour', date) AS date,\r\n\t (sum(${preferred_range}_battery_range_km)/ nullif(sum(usable_battery_level),0) * 100 ) AS \"battery_rng\",\r\n\t sum(case when action = 'Charge' then 1 else 0 end) as chg_ct\r\n FROM (\r\n select coalesce(usable_battery_level, battery_level) as usable_battery_level, start_date as date, start_rated_range_km as rated_battery_range_km, start_ideal_range_km as ideal_battery_range_km, 'Drive' as action\r\n from drives d\r\n inner join positions p on d.start_position_id = p.id \r\n where d.car_id = $car_id and $__timeFilter(start_date)\r\n union all\r\n select end_battery_level as usable_battery_level, end_date, end_rated_range_km as rated_battery_range_km, end_ideal_range_km as ideal_battery_range_km, 'Charge' as action\r\n from charging_processes p\r\n where $__timeFilter(end_date) and p.car_id = $car_id\r\n ) as data\r\n GROUP BY 1\r\n)\r\n\r\nselect\t\r\n u.start_date as time,\r\n\textract(EPOCH FROM u.end_date - u.start_date) AS update_duration,\r\n\tage(date(u.start_date), date(lag(u.start_date) OVER (ORDER BY u.start_date))) AS since_last_update,\r\n\tsplit_part(u.version, ' ', 1) as version,\r\n\tsum(r.chg_ct) as chg_ct,\r\n\tconvert_km(avg(r.battery_rng), '$length_unit')::numeric(6,2) AS avg_${preferred_range}_range_${length_unit}\r\nfrom u u\r\nleft join rng r\r\n\tON r.date between u.start_date and u.next_start_date\r\ngroup by u.car_id,\r\n\tu.start_date,\r\n\tu.end_date,\r\n\tnext_start_date,\r\n\tsplit_part(u.version, ' ', 1)", + "rawSql": "with u as (\r\n select *, coalesce(lag(start_date) over(order by start_date desc), now()) as next_start_date \r\n from updates\r\n where car_id = $car_id and $__timeFilter(start_date)\r\n),\r\nrng as (\r\n SELECT\r\n\t date_trunc('hour', TIMEZONE('UTC', date)) AS date,\r\n\t (sum(${preferred_range}_battery_range_km)/ nullif(sum(usable_battery_level),0) * 100 ) AS \"battery_rng\",\r\n\t sum(case when action = 'Charge' then 1 else 0 end) as chg_ct\r\n FROM (\r\n select coalesce(usable_battery_level, battery_level) as usable_battery_level, start_date as date, start_rated_range_km as rated_battery_range_km, start_ideal_range_km as ideal_battery_range_km, 'Drive' as action\r\n from drives d\r\n inner join positions p on d.start_position_id = p.id \r\n where d.car_id = $car_id and $__timeFilter(start_date)\r\n union all\r\n select end_battery_level as usable_battery_level, end_date, end_rated_range_km as rated_battery_range_km, end_ideal_range_km as ideal_battery_range_km, 'Charge' as action\r\n from charging_processes p\r\n where $__timeFilter(end_date) and p.car_id = $car_id\r\n ) as data\r\n GROUP BY 1\r\n)\r\n\r\nselect\t\r\n u.start_date as time,\r\n\textract(EPOCH FROM u.end_date - u.start_date) AS update_duration,\r\n\tage(date(u.start_date), date(lag(u.start_date) OVER (ORDER BY u.start_date))) AS since_last_update,\r\n\tsplit_part(u.version, ' ', 1) as version,\r\n\tsum(r.chg_ct) as chg_ct,\r\n\tconvert_km(avg(r.battery_rng), '$length_unit')::numeric(6,2) AS avg_${preferred_range}_range_${length_unit}\r\nfrom u u\r\nleft join rng r\r\n\tON r.date between u.start_date and u.next_start_date\r\ngroup by u.car_id,\r\n\tu.start_date,\r\n\tu.end_date,\r\n\tnext_start_date,\r\n\tsplit_part(u.version, ' ', 1)", "refId": "A", "select": [ [ @@ -683,14 +683,14 @@ "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, - "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "hide": 2, "includeAll": true, "label": "Car", "multi": false, "name": "car_id", "options": [], - "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "refresh": 1, "regex": "", "skipUrlSync": false, @@ -800,6 +800,6 @@ "timezone": "", "title": "Updates", "uid": "IiC07mgWz", - "version": 2, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/vampire-drain.json b/grafana/dashboards/vampire-drain.json index a81ad82735..f8c94a4859 100644 --- a/grafana/dashboards/vampire-drain.json +++ b/grafana/dashboards/vampire-drain.json @@ -5,7 +5,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.0.0" + "version": "11.2.3" }, { "type": "datasource", @@ -132,7 +132,7 @@ { "targetBlank": false, "title": "", - "url": "d/zm7wN6Zgz?from=${__data.fields.start_date_ts.numeric}&to=${__data.fields.end_date_ts.numeric}" + "url": "d/zm7wN6Zgz/drive-details?from=${__data.fields.start_date_ts.numeric}&to=${__data.fields.end_date_ts.numeric}" } ] }, @@ -548,7 +548,7 @@ }, "showHeader": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "alias": "", @@ -606,14 +606,14 @@ "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, - "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "hide": 2, "includeAll": true, "label": "Car", "multi": false, "name": "car_id", "options": [], - "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "refresh": 1, "regex": "", "skipUrlSync": false, @@ -749,7 +749,6 @@ "from": "now-90d", "to": "now" }, - "timeRangeUpdatedDuringEditOrView": false, "timepicker": { "refresh_intervals": [ "5s", diff --git a/grafana/dashboards/visited.json b/grafana/dashboards/visited.json index dd23b5192e..7eae4c0b21 100644 --- a/grafana/dashboards/visited.json +++ b/grafana/dashboards/visited.json @@ -11,7 +11,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.0.0" + "version": "11.2.3" }, { "type": "datasource", @@ -129,11 +129,9 @@ "maxDataPoints": 10000000, "options": { "basemap": { - "config": { - "server": "streets" - }, + "config": {}, "name": "Layer 0", - "type": "esri-xyz" + "type": "osm-standard" }, "controls": { "mouseWheelZoom": true, @@ -144,6 +142,49 @@ "showZoom": true }, "layers": [ + { + "config": { + "showLegend": false, + "style": { + "color": { + "fixed": "transparent" + }, + "opacity": 0, + "rotation": { + "fixed": 0, + "max": 360, + "min": -360, + "mode": "mod" + }, + "size": { + "fixed": 5, + "max": 15, + "min": 2 + }, + "symbol": { + "fixed": "img/icons/marker/circle.svg", + "mode": "fixed" + }, + "symbolAlign": { + "horizontal": "center", + "vertical": "center" + }, + "textConfig": { + "fontSize": 12, + "offsetX": 0, + "offsetY": 0, + "textAlign": "center", + "textBaseline": "middle" + } + } + }, + "location": { + "mode": "auto" + }, + "name": "Temp Fix Grafana Issue #89777", + "tooltip": false, + "type": "markers" + }, { "config": { "arrow": 0, @@ -202,7 +243,7 @@ "zoom": 15 } }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -213,7 +254,7 @@ "format": "table", "hide": false, "rawQuery": true, - "rawSql": "SELECT\n date_trunc('minute', date) as time,\n avg(latitude) as latitude,\n avg(longitude) as longitude\nFROM\n positions\nWHERE\n car_id = $car_id AND $__timeFilter(date) and ideal_battery_range_km is not null\nGROUP BY 1\nORDER BY 1", + "rawSql": "SELECT\n date_trunc('minute', TIMEZONE('UTC', date)) as time,\n avg(latitude) as latitude,\n avg(longitude) as longitude\nFROM\n positions\nWHERE\n car_id = $car_id AND $__timeFilter(date) and ideal_battery_range_km is not null\nGROUP BY 1\nORDER BY 1", "refId": "Positions", "sql": { "columns": [ @@ -271,6 +312,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -282,7 +324,7 @@ "textMode": "value_and_name", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -417,6 +459,7 @@ "graphMode": "none", "justifyMode": "center", "orientation": "vertical", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -428,7 +471,7 @@ "textMode": "value_and_name", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -440,86 +483,8 @@ "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT\n\tsum(charge_energy_added) as \"Total energy added\"\nFROM\n\tcharging_processes\nWHERE\n\tcar_id = $car_id AND $__timeFilter(start_date) AND charge_energy_added > 0.01", - "refId": "Total energy added", - "select": [ - [ - { - "params": [ - "efficiency" - ], - "type": "column" - } - ] - ], - "sql": { - "columns": [ - { - "parameters": [], - "type": "function" - } - ], - "groupBy": [ - { - "property": { - "type": "string" - }, - "type": "groupBy" - } - ], - "limit": 50 - }, - "table": "cars", - "timeColumn": "inserted_at", - "timeColumnType": "timestamp", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] - }, - { - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - }, - "editorMode": "code", - "format": "table", - "hide": false, - "rawQuery": true, - "rawSql": "SELECT\r\n\tSUM(charge_energy_used) AS \"Total energy used\"\r\nFROM\r\n\tcharging_processes\r\nWHERE\r\n\tcar_id = $car_id AND $__timeFilter(start_date) AND charge_energy_added > 0.01\r\n", - "refId": "Total energy used", - "sql": { - "columns": [ - { - "parameters": [], - "type": "function" - } - ], - "groupBy": [ - { - "property": { - "type": "string" - }, - "type": "groupBy" - } - ], - "limit": 50 - } - }, - { - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - }, - "editorMode": "code", - "format": "table", - "hide": false, - "rawQuery": true, - "rawSql": "SELECT\r\n\tSUM(charge_energy_added) * 100 / SUM(charge_energy_used) AS \"Charge Efficiency\"\r\nFROM\r\n\tcharging_processes\r\nWHERE\r\n\tcar_id = $car_id AND $__timeFilter(start_date) AND charge_energy_added > 0.01\r\n", - "refId": "Charge Efficiency", + "rawSql": "SELECT\n\tsum(charge_energy_added) as \"Total energy added\",\n\tSUM(charge_energy_used) AS \"Total energy used\",\n\tSUM(charge_energy_added) * 100 / SUM(charge_energy_used) AS \"Charge Efficiency\"\nFROM\n\tcharging_processes\nWHERE\n\tcar_id = $car_id AND $__timeFilter(start_date) AND charge_energy_added > 0.01", + "refId": "A", "sql": { "columns": [ { @@ -593,6 +558,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -604,7 +570,7 @@ "textMode": "value_and_name", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -673,14 +639,14 @@ "type": "grafana-postgresql-datasource", "uid": "TeslaMate" }, - "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "hide": 2, "includeAll": true, "label": "Car", "multi": false, "name": "car_id", "options": [], - "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", + "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, CONCAT('VIN ', vin)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;", "refresh": 1, "regex": "", "skipUrlSync": false, @@ -766,6 +732,6 @@ "timezone": "", "title": "Visited", "uid": "RG_DxSmgk", - "version": 5, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/mix.lock b/mix.lock index a449acbd8d..39c4d74623 100644 --- a/mix.lock +++ b/mix.lock @@ -22,7 +22,7 @@ "expo": {:hex, :expo, "1.1.0", "f7b9ed7fb5745ebe1eeedf3d6f29226c5dd52897ac67c0f8af62a07e661e5c75", [:mix], [], "hexpm", "fbadf93f4700fb44c331362177bdca9eeb8097e8b0ef525c9cc501cb9917c960"}, "file_system": {:hex, :file_system, "1.0.1", "79e8ceaddb0416f8b8cd02a0127bdbababe7bf4a23d2a395b983c1f8b3f73edd", [:mix], [], "hexpm", "4414d1f38863ddf9120720cd976fce5bdde8e91d8283353f0e31850fa89feb9e"}, "finch": {:hex, :finch, "0.19.0", "c644641491ea854fc5c1bbaef36bfc764e3f08e7185e1f084e35e0672241b76d", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.6.2 or ~> 1.7", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 1.1", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "fc5324ce209125d1e2fa0fcd2634601c52a787aff1cd33ee833664a5af4ea2b6"}, - "floki": {:hex, :floki, "0.36.2", "a7da0193538c93f937714a6704369711998a51a6164a222d710ebd54020aa7a3", [:mix], [], "hexpm", "a8766c0bc92f074e5cb36c4f9961982eda84c5d2b8e979ca67f5c268ec8ed580"}, + "floki": {:hex, :floki, "0.36.3", "1102f93b16a55bc5383b85ae3ec470f82dee056eaeff9195e8afdf0ef2a43c30", [:mix], [], "hexpm", "fe0158bff509e407735f6d40b3ee0d7deb47f3f3ee7c6c182ad28599f9f6b27a"}, "fuse": {:hex, :fuse, "2.5.0", "71afa90be21da4e64f94abba9d36472faa2d799c67fedc3bd1752a88ea4c4753", [:rebar3], [], "hexpm", "7f52a1c84571731ad3c91d569e03131cc220ebaa7e2a11034405f0bac46a4fef"}, "gen_state_machine": {:hex, :gen_state_machine, "3.0.0", "1e57f86a494e5c6b14137ebef26a7eb342b3b0070c7135f2d6768ed3f6b6cdff", [:mix], [], "hexpm", "0a59652574bebceb7309f6b749d2a41b45fdeda8dbb4da0791e355dd19f0ed15"}, "gettext": {:hex, :gettext, "0.26.1", "38e14ea5dcf962d1fc9f361b63ea07c0ce715a8ef1f9e82d3dfb8e67e0416715", [:mix], [{:expo, "~> 0.5.1 or ~> 1.0", [hex: :expo, repo: "hexpm", optional: false]}], "hexpm", "01ce56f188b9dc28780a52783d6529ad2bc7124f9744e571e1ee4ea88bf08734"}, @@ -57,7 +57,7 @@ "srtm": {:hex, :srtm, "0.8.0", "b01eb8b1487b021a0a5851b5e4cdbd113b6f72c502ae988e7ce1ac35f856302d", [:mix], [{:castore, "~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}], "hexpm", "7ec2a2ced7c3c0c1bdcfca67ce4d466d77e66cf52589f546c91b96b4c79b6923"}, "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.7", "354c321cf377240c7b8716899e182ce4890c5938111a1296add3ec74cf1715df", [:make, :mix, :rebar3], [], "hexpm", "fe4c190e8f37401d30167c8c405eda19469f34577987c76dde613e838bbc67f8"}, "telemetry": {:hex, :telemetry, "1.3.0", "fedebbae410d715cf8e7062c96a1ef32ec22e764197f70cda73d82778d61e7a2", [:rebar3], [], "hexpm", "7015fc8919dbe63764f4b4b87a95b7c0996bd539e0d499be6ec9d7f3875b79e6"}, - "tesla": {:hex, :tesla, "1.12.1", "fe2bf4250868ee72e5d8b8dfa408d13a00747c41b7237b6aa3b9a24057346681", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:exjsx, ">= 3.0.0", [hex: :exjsx, repo: "hexpm", optional: true]}, {:finch, "~> 0.13", [hex: :finch, repo: "hexpm", optional: true]}, {:fuse, "~> 2.4", [hex: :fuse, repo: "hexpm", optional: true]}, {:gun, ">= 1.0.0", [hex: :gun, repo: "hexpm", optional: true]}, {:hackney, "~> 1.6", [hex: :hackney, repo: "hexpm", optional: true]}, {:ibrowse, "4.4.2", [hex: :ibrowse, repo: "hexpm", optional: true]}, {:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: true]}, {:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.0", [hex: :mint, repo: "hexpm", optional: true]}, {:msgpax, "~> 2.3", [hex: :msgpax, repo: "hexpm", optional: true]}, {:poison, ">= 1.0.0", [hex: :poison, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm", "2391efc6243d37ead43afd0327b520314c7b38232091d4a440c1212626fdd6e7"}, + "tesla": {:hex, :tesla, "1.13.0", "24a068a48d107080dd7c943a593997eee265977a38020eb2ab657cca78a12502", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:exjsx, ">= 3.0.0", [hex: :exjsx, repo: "hexpm", optional: true]}, {:finch, "~> 0.13", [hex: :finch, repo: "hexpm", optional: true]}, {:fuse, "~> 2.4", [hex: :fuse, repo: "hexpm", optional: true]}, {:gun, ">= 1.0.0", [hex: :gun, repo: "hexpm", optional: true]}, {:hackney, "~> 1.6", [hex: :hackney, repo: "hexpm", optional: true]}, {:ibrowse, "4.4.2", [hex: :ibrowse, repo: "hexpm", optional: true]}, {:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: true]}, {:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.0", [hex: :mint, repo: "hexpm", optional: true]}, {:mox, "~> 1.0", [hex: :mox, repo: "hexpm", optional: true]}, {:msgpax, "~> 2.3", [hex: :msgpax, repo: "hexpm", optional: true]}, {:poison, ">= 1.0.0", [hex: :poison, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm", "7b8fc8f6b0640fa0d090af7889d12eb396460e044b6f8688a8e55e30406a2200"}, "timex": {:hex, :timex, "3.7.11", "bb95cb4eb1d06e27346325de506bcc6c30f9c6dea40d1ebe390b262fad1862d1", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:gettext, "~> 0.20", [hex: :gettext, repo: "hexpm", optional: false]}, {:tzdata, "~> 1.1", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm", "8b9024f7efbabaf9bd7aa04f65cf8dcd7c9818ca5737677c7b76acbc6a94d1aa"}, "tortoise311": {:hex, :tortoise311, "0.12.0", "05c1f78da9aa3f7563ad66c71d2cb7904890797437078e86173d65d2a2d06f64", [:mix], [{:gen_state_machine, "~> 2.0 or ~> 3.0", [hex: :gen_state_machine, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "b8bd5b1b603f75355d02c655e496a2cbb59c754e45014bcb86968899297197bb"}, "tzdata": {:hex, :tzdata, "1.1.2", "45e5f1fcf8729525ec27c65e163be5b3d247ab1702581a94674e008413eef50b", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "cec7b286e608371602318c414f344941d5eb0375e14cfdab605cca2fe66cba8b"}, diff --git a/nix/flake-modules/formatter.nix b/nix/flake-modules/formatter.nix index 7b63d517eb..c5e501172a 100644 --- a/nix/flake-modules/formatter.nix +++ b/nix/flake-modules/formatter.nix @@ -19,6 +19,7 @@ "*.dockerignore" ".envrc" "*.node-version" + "CONTRIBUTING" "Dockerfile" "grafana/Dockerfile" "Makefile" diff --git a/nix/flake-modules/package.nix b/nix/flake-modules/package.nix index 1a073cb97b..703270ecbc 100644 --- a/nix/flake-modules/package.nix +++ b/nix/flake-modules/package.nix @@ -13,7 +13,7 @@ TOP_SRC = src; pname = "${pname}-mix-deps"; inherit src version; - hash = "sha256-46RLGX86/soSlEHifFspFGQeDU6s9agFEa9uRw4tZRg="; + hash = "sha256-RVsoxqRtOmtFJgzLc0W6WPkcljsebtreAa63n5PMskI="; # hash = pkgs.lib.fakeHash; }; @@ -45,8 +45,8 @@ cldr = pkgs.fetchFromGitHub { owner = "elixir-cldr"; repo = "cldr"; - rev = "v2.37.5"; - sha256 = "sha256-T5Qvuo+xPwpgBsqHNZYnTCA4loToeBn1LKTMsDcCdYs="; + rev = "v2.40.0"; + sha256 = "sha256-B3kIJx684kg3uxdFaWWMn9SBktb1GUqCzSJwN1a0oNo="; # sha256 = pkgs.lib.fakeHash; }; diff --git a/nix/module.nix b/nix/module.nix index d62aab6bca..cf2495d137 100644 --- a/nix/module.nix +++ b/nix/module.nix @@ -245,14 +245,17 @@ in }; security = { allow_embedding = true; - disable_gravatr = true; + disable_gravatar = true; }; users = { allow_sign_up = false; + default_language = "detect"; }; "auth.anonymous".enabled = false; "auth.basic".enabled = false; analytics.reporting_enabled = false; + dashboards.default_home_dashboard_path = "../grafana/dashboards/internal/home.json"; + date_formats.use_browser_locale = true; }; provision = { enable = true; @@ -269,7 +272,7 @@ in folderUid = "Nr4ofiDZk"; type = "file"; disableDeletion = false; - editable = true; + allowUiUpdates = true; updateIntervalSeconds = 86400; options.path = lib.sources.sourceFilesBySuffices ../grafana/dashboards @@ -282,7 +285,7 @@ in folderUid = "Nr5ofiDZk"; type = "file"; disableDeletion = false; - editable = true; + allowUiUpdates = true; updateIntervalSeconds = 86400; options.path = lib.sources.sourceFilesBySuffices ../grafana/dashboards/internal @@ -295,7 +298,7 @@ in folderUid = "Nr6ofiDZk"; type = "file"; disableDeletion = false; - editable = true; + allowUiUpdates = true; updateIntervalSeconds = 86400; options.path = lib.sources.sourceFilesBySuffices ../grafana/dashboards/reports diff --git a/treefmt.toml b/treefmt.toml index 5771b12021..98e1c528fb 100644 --- a/treefmt.toml +++ b/treefmt.toml @@ -6,6 +6,7 @@ excludes = [ "*.dockerignore", ".envrc", "*.node-version", + "CONTRIBUTING", "Dockerfile", "grafana/Dockerfile", "Makefile", diff --git a/website/docs/installation/debian.md b/website/docs/installation/debian.md index 9dc6657361..be34ebde03 100644 --- a/website/docs/installation/debian.md +++ b/website/docs/installation/debian.md @@ -37,7 +37,7 @@ Source: [elixir-lang.org/install](https://elixir-lang.org/install)
- Grafana (v11.1.0+) + Grafana (v11.2.3+) ```bash sudo apt-get install -y apt-transport-https software-properties-common diff --git a/website/docs/integrations/home_assistant.md b/website/docs/integrations/home_assistant.md index 4cbbb3edcf..73c6512c6a 100644 --- a/website/docs/integrations/home_assistant.md +++ b/website/docs/integrations/home_assistant.md @@ -1,21 +1,23 @@ --- -title: HomeAssistant Integration -sidebar_label: HomeAssistant +title: Home Assistant Integration +sidebar_label: Home Assistant --- -Whilst HomeAssistant provides an official component for Tesla vehicles, the component has not been updated recently, and does not have the sophistication of TeslaMate's polling mechanism, resulting in the component's default values keeping the vehicle awake and draining the battery. +## Introduction + +Whilst Home Assistant provides an official component for Tesla vehicles, the component has not been updated recently, and does not have the sophistication of TeslaMate's polling mechanism, resulting in the component's default values keeping the vehicle awake and draining the battery. The ultimate goal of this guide is to consume as much of the TeslaMate polling data as possible to replace the majority of the official Tesla component's polling functionality. If your intention is to only use read-only sensor values, those provided by TeslaMate via MQTT are sufficient, and you do not need to utilise the official Tesla component. If however you would like to be able to write values to the Tesla API (Lock/Unlock Doors or automate Climate), there is a solution which involves configuring an extremely high polling interval for the Tesla component and using automation to populate the values from the TeslaMate MQTT parameters. -**Screenshots** +### Screenshots import useBaseUrl from '@docusaurus/useBaseUrl'; HASS Screenshot -**Current Status** +### Current Status - Sensors: All sensors exposed by the Tesla component are available - Locks: Not implemented @@ -23,6 +25,8 @@ import useBaseUrl from '@docusaurus/useBaseUrl'; ## Configuration +The following configurations assume a car ID of 1 (`teslamate/cars/1`). It usually starts at 1, but it can be different if you have multiple cars in TeslaMate for example. + ### configuration.yaml Proximity sensors allow us to calculate the proximity of the Tesla `device_tracker` to defined zones. This can be useful for: @@ -53,23 +57,19 @@ binary_sensor: !include binary_sensor.yaml ### mqtt_sensors.yaml (mqtt: section of configuration.yaml) -Don't forget to replace `` and `` with correct corresponding values. +Don't forget to replace ``, `` and `` with correct corresponding values. ```yml title="mqtt_sensors.yaml" - sensor: name: Display Name object_id: tesla_display_name # entity_id unique_id: teslamate_1_display_name # internal id, used for device grouping - availability: &teslamate_availability - - topic: teslamate/cars/1/healthy - payload_available: "true" - payload_not_available: "false" device: &teslamate_device_info identifiers: [teslamate_car_1] - configuration_url: https://teslamate.zxxz.io/ + configuration_url: # update this with your teslamate URL, e.g. https://teslamate.example.com/ manufacturer: Tesla - model: Model 3 - name: Tesla Model 3 + model: # update this with your car model, e.g. Model 3 + name: # update this with your car name, e.g. Tesla Model 3 state_topic: "teslamate/cars/1/display_name" icon: mdi:car @@ -77,7 +77,6 @@ Don't forget to replace `` and `` with correct name: Location object_id: tesla_location unique_id: teslamate_1_location - availability: *teslamate_availability device: *teslamate_device_info json_attributes_topic: "teslamate/cars/1/location" icon: mdi:crosshairs-gps @@ -103,7 +102,6 @@ Don't forget to replace `` and `` with correct name: State object_id: tesla_state unique_id: teslamate_1_state - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/state" icon: mdi:car-connected @@ -112,7 +110,6 @@ Don't forget to replace `` and `` with correct name: Since object_id: tesla_since unique_id: teslamate_1_since - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/since" device_class: timestamp @@ -122,7 +119,6 @@ Don't forget to replace `` and `` with correct name: Version object_id: tesla_version unique_id: teslamate_1_version - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/version" icon: mdi:alphabetical @@ -131,7 +127,6 @@ Don't forget to replace `` and `` with correct name: Update Version object_id: tesla_update_version unique_id: teslamate_1_update_version - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/update_version" icon: mdi:alphabetical @@ -140,7 +135,6 @@ Don't forget to replace `` and `` with correct name: Model object_id: tesla_model unique_id: teslamate_1_model - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/model" @@ -148,7 +142,6 @@ Don't forget to replace `` and `` with correct name: Trim Badging object_id: tesla_trim_badging unique_id: teslamate_1_trim_badging - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/trim_badging" icon: mdi:shield-star-outline @@ -157,7 +150,6 @@ Don't forget to replace `` and `` with correct name: Exterior Color object_id: tesla_exterior_color unique_id: teslamate_1_exterior_color - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/exterior_color" icon: mdi:palette @@ -166,7 +158,6 @@ Don't forget to replace `` and `` with correct name: Wheel Type object_id: tesla_wheel_type unique_id: teslamate_1_wheel_type - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/wheel_type" @@ -174,7 +165,6 @@ Don't forget to replace `` and `` with correct name: Spoiler Type object_id: tesla_spoiler_type unique_id: teslamate_1_spoiler_type - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/spoiler_type" icon: mdi:car-sports @@ -183,7 +173,6 @@ Don't forget to replace `` and `` with correct name: Geofence object_id: tesla_geofence unique_id: teslamate_1_geofence - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/geofence" icon: mdi:earth @@ -192,7 +181,6 @@ Don't forget to replace `` and `` with correct name: Shift State object_id: tesla_shift_state unique_id: teslamate_1_shift_state - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/shift_state" icon: mdi:car-shift-pattern @@ -201,7 +189,6 @@ Don't forget to replace `` and `` with correct name: Power object_id: tesla_power unique_id: teslamate_1_power - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/power" device_class: power @@ -212,7 +199,6 @@ Don't forget to replace `` and `` with correct name: Speed object_id: tesla_speed unique_id: teslamate_1_speed - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/speed" unit_of_measurement: "km/h" @@ -222,7 +208,6 @@ Don't forget to replace `` and `` with correct name: Heading object_id: tesla_heading unique_id: teslamate_1_heading - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/heading" unit_of_measurement: ° @@ -232,7 +217,6 @@ Don't forget to replace `` and `` with correct name: Elevation object_id: tesla_elevation unique_id: teslamate_1_elevation - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/elevation" unit_of_measurement: m @@ -242,7 +226,6 @@ Don't forget to replace `` and `` with correct name: Inside Temp object_id: tesla_inside_temp unique_id: teslamate_1_inside_temp - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/inside_temp" device_class: temperature @@ -253,7 +236,6 @@ Don't forget to replace `` and `` with correct name: Outside Temp object_id: tesla_outside_temp unique_id: teslamate_1_outside_temp - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/outside_temp" device_class: temperature @@ -264,7 +246,6 @@ Don't forget to replace `` and `` with correct name: Odometer object_id: tesla_odometer unique_id: teslamate_1_odometer - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/odometer" unit_of_measurement: km @@ -274,7 +255,6 @@ Don't forget to replace `` and `` with correct name: Est Battery Range object_id: tesla_est_battery_range_km unique_id: teslamate_1_est_battery_range_km - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/est_battery_range_km" unit_of_measurement: km @@ -284,7 +264,6 @@ Don't forget to replace `` and `` with correct name: Rated Battery Range object_id: tesla_rated_battery_range_km unique_id: teslamate_1_rated_battery_range_km - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/rated_battery_range_km" unit_of_measurement: km @@ -294,7 +273,6 @@ Don't forget to replace `` and `` with correct name: Ideal Battery Range object_id: tesla_ideal_battery_range_km unique_id: teslamate_1_ideal_battery_range_km - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/ideal_battery_range_km" unit_of_measurement: km @@ -304,7 +282,6 @@ Don't forget to replace `` and `` with correct name: Battery Level object_id: tesla_battery_level unique_id: teslamate_1_battery_level - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/battery_level" device_class: battery @@ -315,7 +292,6 @@ Don't forget to replace `` and `` with correct name: Usable Battery Level object_id: tesla_usable_battery_level unique_id: teslamate_1_usable_battery_level - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/usable_battery_level" unit_of_measurement: "%" @@ -325,7 +301,6 @@ Don't forget to replace `` and `` with correct name: Charge Energy Added object_id: tesla_charge_energy_added unique_id: teslamate_1_charge_energy_added - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/charge_energy_added" device_class: energy @@ -336,7 +311,6 @@ Don't forget to replace `` and `` with correct name: Charge Limit Soc object_id: tesla_charge_limit_soc unique_id: teslamate_1_charge_limit_soc - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/charge_limit_soc" unit_of_measurement: "%" @@ -346,7 +320,6 @@ Don't forget to replace `` and `` with correct name: Charger Actual Current object_id: tesla_charger_actual_current unique_id: teslamate_1_charger_actual_current - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/charger_actual_current" device_class: current @@ -357,7 +330,6 @@ Don't forget to replace `` and `` with correct name: Charger Phases object_id: tesla_charger_phases unique_id: teslamate_1_charger_phases - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/charger_phases" icon: mdi:sine-wave @@ -366,7 +338,6 @@ Don't forget to replace `` and `` with correct name: Charger Power object_id: tesla_charger_power unique_id: teslamate_1_charger_power - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/charger_power" device_class: power @@ -377,7 +348,6 @@ Don't forget to replace `` and `` with correct name: Charger Voltage object_id: tesla_charger_voltage unique_id: teslamate_1_charger_voltage - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/charger_voltage" device_class: voltage @@ -388,7 +358,6 @@ Don't forget to replace `` and `` with correct name: Scheduled Charging Start Time object_id: tesla_scheduled_charging_start_time unique_id: teslamate_1_scheduled_charging_start_time - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/scheduled_charging_start_time" device_class: timestamp @@ -398,7 +367,6 @@ Don't forget to replace `` and `` with correct name: Time To Full Charge object_id: tesla_time_to_full_charge unique_id: teslamate_1_time_to_full_charge - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/time_to_full_charge" unit_of_measurement: h @@ -408,7 +376,6 @@ Don't forget to replace `` and `` with correct name: TPMS Pressure Front Left object_id: tesla_tpms_pressure_fl unique_id: teslamate_1_tpms_pressure_fl - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/tpms_pressure_fl" unit_of_measurement: bar @@ -418,7 +385,6 @@ Don't forget to replace `` and `` with correct name: TPMS Pressure Front Right object_id: tesla_tpms_pressure_fr unique_id: teslamate_1_tpms_pressure_fr - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/tpms_pressure_fr" unit_of_measurement: bar @@ -428,7 +394,6 @@ Don't forget to replace `` and `` with correct name: TPMS Pressure Rear Left object_id: tesla_tpms_pressure_rl unique_id: teslamate_1_tpms_pressure_rl - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/tpms_pressure_rl" unit_of_measurement: bar @@ -438,7 +403,6 @@ Don't forget to replace `` and `` with correct name: TPMS Pressure Rear Right object_id: tesla_tpms_pressure_rr unique_id: teslamate_1_tpms_pressure_rr - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/tpms_pressure_rr" unit_of_measurement: bar @@ -517,7 +481,6 @@ Don't forget to replace `` and `` with correct name: Healthy object_id: tesla_healthy unique_id: teslamate_1_healthy - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/healthy" payload_on: "true" @@ -528,7 +491,6 @@ Don't forget to replace `` and `` with correct name: Update Available object_id: tesla_update_available unique_id: teslamate_1_update_available - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/update_available" payload_on: "true" @@ -539,7 +501,6 @@ Don't forget to replace `` and `` with correct name: Locked object_id: tesla_locked unique_id: teslamate_1_locked - availability: *teslamate_availability device: *teslamate_device_info device_class: lock state_topic: "teslamate/cars/1/locked" @@ -550,7 +511,6 @@ Don't forget to replace `` and `` with correct name: Sentry Mode object_id: tesla_sentry_mode unique_id: teslamate_1_sentry_mode - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/sentry_mode" payload_on: "true" @@ -561,7 +521,6 @@ Don't forget to replace `` and `` with correct name: Windows Open object_id: tesla_windows_open unique_id: teslamate_1_windows_open - availability: *teslamate_availability device: *teslamate_device_info device_class: window state_topic: "teslamate/cars/1/windows_open" @@ -573,7 +532,6 @@ Don't forget to replace `` and `` with correct name: Doors Open object_id: tesla_doors_open unique_id: teslamate_1_doors_open - availability: *teslamate_availability device: *teslamate_device_info device_class: door state_topic: "teslamate/cars/1/doors_open" @@ -585,7 +543,6 @@ Don't forget to replace `` and `` with correct name: Trunk Open object_id: tesla_trunk_open unique_id: teslamate_1_trunk_open - availability: *teslamate_availability device: *teslamate_device_info device_class: opening state_topic: "teslamate/cars/1/trunk_open" @@ -597,7 +554,6 @@ Don't forget to replace `` and `` with correct name: Frunk Open object_id: tesla_frunk_open unique_id: teslamate_1_frunk_open - availability: *teslamate_availability device: *teslamate_device_info device_class: opening state_topic: "teslamate/cars/1/frunk_open" @@ -609,7 +565,6 @@ Don't forget to replace `` and `` with correct name: Is User Present object_id: tesla_is_user_present unique_id: teslamate_1_is_user_present - availability: *teslamate_availability device: *teslamate_device_info device_class: presence state_topic: "teslamate/cars/1/is_user_present" @@ -621,7 +576,6 @@ Don't forget to replace `` and `` with correct name: Is Climate On object_id: tesla_is_climate_on unique_id: teslamate_1_is_climate_on - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/is_climate_on" payload_on: "true" @@ -632,7 +586,6 @@ Don't forget to replace `` and `` with correct name: Is Preconditioning object_id: tesla_is_preconditioning unique_id: teslamate_1_is_preconditioning - availability: *teslamate_availability device: *teslamate_device_info state_topic: "teslamate/cars/1/is_preconditioning" payload_on: "true" @@ -643,7 +596,6 @@ Don't forget to replace `` and `` with correct name: Plugged In object_id: tesla_plugged_in unique_id: teslamate_1_plugged_in - availability: *teslamate_availability device: *teslamate_device_info device_class: plug state_topic: "teslamate/cars/1/plugged_in" @@ -655,7 +607,6 @@ Don't forget to replace `` and `` with correct name: Charge Port Door OPEN object_id: tesla_charge_port_door_open unique_id: teslamate_1_charge_port_door_open - availability: *teslamate_availability device: *teslamate_device_info device_class: opening state_topic: "teslamate/cars/1/charge_port_door_open" @@ -1045,7 +996,8 @@ The following set of automations and scripts will detect when a Tesla door, frun By default, the script will repeatedly notify every 5 minutes. Remove the recursive `script.turn_on` sequence in the `notify_tesla_open` script if you'd only like to be informed once. -We add the random 30 second interval after each notification to avoid clobbering the notification script when we have multiple things open at once. For example, opening the door will open the door and the window. If we don't delay the calls, we will only get a message about the window (as it is the last call to the script) and if we then close the window, we won't get notifications about other things left open. This results in more notifications but less chance on missing out on knowing something was left open. +We add the random 30 second interval after each notification to avoid clobbering the notification script when we have multiple things open at once. +For example, opening the door will open the door and the window. If we don't delay the calls, we will only get a message about the window (as it is the last call to the script) and if we then close the window, we won't get notifications about other things left open. This results in more notifications but less chance on missing out on knowing something was left open. #### automation.yaml