From b6931398829e7b8c212b989264df928cfff20678 Mon Sep 17 00:00:00 2001 From: Brett-S-OWB Date: Wed, 12 Mar 2025 17:01:01 +0100 Subject: [PATCH 01/10] Add power meter (counter) name to history chart from hierarchy ID --- .../charts/historyChart/HistoryChart.vue | 13 +++++++++++-- .../source/src/stores/mqtt-store-model.ts | 11 +++++++++++ .../koala/source/src/stores/mqtt-store.ts | 19 +++++++++++++++++++ 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/packages/modules/web_themes/koala/source/src/components/charts/historyChart/HistoryChart.vue b/packages/modules/web_themes/koala/source/src/components/charts/historyChart/HistoryChart.vue index ad61324aab..e7fae84c02 100644 --- a/packages/modules/web_themes/koala/source/src/components/charts/historyChart/HistoryChart.vue +++ b/packages/modules/web_themes/koala/source/src/components/charts/historyChart/HistoryChart.vue @@ -53,6 +53,15 @@ const selectedData = computed(() => { const chargePointIds = computed(() => mqttStore.chargePointIds); const chargePointNames = computed(() => mqttStore.chargePointName); + +const meterName = computed(() => { + const gridId = mqttStore.getGridId; + if (gridId !== undefined) { + return mqttStore.getCounterName(gridId); + } + return 'Zähler'; +}); + const vehicles = computed(() => mqttStore.vehicleList()); const chartRange = computed( () => mqttStore.themeConfiguration?.history_chart_range || 3600, @@ -108,7 +117,7 @@ const lineChartData = computed(() => { labels: selectedData.value.map((item) => item.time), datasets: [ { - label: 'Grid Power', + label: meterName.value, unit: 'kW', borderColor: '#a33c42', backgroundColor: 'rgba(239,182,188, 0.2)', @@ -134,7 +143,7 @@ const lineChartData = computed(() => { yAxisID: 'y', }, { - label: 'PV Power', + label: 'PV ges.', unit: 'kW', borderColor: 'green', backgroundColor: 'rgba(144, 238, 144, 0.2)', diff --git a/packages/modules/web_themes/koala/source/src/stores/mqtt-store-model.ts b/packages/modules/web_themes/koala/source/src/stores/mqtt-store-model.ts index 7a3c63cad5..b92fc357d3 100644 --- a/packages/modules/web_themes/koala/source/src/stores/mqtt-store-model.ts +++ b/packages/modules/web_themes/koala/source/src/stores/mqtt-store-model.ts @@ -165,3 +165,14 @@ export interface BatteryConfiguration { id: number; configuration: object; } + +export interface CounterConfiguration { + name: string; + info: { + manufacturer: string; + model: string; + }; + type: string; + id: number; + configuration: object; +} diff --git a/packages/modules/web_themes/koala/source/src/stores/mqtt-store.ts b/packages/modules/web_themes/koala/source/src/stores/mqtt-store.ts index 8f8c4992f4..66e54313b0 100644 --- a/packages/modules/web_themes/koala/source/src/stores/mqtt-store.ts +++ b/packages/modules/web_themes/koala/source/src/stores/mqtt-store.ts @@ -19,6 +19,7 @@ import type { ChargePointConnectedVehicleSoc, GraphDataPoint, BatteryConfiguration, + CounterConfiguration, ThemeConfiguration, } from './mqtt-store-model'; @@ -2244,6 +2245,23 @@ export const useMqttStore = defineStore('mqtt', () => { return undefined; }); + /** + * Get the power meter(counter) name identified by the Grid ID + * @param counterId counter ID + * @returns string + */ + const getCounterName = computed(() => { + return (counterId: number): string => { + const configurations = getWildcardValues.value( + `openWB/system/device/+/component/${counterId}/config`, + ) as { [key: string]: CounterConfiguration }; + if (Object.keys(configurations).length === 0) { + return `Zähler ${counterId}`; + } + return Object.values(configurations)[0].name; + }; + }); + /** * Get grid power identified from root of component hierarchy * @param returnType type of return value, 'textValue', 'value', 'scaledValue', 'scaledUnit' or 'object' @@ -2455,6 +2473,7 @@ export const useMqttStore = defineStore('mqtt', () => { batteryMode, // Grid data getGridId, + getCounterName, getGridPower, // Home data getHomePower, From 949bfeac44ad4efd40be82f7719b2c8fb39177e6 Mon Sep 17 00:00:00 2001 From: Brett-S-OWB Date: Thu, 13 Mar 2025 12:38:19 +0100 Subject: [PATCH 02/10] Fix X-Axis time data display method in history chart --- .../charts/historyChart/HistoryChart.vue | 38 ++++++++++++++----- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/packages/modules/web_themes/koala/source/src/components/charts/historyChart/HistoryChart.vue b/packages/modules/web_themes/koala/source/src/components/charts/historyChart/HistoryChart.vue index e7fae84c02..85c289b95f 100644 --- a/packages/modules/web_themes/koala/source/src/components/charts/historyChart/HistoryChart.vue +++ b/packages/modules/web_themes/koala/source/src/components/charts/historyChart/HistoryChart.vue @@ -73,7 +73,10 @@ const chargePointDatasets = computed(() => unit: 'kW', borderColor: '#4766b5', backgroundColor: 'rgba(71, 102, 181, 0.2)', - data: selectedData.value.map((item) => item[`cp${cpId}-power`] as number), + data: selectedData.value.map((item) => ({ + x: item.timestamp * 1000, + y: item[`cp${cpId}-power`] as number, + })), borderWidth: 2, pointRadius: 0, pointHoverRadius: 4, @@ -97,9 +100,10 @@ const vehicleDatasets = computed(() => pointRadius: 0, pointHoverRadius: 4, pointHitRadius: 5, - data: selectedData.value.map( - (item) => item[socKey as keyof typeof item] as number, - ), + data: selectedData.value.map((item) => ({ + x: item.timestamp * 1000, + y: item[socKey as keyof typeof item] as number, + })), fill: false, yAxisID: 'y2', }; @@ -114,14 +118,16 @@ const vehicleDatasets = computed(() => const lineChartData = computed(() => { return { - labels: selectedData.value.map((item) => item.time), datasets: [ { label: meterName.value, unit: 'kW', borderColor: '#a33c42', backgroundColor: 'rgba(239,182,188, 0.2)', - data: selectedData.value.map((item) => item.grid), + data: selectedData.value.map((item) => ({ + x: item.timestamp * 1000, + y: item.grid, + })), borderWidth: 2, pointRadius: 0, pointHoverRadius: 4, @@ -134,7 +140,10 @@ const lineChartData = computed(() => { unit: 'kW', borderColor: '#949aa1', backgroundColor: 'rgba(148, 154, 161, 0.2)', - data: selectedData.value.map((item) => item['house-power'] as number), + data: selectedData.value.map((item) => ({ + x: item.timestamp * 1000, + y: item['house-power'] as number, + })), borderWidth: 2, pointRadius: 0, pointHoverRadius: 4, @@ -147,7 +156,10 @@ const lineChartData = computed(() => { unit: 'kW', borderColor: 'green', backgroundColor: 'rgba(144, 238, 144, 0.2)', - data: selectedData.value.map((item) => item['pv-all'] as number), + data: selectedData.value.map((item) => ({ + x: item.timestamp * 1000, + y: item['pv-all'] as number, + })), borderWidth: 2, pointRadius: 0, pointHoverRadius: 4, @@ -160,7 +172,10 @@ const lineChartData = computed(() => { unit: 'kW', borderColor: '#b5a647', backgroundColor: 'rgba(181, 166, 71, 0.2)', - data: selectedData.value.map((item) => item['bat-all-power'] as number), + data: selectedData.value.map((item) => ({ + x: item.timestamp * 1000, + y: item['bat-all-power'] as number, + })), borderWidth: 2, pointRadius: 0, pointHoverRadius: 4, @@ -177,7 +192,10 @@ const lineChartData = computed(() => { pointRadius: 0, pointHoverRadius: 4, pointHitRadius: 5, - data: selectedData.value.map((item) => item['bat-all-soc'] as number), + data: selectedData.value.map((item) => ({ + x: item.timestamp * 1000, + y: item['bat-all-soc'] as number, + })), fill: false, yAxisID: 'y2', }, From 18aecb524a46263eb4debabccc85866fa087bc97 Mon Sep 17 00:00:00 2001 From: Brett-S-OWB Date: Thu, 13 Mar 2025 15:40:26 +0100 Subject: [PATCH 03/10] Import / register tooltip plugin for history chart --- .../source/src/components/charts/historyChart/HistoryChart.vue | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/modules/web_themes/koala/source/src/components/charts/historyChart/HistoryChart.vue b/packages/modules/web_themes/koala/source/src/components/charts/historyChart/HistoryChart.vue index 85c289b95f..055b6a13f2 100644 --- a/packages/modules/web_themes/koala/source/src/components/charts/historyChart/HistoryChart.vue +++ b/packages/modules/web_themes/koala/source/src/components/charts/historyChart/HistoryChart.vue @@ -20,6 +20,7 @@ import { PointElement, LinearScale, TimeScale, + Tooltip, Filler, } from 'chart.js'; import { useMqttStore } from 'src/stores/mqtt-store'; @@ -33,6 +34,7 @@ Chart.register( PointElement, LinearScale, TimeScale, + Tooltip, Filler, ); const $q = useQuasar(); From f73896dea4844eb6ac6b2fee553f43325be36333 Mon Sep 17 00:00:00 2001 From: Brett-S-OWB Date: Fri, 14 Mar 2025 17:09:42 +0100 Subject: [PATCH 04/10] History Chart - preserve legend item visibility on reload --- .../charts/historyChart/HistoryChart.vue | 85 ++++++++++++++++++- 1 file changed, 82 insertions(+), 3 deletions(-) diff --git a/packages/modules/web_themes/koala/source/src/components/charts/historyChart/HistoryChart.vue b/packages/modules/web_themes/koala/source/src/components/charts/historyChart/HistoryChart.vue index 055b6a13f2..ae9db911a7 100644 --- a/packages/modules/web_themes/koala/source/src/components/charts/historyChart/HistoryChart.vue +++ b/packages/modules/web_themes/koala/source/src/components/charts/historyChart/HistoryChart.vue @@ -4,12 +4,13 @@ :data="lineChartData" :options="chartOptions" :class="'chart'" + ref="chartRef" /> From b7ba1aa10738e2940b0c39b321082fb96c8e6fda Mon Sep 17 00:00:00 2001 From: Brett-S-OWB Date: Tue, 1 Apr 2025 08:19:09 +0200 Subject: [PATCH 10/10] Refactor SliderDouble - two sliders only --- .../source/src/components/ChargePointCard.vue | 100 ++++-------- .../source/src/components/SliderDouble.vue | 152 +++++++----------- 2 files changed, 91 insertions(+), 161 deletions(-) diff --git a/packages/modules/web_themes/koala/source/src/components/ChargePointCard.vue b/packages/modules/web_themes/koala/source/src/components/ChargePointCard.vue index 5946e55338..5b2b6a844e 100644 --- a/packages/modules/web_themes/koala/source/src/components/ChargePointCard.vue +++ b/packages/modules/web_themes/koala/source/src/components/ChargePointCard.vue @@ -31,32 +31,27 @@
geladen
- {{ energyChargedPlugged }}
- - -