From 61996189de54d92f548dc6f337119603434e6771 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 2 Nov 2024 10:04:07 +0100 Subject: [PATCH 01/31] build(deps): bump actions/checkout from 4.2.1 to 4.2.2 (#4340) Bumps [actions/checkout](https://github.com/actions/checkout) from 4.2.1 to 4.2.2. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871...11bd71901bbe5b1630ceea73d27597364c9af683) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/buildx.yml | 6 +++--- .github/workflows/check_paths.yml | 2 +- .../elixir_dep_verification_and_static_analysis.yml | 2 +- .github/workflows/elixir_test.yml | 2 +- .github/workflows/ensure_linting.yml | 2 +- .github/workflows/ghcr_build.yml | 10 +++++----- .github/workflows/spell_check.yml | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) 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..54175b0536 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 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..5fcec593b7 100644 --- a/.github/workflows/ensure_linting.yml +++ b/.github/workflows/ensure_linting.yml @@ -10,7 +10,7 @@ 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 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 From 861af999e30e6d4822b08a661ea053969df9dc0e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 2 Nov 2024 10:05:11 +0100 Subject: [PATCH 02/31] build(deps): bump actions/cache from 4.0.2 to 4.1.2 (#4341) Bumps [actions/cache](https://github.com/actions/cache) from 4.0.2 to 4.1.2. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/0c45773b623bea8c8e75f6c82b208c3cf94ea4f9...6849a6489940f00c2f30c0fb92c6274307ccb58a) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../workflows/elixir_dep_verification_and_static_analysis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/elixir_dep_verification_and_static_analysis.yml b/.github/workflows/elixir_dep_verification_and_static_analysis.yml index 54175b0536..0cc1b936aa 100644 --- a/.github/workflows/elixir_dep_verification_and_static_analysis.yml +++ b/.github/workflows/elixir_dep_verification_and_static_analysis.yml @@ -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: | From c07236512c3de915655f2ce8915ba805147250ea Mon Sep 17 00:00:00 2001 From: Jakob Lichterfeld Date: Sat, 2 Nov 2024 10:05:52 +0100 Subject: [PATCH 03/31] docs: update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9082cf996c..123f649dfa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ #### 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) #### Dashboards From 418bfbd536864c2a754ea92dd3feec6f60cfdd0c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 2 Nov 2024 10:06:18 +0100 Subject: [PATCH 04/31] build(deps): bump cachix/install-nix-action from 27 to 30 (#4342) Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 27 to 30. - [Release notes](https://github.com/cachix/install-nix-action/releases) - [Commits](https://github.com/cachix/install-nix-action/compare/ba0dd844c9180cbf77aa72a116d6fbc515d0e87b...08dcb3a5e62fa31e2da3d490afc4176ef55ecd72) --- updated-dependencies: - dependency-name: cachix/install-nix-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ensure_linting.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ensure_linting.yml b/.github/workflows/ensure_linting.yml index 5fcec593b7..813c459003 100644 --- a/.github/workflows/ensure_linting.yml +++ b/.github/workflows/ensure_linting.yml @@ -13,7 +13,7 @@ jobs: - 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 }} From adc9bf80e58a78f911b7fc47b61906ffaa503290 Mon Sep 17 00:00:00 2001 From: Jakob Lichterfeld Date: Sat, 2 Nov 2024 10:17:09 +0100 Subject: [PATCH 05/31] docs: update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 123f649dfa..16c9da89cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - 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) #### Dashboards From a4152a23f102a01eacd969c5f5ece2f16ccd8ce9 Mon Sep 17 00:00:00 2001 From: JakobLichterfeld Date: Sat, 2 Nov 2024 10:28:30 +0100 Subject: [PATCH 06/31] docs: add contributing guidelines (#4345) * docs: add contributing guidelines * docs: update changelog --- CHANGELOG.md | 2 ++ CONTRIBUTING | 3 +++ 2 files changed, 5 insertions(+) create mode 100644 CONTRIBUTING diff --git a/CHANGELOG.md b/CHANGELOG.md index 16c9da89cf..bf72cb4c94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ #### Documentation +docs: add contributing guidelines link for GitHub (#4345 - @JakobLichterfeld) + ## [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/) From ccabf27afc2ef729f9bd2ead1039d43ed0197f31 Mon Sep 17 00:00:00 2001 From: Matthias Wirtz Date: Fri, 1 Nov 2024 09:46:04 +0100 Subject: [PATCH 07/31] editable -> allowUiUpdates - there is no editable config key, see docs --- CHANGELOG.md | 2 ++ grafana/dashboards.yml | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf72cb4c94..5f915f0016 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ #### 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) + #### Translations #### Documentation 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 From f44eeee9377ee6b5fd8c5a930d35f482ea1a20bc Mon Sep 17 00:00:00 2001 From: Matthias Wirtz Date: Fri, 1 Nov 2024 09:51:25 +0100 Subject: [PATCH 08/31] improve performance in drive stats after #4284 --- CHANGELOG.md | 2 ++ grafana/dashboards/drive-stats.json | 16 +++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f915f0016..05bbbef128 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ #### 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) +- fix: ensure max speed panels are converted according to length unit setting in drive stats dashboard +- perf: speed up queries used to calculate max speed in drive stats dashboard #### Translations diff --git a/grafana/dashboards/drive-stats.json b/grafana/dashboards/drive-stats.json index 6f439001a6..5f61a1bb07 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", @@ -807,7 +813,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": [ [ @@ -948,7 +954,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": [ [ @@ -1090,7 +1096,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 +1239,7 @@ "xTickLabelRotation": 0, "xTickLabelSpacing": 0 }, - "pluginVersion": "10.4.0", + "pluginVersion": "11.0.1", "targets": [ { "datasource": { @@ -1245,7 +1251,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": [ [ From 1f734f7b19aee180384662a203ec0ccb5b9d4353 Mon Sep 17 00:00:00 2001 From: Matthias Wirtz Date: Fri, 1 Nov 2024 12:10:57 +0100 Subject: [PATCH 09/31] Welcome Dashboard --- CHANGELOG.md | 1 + grafana/Dockerfile | 1 + grafana/dashboards/internal/home.json | 119 ++++++++++++++++++++++++++ 3 files changed, 121 insertions(+) create mode 100644 grafana/dashboards/internal/home.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 05bbbef128..06fb4bba66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ - 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) - fix: ensure max speed panels are converted according to length unit setting in drive stats dashboard - perf: speed up queries used to calculate max speed in drive stats dashboard +- feat: add a welcome dashboard #### Translations diff --git a/grafana/Dockerfile b/grafana/Dockerfile index a4d0a79542..a2ff92729a 100644 --- a/grafana/Dockerfile +++ b/grafana/Dockerfile @@ -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/internal/home.json b/grafana/dashboards/internal/home.json new file mode 100644 index 0000000000..fe0c46f25c --- /dev/null +++ b/grafana/dashboards/internal/home.json @@ -0,0 +1,119 @@ +{ + "__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": "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": 7, + "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": 17, + "x": 7, + "y": 0 + }, + "id": 1, + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "
", + "mode": "html" + }, + "pluginVersion": "11.2.3", + "type": "text" + } + ], + "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 From 10217dabbe128843e7dddf22f3e6d5f2e02cc0e5 Mon Sep 17 00:00:00 2001 From: Matthias Wirtz Date: Fri, 1 Nov 2024 12:22:11 +0100 Subject: [PATCH 10/31] Grafana 11.2.3 --- CHANGELOG.md | 2 + grafana/Dockerfile | 2 +- grafana/dashboards/battery-health.json | 114 ++++++--- grafana/dashboards/charge-level.json | 12 +- grafana/dashboards/charges.json | 25 +- grafana/dashboards/charging-stats.json | 141 ++++++++---- grafana/dashboards/drive-stats.json | 32 +-- grafana/dashboards/drives.json | 36 +-- grafana/dashboards/efficiency.json | 26 ++- .../dashboards/internal/charge-details.json | 102 +++++++-- .../dashboards/internal/drive-details.json | 90 ++++++-- grafana/dashboards/locations.json | 117 +++++----- grafana/dashboards/mileage.json | 5 +- grafana/dashboards/overview.json | 33 ++- grafana/dashboards/projected-range.json | 8 +- grafana/dashboards/reports/dutch-tax.json | 8 +- grafana/dashboards/states.json | 52 +++-- grafana/dashboards/statistics.json | 31 ++- grafana/dashboards/timeline.json | 6 +- grafana/dashboards/trip.json | 216 +++++++++++------- grafana/dashboards/updates.json | 30 +-- grafana/dashboards/vampire-drain.json | 7 +- grafana/dashboards/visited.json | 58 ++++- website/docs/installation/debian.md | 2 +- 24 files changed, 749 insertions(+), 406 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 06fb4bba66..bec0cb8651 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ ### Improvements and bug fixes +- feat: use Grafana 11.2.3 + #### 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) diff --git a/grafana/Dockerfile b/grafana/Dockerfile index a2ff92729a..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 \ diff --git a/grafana/dashboards/battery-health.json b/grafana/dashboards/battery-health.json index 25af196210..f2a84d7225 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": "", @@ -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..2cf04c2ce3 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": "", @@ -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..2968d294b1 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}" } ] }, @@ -1169,7 +1173,7 @@ "showHeader": true, "sortBy": [] }, - "pluginVersion": "11.0.6+security-01", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1257,7 +1261,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": { @@ -1346,7 +1350,7 @@ }, "showHeader": true }, - "pluginVersion": "11.0.6+security-01", + "pluginVersion": "11.2.3", "targets": [ { "alias": "", @@ -1634,7 +1638,6 @@ "from": "now-3M", "to": "now" }, - "timeRangeUpdatedDuringEditOrView": false, "timepicker": { "refresh_intervals": [ "5s", @@ -1663,6 +1666,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..8a93ea9fb0 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", @@ -167,7 +167,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -256,7 +256,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -346,7 +346,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -436,7 +436,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -520,7 +520,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -624,7 +624,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -700,7 +700,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -794,7 +794,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "11.1.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -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": "", @@ -1877,8 +1931,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] } @@ -1958,7 +2011,6 @@ "showHeader": true, "sortBy": [] }, - "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -2069,8 +2121,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -2100,8 +2151,7 @@ "mode": "absolute", "steps": [ { - "color": "red", - "value": null + "color": "red" }, { "color": "#EAB839", @@ -2171,7 +2221,6 @@ "showHeader": true, "sortBy": [] }, - "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -2226,8 +2275,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -2290,7 +2338,6 @@ }, "showHeader": true }, - "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -2345,8 +2392,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -2413,7 +2459,6 @@ }, "showHeader": true }, - "pluginVersion": "11.1.0", "targets": [ { "datasource": { @@ -2562,6 +2607,6 @@ "timezone": "", "title": "Charging Stats", "uid": "-pkIkhmRz", - "version": 11, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/drive-stats.json b/grafana/dashboards/drive-stats.json index 5f61a1bb07..91043aaf08 100644 --- a/grafana/dashboards/drive-stats.json +++ b/grafana/dashboards/drive-stats.json @@ -17,7 +17,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "11.0.1" + "version": "11.2.3" }, { "type": "datasource", @@ -124,7 +124,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -256,7 +256,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -363,7 +363,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -503,7 +503,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -636,7 +636,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -702,7 +702,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -790,6 +790,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "last" @@ -801,7 +802,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -931,6 +932,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "last" @@ -942,7 +944,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1073,6 +1075,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "last" @@ -1084,7 +1087,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1239,7 +1242,6 @@ "xTickLabelRotation": 0, "xTickLabelSpacing": 0 }, - "pluginVersion": "11.0.1", "targets": [ { "datasource": { @@ -1384,7 +1386,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1517,7 +1519,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1620,7 +1622,7 @@ "sizing": "auto", "valueMode": "color" }, - "pluginVersion": "11.0.1", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1869,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..2c8c09cf24 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": "", @@ -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": "", @@ -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..e50b333272 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,7 +170,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -272,6 +273,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -283,7 +285,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -386,6 +388,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -397,7 +400,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -443,6 +446,7 @@ "fieldConfig": { "defaults": { "custom": { + "align": "auto", "cellOptions": { "type": "auto" }, @@ -701,7 +705,7 @@ } ] }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -804,6 +808,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -815,7 +820,7 @@ "textMode": "value", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -861,6 +866,7 @@ "fieldConfig": { "defaults": { "custom": { + "align": "auto", "cellOptions": { "type": "auto" }, @@ -932,7 +938,7 @@ }, "showHeader": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -978,6 +984,7 @@ "fieldConfig": { "defaults": { "custom": { + "align": "auto", "cellOptions": { "type": "auto" }, @@ -1049,7 +1056,7 @@ }, "showHeader": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -1257,7 +1264,6 @@ "from": "now-6h", "to": "now" }, - "timeRangeUpdatedDuringEditOrView": false, "timepicker": { "hidden": true, "refresh_intervals": [ @@ -1287,6 +1293,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..e926b27001 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" }, @@ -1775,6 +1786,21 @@ "value": 1 } ] + }, + { + "matcher": { + "id": "byName", + "options": "avg Power [kW]" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "blue", + "mode": "fixed" + } + } + ] } ] }, @@ -1792,27 +1818,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": { + "matcher": { + "id": "byName", + "options": "avg SOC [%]" + } }, - "x": "avg SOC [%]", - "y": "avg Power [kW]" + "y": { + "matcher": { + "id": "byName", + "options": "avg Power [kW]" + } + } } ], - "seriesMapping": "manual", "tooltip": { "mode": "single", "sort": "none" } }, - "pluginVersion": "7.5.11", + "pluginVersion": "11.2.3", "targets": [ { "alias": "", @@ -1909,8 +1963,8 @@ { "current": { "selected": false, - "text": "NULL", - "value": "NULL" + "text": "330", + "value": "330" }, "hide": 2, "label": "", @@ -1922,7 +1976,7 @@ "value": "NULL" } ], - "query": "NULL", + "query": "330", "skipUrlSync": false, "type": "textbox" }, @@ -2072,6 +2126,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..a2e5e4d948 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" }, @@ -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/locations.json b/grafana/dashboards/locations.json index b1050da443..45d102174c 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", @@ -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..034691b731 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": "", @@ -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..2c4a6929a2 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": { @@ -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..f405faa3cc 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": "", @@ -867,7 +866,6 @@ "from": "now-6M", "to": "now" }, - "timeRangeUpdatedDuringEditOrView": false, "timepicker": { "refresh_intervals": [ "5s", diff --git a/grafana/dashboards/reports/dutch-tax.json b/grafana/dashboards/reports/dutch-tax.json index 3ca8cd55e0..513fa227bb 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": "", @@ -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..5f042ca4c1 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", @@ -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..9412fb850c 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,10 +546,14 @@ } ] }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "repeatDirection": "h", "targets": [ { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "TeslaMate" + }, "format": "table", "group": [], "metricColumn": "none", @@ -575,13 +579,13 @@ "params": [], "type": "macro" } - ], + ] + }, + { "datasource": { "type": "grafana-postgresql-datasource", "uid": "TeslaMate" - } - }, - { + }, "format": "table", "group": [], "metricColumn": "none", @@ -605,13 +609,13 @@ "params": [], "type": "macro" } - ], + ] + }, + { "datasource": { "type": "grafana-postgresql-datasource", "uid": "TeslaMate" - } - }, - { + }, "format": "table", "group": [], "hide": false, @@ -636,11 +640,7 @@ "params": [], "type": "macro" } - ], - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - } + ] } ], "title": "per ${period}", @@ -994,7 +994,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..ff667c91f1 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": { @@ -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..56918326ee 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", @@ -84,10 +84,10 @@ { "icon": "doc", "tags": [], - "targetBlank": true, + "targetBlank": false, "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": "", @@ -1847,7 +1896,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -1878,7 +1928,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}" } ] }, @@ -2163,7 +2213,8 @@ "mode": "absolute", "steps": [ { - "color": "#96D98D" + "color": "#96D98D", + "value": null }, { "color": "#56A64B", @@ -2272,7 +2323,9 @@ }, "id": 36, "options": { + "cellHeight": "sm", "footer": { + "countRows": false, "fields": "", "reducer": [ "sum" @@ -2287,7 +2340,7 @@ } ] }, - "pluginVersion": "8.5.4", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -2342,9 +2395,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 +2410,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -2375,7 +2433,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -2475,7 +2534,6 @@ "sort": "none" } }, - "pluginVersion": "8.5.4", "targets": [ { "datasource": { @@ -2524,9 +2582,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 +2597,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 5, @@ -2556,7 +2619,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -2635,7 +2699,6 @@ "sort": "none" } }, - "pluginVersion": "8.5.4", "targets": [ { "datasource": { @@ -2844,10 +2907,9 @@ ] }, "time": { - "from": "now/d", + "from": "now-24h", "to": "now" }, - "timeRangeUpdatedDuringEditOrView": false, "timepicker": { "refresh_intervals": [ "5s", @@ -2876,6 +2938,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..db827ee3b0 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": { @@ -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..4d227ecd61 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": "", @@ -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..28c15fb79e 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", @@ -144,6 +144,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 +245,7 @@ "zoom": 15 } }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -271,6 +314,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -282,7 +326,7 @@ "textMode": "value_and_name", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -417,6 +461,7 @@ "graphMode": "none", "justifyMode": "center", "orientation": "vertical", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -428,7 +473,7 @@ "textMode": "value_and_name", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -593,6 +638,7 @@ "graphMode": "none", "justifyMode": "auto", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" @@ -604,7 +650,7 @@ "textMode": "value_and_name", "wideLayout": true }, - "pluginVersion": "11.0.0", + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -766,6 +812,6 @@ "timezone": "", "title": "Visited", "uid": "RG_DxSmgk", - "version": 5, + "version": 1, "weekStart": "" } \ No newline at end of file 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 From e32aa3b28bced86a5825760492ddceb50e4c118d Mon Sep 17 00:00:00 2001 From: Matthias Wirtz Date: Fri, 1 Nov 2024 13:42:21 +0100 Subject: [PATCH 11/31] Simplify SQL when using DATE_TRUNC --- grafana/dashboards/statistics.json | 60 ++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 3 deletions(-) diff --git a/grafana/dashboards/statistics.json b/grafana/dashboards/statistics.json index 9412fb850c..dc21b6f198 100644 --- a/grafana/dashboards/statistics.json +++ b/grafana/dashboards/statistics.json @@ -554,11 +554,12 @@ "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": [ [ @@ -570,6 +571,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "drives", "timeColumn": "start_date", "timeColumnType": "timestamp", @@ -586,11 +604,12 @@ "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": [ [ @@ -602,6 +621,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "timeColumn": "time", "where": [ { @@ -616,12 +652,13 @@ "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": [ [ @@ -633,6 +670,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "timeColumn": "time", "where": [ { From 1ee2312bd270bf55f66cc80b369dad5c11549363 Mon Sep 17 00:00:00 2001 From: Matthias Wirtz Date: Fri, 1 Nov 2024 13:55:30 +0100 Subject: [PATCH 12/31] use convert_km over case when ... --- grafana/dashboards/drives.json | 2 +- grafana/dashboards/efficiency.json | 122 +++++++++++++++++++++++++++-- grafana/dashboards/trip.json | 20 ++++- 3 files changed, 135 insertions(+), 9 deletions(-) diff --git a/grafana/dashboards/drives.json b/grafana/dashboards/drives.json index 2c8c09cf24..7d4a8c26e7 100644 --- a/grafana/dashboards/drives.json +++ b/grafana/dashboards/drives.json @@ -1425,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": [ [ diff --git a/grafana/dashboards/efficiency.json b/grafana/dashboards/efficiency.json index e50b333272..9b293a3961 100644 --- a/grafana/dashboards/efficiency.json +++ b/grafana/dashboards/efficiency.json @@ -177,11 +177,12 @@ "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": [ [ @@ -193,6 +194,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "addresses", "timeColumn": "inserted_at", "timeColumnType": "timestamp", @@ -292,11 +310,12 @@ "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": [ [ @@ -308,6 +327,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "addresses", "timeColumn": "inserted_at", "timeColumnType": "timestamp", @@ -712,11 +748,12 @@ "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": [ [ @@ -728,6 +765,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "addresses", "timeColumn": "inserted_at", "timeColumnType": "timestamp", @@ -827,11 +881,12 @@ "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": [ [ @@ -843,6 +898,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "charges", "timeColumn": "date", "timeColumnType": "timestamp", @@ -945,11 +1017,12 @@ "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": [ [ @@ -961,6 +1034,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "charges", "timeColumn": "date", "timeColumnType": "timestamp", @@ -1063,11 +1153,12 @@ "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": [ [ @@ -1079,6 +1170,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "charges", "timeColumn": "date", "timeColumnType": "timestamp", @@ -1293,6 +1401,6 @@ "timezone": "", "title": "Efficiency", "uid": "fu4SiQgWz", - "version": 1, + "version": 2, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/trip.json b/grafana/dashboards/trip.json index 56918326ee..f9c3e1c75d 100644 --- a/grafana/dashboards/trip.json +++ b/grafana/dashboards/trip.json @@ -1843,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": [ [ @@ -1859,6 +1860,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "timeColumn": "time", "where": [ { From 3b4731591a4b63b7a5c9c13298b2928b118b59e6 Mon Sep 17 00:00:00 2001 From: Matthias Wirtz Date: Fri, 1 Nov 2024 13:58:08 +0100 Subject: [PATCH 13/31] ensure timestamptz when using date_trunc for consistency --- grafana/dashboards/updates.json | 2 +- grafana/dashboards/visited.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/grafana/dashboards/updates.json b/grafana/dashboards/updates.json index db827ee3b0..68ad623e8b 100644 --- a/grafana/dashboards/updates.json +++ b/grafana/dashboards/updates.json @@ -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": [ [ diff --git a/grafana/dashboards/visited.json b/grafana/dashboards/visited.json index 28c15fb79e..a6a14cfd2e 100644 --- a/grafana/dashboards/visited.json +++ b/grafana/dashboards/visited.json @@ -256,7 +256,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": [ From ca9bb1a99d429b69bdf0076b46b739cf2dc1f965 Mon Sep 17 00:00:00 2001 From: Matthias Wirtz Date: Fri, 1 Nov 2024 14:06:09 +0100 Subject: [PATCH 14/31] use Open Street Map consistently --- grafana/dashboards/visited.json | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/grafana/dashboards/visited.json b/grafana/dashboards/visited.json index a6a14cfd2e..9dbad9d4c8 100644 --- a/grafana/dashboards/visited.json +++ b/grafana/dashboards/visited.json @@ -129,11 +129,9 @@ "maxDataPoints": 10000000, "options": { "basemap": { - "config": { - "server": "streets" - }, + "config": {}, "name": "Layer 0", - "type": "esri-xyz" + "type": "osm-standard" }, "controls": { "mouseWheelZoom": true, From 2e81a4e32c45edf49bf0f4a18c744dd104f2932a Mon Sep 17 00:00:00 2001 From: Matthias Wirtz Date: Fri, 1 Nov 2024 17:45:57 +0100 Subject: [PATCH 15/31] add GitHub Tags to Welcome Page (to see latest release) --- grafana/dashboards/internal/home.json | 245 ++++++++++++++------------ 1 file changed, 135 insertions(+), 110 deletions(-) diff --git a/grafana/dashboards/internal/home.json b/grafana/dashboards/internal/home.json index fe0c46f25c..f4fc189bbd 100644 --- a/grafana/dashboards/internal/home.json +++ b/grafana/dashboards/internal/home.json @@ -1,119 +1,144 @@ { - "__elements": {}, - "__requires": [ + "__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": [ { - "type": "panel", - "id": "dashlist", - "name": "Dashboard list", - "version": "" + "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" }, - { - "type": "grafana", - "id": "grafana", - "name": "Grafana", - "version": "11.2.3" + "gridPos": { + "h": 20, + "w": 6, + "x": 0, + "y": 0 }, - { - "type": "datasource", - "id": "grafana-postgresql-datasource", - "name": "PostgreSQL", - "version": "1.0.0" + "id": 2, + "options": { + "folderUID": "Nr4ofiDZk", + "includeVars": false, + "keepTime": false, + "maxItems": 100, + "query": "", + "showFolderNames": false, + "showHeadings": false, + "showRecentlyViewed": false, + "showSearch": true, + "showStarred": false, + "tags": [] }, - { - "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" - } - ] + "pluginVersion": "11.2.3", + "type": "dashlist" }, - "editable": true, - "fiscalYearStartMonth": 0, - "graphTooltip": 0, - "id": null, - "links": [], - "panels": [ - { - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - }, - "gridPos": { - "h": 20, - "w": 7, - "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" }, - { - "datasource": { - "type": "grafana-postgresql-datasource", - "uid": "TeslaMate" - }, - "gridPos": { - "h": 20, - "w": 17, - "x": 7, - "y": 0 - }, - "id": 1, - "options": { - "code": { - "language": "plaintext", - "showLineNumbers": false, - "showMiniMap": false - }, - "content": "
", - "mode": "html" + "gridPos": { + "h": 20, + "w": 16, + "x": 6, + "y": 0 + }, + "id": 1, + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false }, - "pluginVersion": "11.2.3", - "type": "text" - } - ], - "schemaVersion": 39, - "tags": [], - "templating": { - "list": [] - }, - "time": { - "from": "now-6h", - "to": "now" + "content": "
", + "mode": "html" + }, + "pluginVersion": "11.2.3", + "type": "text" }, - "timepicker": {}, - "timezone": "browser", - "title": "Home", - "uid": "be2m9kga7b8qoc", - "version": 1, - "weekStart": "" - } \ No newline at end of file + { + "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 From 68b5e356a629329203a36776c450c030f3919aa0 Mon Sep 17 00:00:00 2001 From: Matthias Wirtz Date: Sat, 2 Nov 2024 10:54:20 +0100 Subject: [PATCH 16/31] update nix module with recent changes in grafana docker image --- nix/module.nix | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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 From 2edbb9bd26f2d4e61b4e2f233ce9629b0e2ea456 Mon Sep 17 00:00:00 2001 From: Matthias Wirtz Date: Sat, 2 Nov 2024 22:39:29 +0100 Subject: [PATCH 17/31] fix efficiency calculation --- grafana/dashboards/efficiency.json | 6 +++--- grafana/dashboards/projected-range.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/grafana/dashboards/efficiency.json b/grafana/dashboards/efficiency.json index 9b293a3961..6e1d516cb0 100644 --- a/grafana/dashboards/efficiency.json +++ b/grafana/dashboards/efficiency.json @@ -1022,7 +1022,7 @@ "group": [], "metricColumn": "none", "rawQuery": true, - "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", + "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": [ [ @@ -1158,7 +1158,7 @@ "group": [], "metricColumn": "none", "rawQuery": true, - "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", + "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": [ [ @@ -1401,6 +1401,6 @@ "timezone": "", "title": "Efficiency", "uid": "fu4SiQgWz", - "version": 2, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/projected-range.json b/grafana/dashboards/projected-range.json index f405faa3cc..e68bb4d872 100644 --- a/grafana/dashboards/projected-range.json +++ b/grafana/dashboards/projected-range.json @@ -894,6 +894,6 @@ "timezone": "", "title": "Projected Range", "uid": "riqUfXgRz", - "version": 2, + "version": 1, "weekStart": "" } \ No newline at end of file From 08873c7a9e84ff2f8c399d5c1ec0ce989a9dfcdf Mon Sep 17 00:00:00 2001 From: Matthias Wirtz Date: Sun, 3 Nov 2024 09:32:05 +0100 Subject: [PATCH 18/31] layout fixes --- grafana/dashboards/charges.json | 2 +- grafana/dashboards/charging-stats.json | 78 ++++++++++++++++---------- grafana/dashboards/trip.json | 16 ++---- 3 files changed, 56 insertions(+), 40 deletions(-) diff --git a/grafana/dashboards/charges.json b/grafana/dashboards/charges.json index 2968d294b1..37c755a52c 100644 --- a/grafana/dashboards/charges.json +++ b/grafana/dashboards/charges.json @@ -724,7 +724,7 @@ }, { "id": "custom.minWidth", - "value": 60 + "value": 70 } ] }, diff --git a/grafana/dashboards/charging-stats.json b/grafana/dashboards/charging-stats.json index 8a93ea9fb0..1c00d12a66 100644 --- a/grafana/dashboards/charging-stats.json +++ b/grafana/dashboards/charging-stats.json @@ -139,7 +139,7 @@ }, "gridPos": { "h": 3, - "w": 5, + "w": 3, "x": 0, "y": 1 }, @@ -228,8 +228,8 @@ }, "gridPos": { "h": 3, - "w": 5, - "x": 5, + "w": 3, + "x": 3, "y": 1 }, "id": 10, @@ -319,7 +319,7 @@ "gridPos": { "h": 3, "w": 3, - "x": 10, + "x": 6, "y": 1 }, "id": 14, @@ -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, @@ -498,8 +498,8 @@ }, "gridPos": { "h": 3, - "w": 2, - "x": 16, + "w": 3, + "x": 12, "y": 1 }, "id": 26, @@ -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, @@ -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, @@ -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, @@ -837,7 +837,7 @@ ] } ], - "title": "AC Avg Cost per kWh", + "title": "Ø Cost per kWh AC", "type": "stat" }, { @@ -1924,14 +1924,16 @@ "cellOptions": { "type": "auto" }, - "inspect": false + "inspect": false, + "minWidth": 50 }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null } ] } @@ -1945,7 +1947,7 @@ "properties": [ { "id": "custom.width", - "value": 70 + "value": 50 }, { "id": "displayName", @@ -1977,7 +1979,8 @@ "id": "custom.cellOptions", "value": { "mode": "gradient", - "type": "gauge" + "type": "gauge", + "valueDisplayMode": "text" } }, { @@ -1986,6 +1989,10 @@ { "id": "min", "value": 0 + }, + { + "id": "custom.align", + "value": "left" } ] } @@ -2011,6 +2018,7 @@ "showHeader": true, "sortBy": [] }, + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -2114,14 +2122,16 @@ "cellOptions": { "type": "auto" }, - "inspect": false + "inspect": false, + "minWidth": 50 }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -2151,7 +2161,8 @@ "mode": "absolute", "steps": [ { - "color": "red" + "color": "red", + "value": null }, { "color": "#EAB839", @@ -2172,7 +2183,7 @@ }, { "id": "custom.width", - "value": 70 + "value": 50 } ] }, @@ -2196,6 +2207,10 @@ { "id": "min", "value": 0 + }, + { + "id": "custom.align", + "value": "left" } ] } @@ -2221,6 +2236,7 @@ "showHeader": true, "sortBy": [] }, + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -2275,7 +2291,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -2338,6 +2355,7 @@ }, "showHeader": true }, + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -2392,7 +2410,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -2459,6 +2478,7 @@ }, "showHeader": true }, + "pluginVersion": "11.2.3", "targets": [ { "datasource": { @@ -2607,6 +2627,6 @@ "timezone": "", "title": "Charging Stats", "uid": "-pkIkhmRz", - "version": 1, + "version": 2, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/trip.json b/grafana/dashboards/trip.json index f9c3e1c75d..79f409454c 100644 --- a/grafana/dashboards/trip.json +++ b/grafana/dashboards/trip.json @@ -84,7 +84,7 @@ { "icon": "doc", "tags": [], - "targetBlank": false, + "targetBlank": true, "title": "Select last three drives", "type": "link", "url": "/d/FkUpJpQZk/trip?from=$from" @@ -1914,8 +1914,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -2231,8 +2230,7 @@ "mode": "absolute", "steps": [ { - "color": "#96D98D", - "value": null + "color": "#96D98D" }, { "color": "#56A64B", @@ -2451,8 +2449,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -2637,8 +2634,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -2925,7 +2921,7 @@ ] }, "time": { - "from": "now-24h", + "from": "2024-11-02T13:34:36.487Z", "to": "now" }, "timepicker": { From c15a33081e2c8ad1a29341985b92498b8872c3ab Mon Sep 17 00:00:00 2001 From: Jakob Lichterfeld Date: Tue, 5 Nov 2024 16:18:21 +0100 Subject: [PATCH 19/31] docs: update changelog --- CHANGELOG.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bec0cb8651..5b8a4dd350 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ ### Improvements and bug fixes -- feat: use Grafana 11.2.3 +- feat: use Grafana 11.2.3 (#4338 - @swiffer) #### Build, CI, internal @@ -17,10 +17,10 @@ #### 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) -- fix: ensure max speed panels are converted according to length unit setting in drive stats dashboard -- perf: speed up queries used to calculate max speed in drive stats dashboard -- feat: add a welcome dashboard +- 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) #### Translations From d64f799c5fd9a872fb660e6cce082a4391afe8f2 Mon Sep 17 00:00:00 2001 From: Matthias Wirtz Date: Tue, 5 Nov 2024 17:08:17 +0100 Subject: [PATCH 20/31] =?UTF-8?q?fix:=20Charges=20Dashboard=20->=20Range?= =?UTF-8?q?=20added=20renamed=20to=20=C3=98=20Charge=20rate=20(#4349)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * rename column Range added to Charge Rate * Column refinement, Range gained added, Driven (km) removed --- grafana/dashboards/charges.json | 101 +++++++++++++++++++++----------- 1 file changed, 68 insertions(+), 33 deletions(-) diff --git a/grafana/dashboards/charges.json b/grafana/dashboards/charges.json index 37c755a52c..658668fd92 100644 --- a/grafana/dashboards/charges.json +++ b/grafana/dashboards/charges.json @@ -781,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", @@ -798,7 +818,11 @@ }, { "id": "custom.minWidth", - "value": 95 + "value": 120 + }, + { + "id": "unit", + "value": "lengthmi" } ] }, @@ -810,7 +834,7 @@ "properties": [ { "id": "displayName", - "value": "Power avg" + "value": "Ø Power" }, { "id": "unit", @@ -860,7 +884,7 @@ "properties": [ { "id": "displayName", - "value": "Range added" + "value": "Ø Charge rate" }, { "id": "unit", @@ -926,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", @@ -954,7 +958,7 @@ "properties": [ { "id": "displayName", - "value": "Range added" + "value": "Ø Charge rate" }, { "id": "unit", @@ -1137,13 +1141,45 @@ }, { "matcher": { - "id": "byRegexp", - "options": "/odometer_.*/" + "id": "byName", + "options": "odometer_km" }, "properties": [ + { + "id": "unit", + "value": "km" + }, { "id": "displayName", - "value": "Odometer ($length_unit)" + "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" + }, + { + "id": "custom.width", + "value": 95 }, { "id": "decimals", @@ -1185,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": [ [ @@ -1322,8 +1358,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] } From 6d851f6d666f3354d8c1e31001cca1a549901344 Mon Sep 17 00:00:00 2001 From: Jakob Lichterfeld Date: Tue, 5 Nov 2024 17:08:52 +0100 Subject: [PATCH 21/31] docs: update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b8a4dd350..7416840518 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ - 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) #### Translations From e0e8bae7415b83830b704b16b88144baa4b53964 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Nov 2024 18:43:32 +0100 Subject: [PATCH 22/31] build(deps): bump tesla from 1.12.1 to 1.13.0 (#4335) Bumps [tesla](https://github.com/elixir-tesla/tesla) from 1.12.1 to 1.13.0. - [Release notes](https://github.com/elixir-tesla/tesla/releases) - [Commits](https://github.com/elixir-tesla/tesla/compare/v1.12.1...v1.13.0) --- updated-dependencies: - dependency-name: tesla dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- mix.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mix.lock b/mix.lock index a449acbd8d..2b370dd2d5 100644 --- a/mix.lock +++ b/mix.lock @@ -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"}, From f439c38c548aaf975e1d4dbb3e9db97d07e77cc2 Mon Sep 17 00:00:00 2001 From: Jakob Lichterfeld Date: Tue, 5 Nov 2024 18:43:54 +0100 Subject: [PATCH 23/31] docs: update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7416840518..4e20618702 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ - 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) #### Dashboards From 36d724c05a38e758a0d627ebb3b218e7247633bc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Nov 2024 18:44:33 +0100 Subject: [PATCH 24/31] build(deps): bump floki from 0.36.2 to 0.36.3 (#4336) Bumps [floki](https://github.com/philss/floki) from 0.36.2 to 0.36.3. - [Release notes](https://github.com/philss/floki/releases) - [Changelog](https://github.com/philss/floki/blob/main/CHANGELOG.md) - [Commits](https://github.com/philss/floki/compare/v0.36.2...v0.36.3) --- updated-dependencies: - dependency-name: floki dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- mix.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mix.lock b/mix.lock index 2b370dd2d5..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"}, From ceafc240e05e904c375c9becb4f75a797fa00977 Mon Sep 17 00:00:00 2001 From: Jakob Lichterfeld Date: Tue, 5 Nov 2024 18:45:20 +0100 Subject: [PATCH 25/31] docs: update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e20618702..bfa1303f7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ - 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) #### Dashboards From 31c082a69bc847e927fc90cb6c0aa6046904ed72 Mon Sep 17 00:00:00 2001 From: JakobLichterfeld Date: Wed, 6 Nov 2024 15:50:05 +0100 Subject: [PATCH 26/31] docs: update Home Assistant integration documentation with configuration URL and model name hints (#4359) * feat: add CONTRIBUTING file to exclusion lists for treefmt * docs: update Home Assistant integration documentation with configuration URL and model name hints * docs: update changelog * docs: improve Home Assistant integration documentation with additional configuration details and clarifications * docs: update Home Assistant integration documentation with placeholders for car model and name * docs: move car ID configuration details to the Configuration section in Home Assistant integration documentation --- CHANGELOG.md | 2 ++ nix/flake-modules/formatter.nix | 1 + treefmt.toml | 1 + website/docs/integrations/home_assistant.md | 25 ++++++++++++--------- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bfa1303f7b..638b8ff16c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ - 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 @@ -30,6 +31,7 @@ #### 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) ## [1.31.1] - 2024-10-29 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/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/integrations/home_assistant.md b/website/docs/integrations/home_assistant.md index 4cbbb3edcf..c2a7d95949 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,7 +57,7 @@ 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: @@ -66,10 +70,10 @@ Don't forget to replace `` and `` with correct 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 @@ -1045,7 +1049,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 From 2a6ecb342690e82db69a8a1f99ac7e6b60466a58 Mon Sep 17 00:00:00 2001 From: Long Zheng Date: Thu, 7 Nov 2024 20:33:50 +1100 Subject: [PATCH 27/31] docs: Remove availability from Home Assistant MQTT sensors, as it can be misleading and prevent sensors from receiving updated values (#4362) --- website/docs/integrations/home_assistant.md | 53 --------------------- 1 file changed, 53 deletions(-) diff --git a/website/docs/integrations/home_assistant.md b/website/docs/integrations/home_assistant.md index c2a7d95949..73c6512c6a 100644 --- a/website/docs/integrations/home_assistant.md +++ b/website/docs/integrations/home_assistant.md @@ -64,10 +64,6 @@ Don't forget to replace ``, `` and ` # update this with your teslamate URL, e.g. https://teslamate.example.com/ @@ -81,7 +77,6 @@ Don't forget to replace ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ``, `` and ` Date: Thu, 7 Nov 2024 10:34:34 +0100 Subject: [PATCH 28/31] docs: update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 638b8ff16c..5c1417a153 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ 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 From 6f3be516eec89adf56aa33d6e8ac723cf518f37b Mon Sep 17 00:00:00 2001 From: Matthias Wirtz Date: Fri, 8 Nov 2024 10:51:50 +0100 Subject: [PATCH 29/31] fix: Axis Labels for XY Chart in Battery Health and reduces Query count in Visited (#4364) * fix charging_curve missing axis labels * Reduce Query Count on Visited Dashboard * show full VIN when no name is set --- grafana/dashboards/battery-health.json | 4 +- grafana/dashboards/charge-level.json | 4 +- grafana/dashboards/charges.json | 4 +- grafana/dashboards/charging-stats.json | 4 +- grafana/dashboards/drive-stats.json | 4 +- grafana/dashboards/drives.json | 4 +- grafana/dashboards/efficiency.json | 4 +- .../dashboards/internal/charge-details.json | 40 +++++---- .../dashboards/internal/drive-details.json | 4 +- grafana/dashboards/locations.json | 4 +- grafana/dashboards/mileage.json | 4 +- grafana/dashboards/overview.json | 4 +- grafana/dashboards/projected-range.json | 4 +- grafana/dashboards/reports/dutch-tax.json | 4 +- grafana/dashboards/states.json | 4 +- grafana/dashboards/statistics.json | 4 +- grafana/dashboards/timeline.json | 4 +- grafana/dashboards/trip.json | 4 +- grafana/dashboards/updates.json | 4 +- grafana/dashboards/vampire-drain.json | 4 +- grafana/dashboards/visited.json | 86 +------------------ 21 files changed, 67 insertions(+), 135 deletions(-) diff --git a/grafana/dashboards/battery-health.json b/grafana/dashboards/battery-health.json index f2a84d7225..cd29209a0c 100644 --- a/grafana/dashboards/battery-health.json +++ b/grafana/dashboards/battery-health.json @@ -1898,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, diff --git a/grafana/dashboards/charge-level.json b/grafana/dashboards/charge-level.json index 2cf04c2ce3..723664f58d 100644 --- a/grafana/dashboards/charge-level.json +++ b/grafana/dashboards/charge-level.json @@ -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, diff --git a/grafana/dashboards/charges.json b/grafana/dashboards/charges.json index 658668fd92..be2f4c83cc 100644 --- a/grafana/dashboards/charges.json +++ b/grafana/dashboards/charges.json @@ -1437,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, diff --git a/grafana/dashboards/charging-stats.json b/grafana/dashboards/charging-stats.json index 1c00d12a66..2e144f40ba 100644 --- a/grafana/dashboards/charging-stats.json +++ b/grafana/dashboards/charging-stats.json @@ -2530,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, diff --git a/grafana/dashboards/drive-stats.json b/grafana/dashboards/drive-stats.json index 91043aaf08..e0631a5f2d 100644 --- a/grafana/dashboards/drive-stats.json +++ b/grafana/dashboards/drive-stats.json @@ -1692,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, diff --git a/grafana/dashboards/drives.json b/grafana/dashboards/drives.json index 7d4a8c26e7..82a33af9d9 100644 --- a/grafana/dashboards/drives.json +++ b/grafana/dashboards/drives.json @@ -1641,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, diff --git a/grafana/dashboards/efficiency.json b/grafana/dashboards/efficiency.json index 6e1d516cb0..9143437293 100644 --- a/grafana/dashboards/efficiency.json +++ b/grafana/dashboards/efficiency.json @@ -1215,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, diff --git a/grafana/dashboards/internal/charge-details.json b/grafana/dashboards/internal/charge-details.json index e926b27001..b28a5ed0f9 100644 --- a/grafana/dashboards/internal/charge-details.json +++ b/grafana/dashboards/internal/charge-details.json @@ -1784,15 +1784,7 @@ { "id": "custom.lineWidth", "value": 1 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "avg Power [kW]" - }, - "properties": [ + }, { "id": "color", "value": { @@ -1850,13 +1842,13 @@ "x": { "matcher": { "id": "byName", - "options": "avg SOC [%]" + "options": "SOC [%]" } }, "y": { "matcher": { "id": "byName", - "options": "avg Power [kW]" + "options": "Power [kW]" } } } @@ -1880,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": [ [ @@ -1923,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": [ [ @@ -1940,6 +1933,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "positions", "timeColumn": "date", "timeColumnType": "timestamp", @@ -2009,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, diff --git a/grafana/dashboards/internal/drive-details.json b/grafana/dashboards/internal/drive-details.json index a2e5e4d948..abcca15d52 100644 --- a/grafana/dashboards/internal/drive-details.json +++ b/grafana/dashboards/internal/drive-details.json @@ -2697,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, diff --git a/grafana/dashboards/locations.json b/grafana/dashboards/locations.json index 45d102174c..9f6aaa5aec 100644 --- a/grafana/dashboards/locations.json +++ b/grafana/dashboards/locations.json @@ -1198,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, diff --git a/grafana/dashboards/mileage.json b/grafana/dashboards/mileage.json index 034691b731..b307fe37bc 100644 --- a/grafana/dashboards/mileage.json +++ b/grafana/dashboards/mileage.json @@ -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, diff --git a/grafana/dashboards/overview.json b/grafana/dashboards/overview.json index 2c4a6929a2..a56320899a 100644 --- a/grafana/dashboards/overview.json +++ b/grafana/dashboards/overview.json @@ -2079,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, diff --git a/grafana/dashboards/projected-range.json b/grafana/dashboards/projected-range.json index e68bb4d872..257ddb6945 100644 --- a/grafana/dashboards/projected-range.json +++ b/grafana/dashboards/projected-range.json @@ -703,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, diff --git a/grafana/dashboards/reports/dutch-tax.json b/grafana/dashboards/reports/dutch-tax.json index 513fa227bb..f3047e4191 100644 --- a/grafana/dashboards/reports/dutch-tax.json +++ b/grafana/dashboards/reports/dutch-tax.json @@ -397,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, diff --git a/grafana/dashboards/states.json b/grafana/dashboards/states.json index 5f042ca4c1..1a9ab6a520 100644 --- a/grafana/dashboards/states.json +++ b/grafana/dashboards/states.json @@ -521,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, diff --git a/grafana/dashboards/statistics.json b/grafana/dashboards/statistics.json index dc21b6f198..ac27563f8f 100644 --- a/grafana/dashboards/statistics.json +++ b/grafana/dashboards/statistics.json @@ -896,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, diff --git a/grafana/dashboards/timeline.json b/grafana/dashboards/timeline.json index ff667c91f1..218aa4088f 100644 --- a/grafana/dashboards/timeline.json +++ b/grafana/dashboards/timeline.json @@ -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, diff --git a/grafana/dashboards/trip.json b/grafana/dashboards/trip.json index 79f409454c..425f0814af 100644 --- a/grafana/dashboards/trip.json +++ b/grafana/dashboards/trip.json @@ -2764,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, diff --git a/grafana/dashboards/updates.json b/grafana/dashboards/updates.json index 68ad623e8b..e4997885b4 100644 --- a/grafana/dashboards/updates.json +++ b/grafana/dashboards/updates.json @@ -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, diff --git a/grafana/dashboards/vampire-drain.json b/grafana/dashboards/vampire-drain.json index 4d227ecd61..f8c94a4859 100644 --- a/grafana/dashboards/vampire-drain.json +++ b/grafana/dashboards/vampire-drain.json @@ -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, diff --git a/grafana/dashboards/visited.json b/grafana/dashboards/visited.json index 9dbad9d4c8..7eae4c0b21 100644 --- a/grafana/dashboards/visited.json +++ b/grafana/dashboards/visited.json @@ -483,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": [ { @@ -717,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, From f2aae62b60afe4e3a48f6a8d170f6b2756c6f258 Mon Sep 17 00:00:00 2001 From: Jakob Lichterfeld Date: Fri, 8 Nov 2024 10:52:34 +0100 Subject: [PATCH 30/31] docs: update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c1417a153..1e35132f70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ - 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 From 93cc34437c6466c993fde98bb271faaa9ed8a58d Mon Sep 17 00:00:00 2001 From: Brian May Date: Mon, 11 Nov 2024 08:34:18 +1100 Subject: [PATCH 31/31] fix(nix): bump hash for dependencies (#4371) --- nix/flake-modules/package.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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; };