From 229ca0b0f3e74898472d4324b0fe249474156e6a Mon Sep 17 00:00:00 2001 From: Claus Hagen Date: Thu, 3 Apr 2025 17:33:22 +0200 Subject: [PATCH] adapt to new charge mode concept --- .../colors/source/src/assets/css/style.css | 7 +- .../source/src/assets/js/sendMessages.ts | 12 +- .../source/src/assets/js/themeConfig.ts | 12 +- .../colors/source/src/assets/js/types.ts | 2 +- .../components/batteryList/BatteryList.vue | 7 +- .../src/components/buttonBar/BBSelect.vue | 2 +- .../components/buttonBar/BbChargeButton.vue | 1 - .../chargePointList/CPChargePoint.vue | 22 +- .../cpConfig/CPChargeConfig.vue | 29 +- .../cpConfig/CPChargeConfigPanel.vue | 45 +-- .../chargePointList/cpConfig/CPConfigEco.vue | 117 ++++++ .../cpConfig/CPConfigInstant.vue | 22 +- .../chargePointList/cpConfig/CPConfigPv.vue | 212 +++++++---- .../cpConfig/CPConfigScheduled.vue | 2 + .../cpConfig/CPConfigTimed.vue | 2 + .../cpSimpleList/CpsListItem2.vue | 2 +- .../src/components/chargePointList/model.ts | 355 ++++++++++++------ .../chargePointList/processMessages.ts | 81 ++-- .../components/counterList/CounterList.vue | 6 +- .../components/inverterList/InverterList.vue | 6 +- .../src/components/powerGraph/PgSoc.vue | 74 ++-- .../components/powerGraph/PgSourceGraph.vue | 11 +- .../components/powerGraph/PgUsageGraph.vue | 17 +- .../src/components/powerGraph/PgXAxis.vue | 10 +- .../src/components/powerGraph/PowerGraph.vue | 2 +- .../src/components/powerGraph/SocBat.vue | 193 ---------- .../src/components/powerGraph/SocCar1.vue | 193 ---------- .../src/components/powerGraph/SocCar2.vue | 193 ---------- .../src/components/powerGraph/SocGeneric.vue | 97 ----- .../source/src/components/powerGraph/model.ts | 10 +- .../powerGraph/processMonthYearGraphData.ts | 1 - .../src/components/priceChart/PriceChart.vue | 8 +- .../src/components/shared/ConfigItem.vue | 62 +-- .../src/components/shared/RadioInput2.vue | 84 +++++ .../src/components/shared/RangeInput.vue | 5 +- .../src/components/shared/WbSubwidget.vue | 18 +- .../components/vehicleList/VehicleList.vue | 2 +- .../src/components/vehicleList/VlVehicle.vue | 82 +--- .../colors/source/src/views/ThemeSettings.vue | 83 ++-- .../colors/web/assets/index-B1IFxNDg.js | 6 + ...{index-Czdng4oR.css => index-R7WEwZeK.css} | 4 +- .../colors/web/assets/index-VjOXjC9v.js | 6 - .../modules/web_themes/colors/web/index.html | 4 +- 43 files changed, 915 insertions(+), 1194 deletions(-) create mode 100644 packages/modules/web_themes/colors/source/src/components/chargePointList/cpConfig/CPConfigEco.vue delete mode 100644 packages/modules/web_themes/colors/source/src/components/powerGraph/SocBat.vue delete mode 100644 packages/modules/web_themes/colors/source/src/components/powerGraph/SocCar1.vue delete mode 100644 packages/modules/web_themes/colors/source/src/components/powerGraph/SocCar2.vue delete mode 100644 packages/modules/web_themes/colors/source/src/components/powerGraph/SocGeneric.vue create mode 100644 packages/modules/web_themes/colors/source/src/components/shared/RadioInput2.vue create mode 100644 packages/modules/web_themes/colors/web/assets/index-B1IFxNDg.js rename packages/modules/web_themes/colors/web/assets/{index-Czdng4oR.css => index-R7WEwZeK.css} (71%) delete mode 100644 packages/modules/web_themes/colors/web/assets/index-VjOXjC9v.js diff --git a/packages/modules/web_themes/colors/source/src/assets/css/style.css b/packages/modules/web_themes/colors/source/src/assets/css/style.css index 5939cccb11..d98dbda359 100644 --- a/packages/modules/web_themes/colors/source/src/assets/css/style.css +++ b/packages/modules/web_themes/colors/source/src/assets/css/style.css @@ -196,6 +196,7 @@ body>.container-fluid { --font-verysmall: 0.7rem; --font-extralarge: 1.7rem; --font-settings: 16px; + --font-settings-button: 14px; } /* Theme color sets */ @@ -314,7 +315,11 @@ body>.container-fluid { gap: .2em; justify-items: center; } -.grid-col-3 { +.grid-col-1 { + grid-column: span 1; +}.grid-col-2 { + grid-column: span 2; +}.grid-col-3 { grid-column: span 3; } .grid-col-4 { diff --git a/packages/modules/web_themes/colors/source/src/assets/js/sendMessages.ts b/packages/modules/web_themes/colors/source/src/assets/js/sendMessages.ts index 14e680880d..27e227633d 100644 --- a/packages/modules/web_themes/colors/source/src/assets/js/sendMessages.ts +++ b/packages/modules/web_themes/colors/source/src/assets/js/sendMessages.ts @@ -45,6 +45,7 @@ const topics: { [topic: string]: string } = { socUpdate: 'openWB/set/vehicle/%/get/force_soc_update', setSoc: 'openWB/set/vehicle/%/soc_module/calculated_soc_state/manual_soc', priceCharging: 'openWB/set/vehicle/template/charge_template/%/et/active', + chargeTemplate: 'openWB/set/chargepoint/%/set/charge_template', } export function updateServer( item: string, @@ -61,7 +62,7 @@ export function updateServer( return } switch (item) { - case 'chargeMode': + /* case 'chargeMode': case 'cpPriority': case 'cpScheduledCharging': case 'cpInstantTargetCurrent': @@ -76,7 +77,7 @@ export function updateServer( case 'cpPvMinSocCurrent': // these values are set in the charge template topic = topic.replace('%', chargePoints[index].chargeTemplate.toString()) - break + break */ default: topic = topic.replace('%', String(index)) } @@ -96,3 +97,10 @@ export function sendCommand(event: object) { JSON.stringify(event), ) } + +export function updateChargeTemplate(cp: number) { + mqttPublish( + topics.chargeTemplate.replace('%', String(cp)), + JSON.stringify(chargePoints[cp].chargeTemplate), + ) +} diff --git a/packages/modules/web_themes/colors/source/src/assets/js/themeConfig.ts b/packages/modules/web_themes/colors/source/src/assets/js/themeConfig.ts index cf41622841..15fb212c61 100644 --- a/packages/modules/web_themes/colors/source/src/assets/js/themeConfig.ts +++ b/packages/modules/web_themes/colors/source/src/assets/js/themeConfig.ts @@ -362,7 +362,7 @@ export const chargemodes: { [key: string]: ChargeModeInfo } = { pv_charging: { mode: ChargeMode.pv_charging, name: 'PV', - color: 'var(--color-pv', + color: 'var(--color-pv)', icon: 'fa-solar-panel', }, scheduled_charging: { @@ -371,11 +371,11 @@ export const chargemodes: { [key: string]: ChargeModeInfo } = { color: 'var(--color-battery)', icon: 'fa-bullseye', }, - standby: { - mode: ChargeMode.standby, - name: 'Standby', - color: 'var(--color-axis', - icon: 'fa-pause', + eco_charging: { + mode: ChargeMode.eco_charging, + name: 'Eco', + color: 'var(--color-devices)', + icon: 'fa-coins', }, stop: { mode: ChargeMode.stop, diff --git a/packages/modules/web_themes/colors/source/src/assets/js/types.ts b/packages/modules/web_themes/colors/source/src/assets/js/types.ts index 06f354ed25..00164a9e16 100644 --- a/packages/modules/web_themes/colors/source/src/assets/js/types.ts +++ b/packages/modules/web_themes/colors/source/src/assets/js/types.ts @@ -33,7 +33,7 @@ export enum ChargeMode { instant_charging = 'instant_charging', pv_charging = 'pv_charging', scheduled_charging = 'scheduled_charging', - standby = 'standby', + eco_charging = 'eco_charging', stop = 'stop', } diff --git a/packages/modules/web_themes/colors/source/src/components/batteryList/BatteryList.vue b/packages/modules/web_themes/colors/source/src/components/batteryList/BatteryList.vue index c7d73f7623..653ba62a4b 100755 --- a/packages/modules/web_themes/colors/source/src/components/batteryList/BatteryList.vue +++ b/packages/modules/web_themes/colors/source/src/components/batteryList/BatteryList.vue @@ -36,7 +36,12 @@ Hagen */ - + diff --git a/packages/modules/web_themes/colors/source/src/components/buttonBar/BBSelect.vue b/packages/modules/web_themes/colors/source/src/components/buttonBar/BBSelect.vue index 9e1aafd653..59b3c3d648 100755 --- a/packages/modules/web_themes/colors/source/src/components/buttonBar/BBSelect.vue +++ b/packages/modules/web_themes/colors/source/src/components/buttonBar/BBSelect.vue @@ -122,7 +122,7 @@ const buttons = [ name: 'Zielladen', color: 'var(--color-battery)', }, - { mode: 'standby', name: 'Standby', color: 'var(--color-axis)' }, + { mode: 'eco_charging', name: 'Eco', color: 'var(--color-devices)' }, { mode: 'stop', name: 'Stop', color: 'var(--color-axis)' }, ] const cp = computed(() => { diff --git a/packages/modules/web_themes/colors/source/src/components/buttonBar/BbChargeButton.vue b/packages/modules/web_themes/colors/source/src/components/buttonBar/BbChargeButton.vue index fcfa6dcf5a..d275e00c64 100644 --- a/packages/modules/web_themes/colors/source/src/components/buttonBar/BbChargeButton.vue +++ b/packages/modules/web_themes/colors/source/src/components/buttonBar/BbChargeButton.vue @@ -100,7 +100,6 @@ const modePillStyle = computed(() => { style = swapcolors(style) } break - case ChargeMode.standby: case ChargeMode.stop: style.background = 'darkgrey' style.color = 'black' diff --git a/packages/modules/web_themes/colors/source/src/components/chargePointList/CPChargePoint.vue b/packages/modules/web_themes/colors/source/src/components/chargePointList/CPChargePoint.vue index 6a2648ce41..00552734b7 100755 --- a/packages/modules/web_themes/colors/source/src/components/chargePointList/CPChargePoint.vue +++ b/packages/modules/web_themes/colors/source/src/components/chargePointList/CPChargePoint.vue @@ -215,18 +215,15 @@
+ - + {{ currentPrice }} ct - + {{ props.chargepoint.etActive @@ -235,19 +232,13 @@ ).toFixed(1) + ' ct' : '-' }} + - - {{ currentPrice }} ct -
- v.visible).length > 1" title="Fahrzeug wechseln" icon="fa-car" :infotext="infotext['vehicle']" :fullwidth="true" > - - + - + - + - - - + --> + + diff --git a/packages/modules/web_themes/colors/source/src/components/chargePointList/cpConfig/CPConfigInstant.vue b/packages/modules/web_themes/colors/source/src/components/chargePointList/cpConfig/CPConfigInstant.vue index f210a901a2..141aa08ddf 100755 --- a/packages/modules/web_themes/colors/source/src/components/chargePointList/cpConfig/CPConfigInstant.vue +++ b/packages/modules/web_themes/colors/source/src/components/chargePointList/cpConfig/CPConfigInstant.vue @@ -13,18 +13,27 @@ unit="A" /> + + +
@@ -60,7 +69,7 @@ diff --git a/packages/modules/web_themes/colors/source/src/components/chargePointList/cpConfig/CPConfigScheduled.vue b/packages/modules/web_themes/colors/source/src/components/chargePointList/cpConfig/CPConfigScheduled.vue index b2d08ffbb6..31409b1343 100755 --- a/packages/modules/web_themes/colors/source/src/components/chargePointList/cpConfig/CPConfigScheduled.vue +++ b/packages/modules/web_themes/colors/source/src/components/chargePointList/cpConfig/CPConfigScheduled.vue @@ -94,6 +94,8 @@ function cellStyle(key: number) { } .heading { color: var(--color-battery); + font-size: var(--font-settings); + font-weight: bold; } .left { diff --git a/packages/modules/web_themes/colors/source/src/components/chargePointList/cpConfig/CPConfigTimed.vue b/packages/modules/web_themes/colors/source/src/components/chargePointList/cpConfig/CPConfigTimed.vue index 293228118d..cc13c2bdf6 100755 --- a/packages/modules/web_themes/colors/source/src/components/chargePointList/cpConfig/CPConfigTimed.vue +++ b/packages/modules/web_themes/colors/source/src/components/chargePointList/cpConfig/CPConfigTimed.vue @@ -91,6 +91,8 @@ function cellStyle(key: number) { .heading { color: var(--color-battery); + font-size: var(--font-settings); + font-weight: bold; } .left { diff --git a/packages/modules/web_themes/colors/source/src/components/chargePointList/cpSimpleList/CpsListItem2.vue b/packages/modules/web_themes/colors/source/src/components/chargePointList/cpSimpleList/CpsListItem2.vue index 623dbc65de..c09fefd349 100755 --- a/packages/modules/web_themes/colors/source/src/components/chargePointList/cpSimpleList/CpsListItem2.vue +++ b/packages/modules/web_themes/colors/source/src/components/chargePointList/cpSimpleList/CpsListItem2.vue @@ -170,7 +170,7 @@ const statusColor = computed(() => { const modeStyle = computed(() => { switch (props.chargepoint.chargeMode) { case 'stop': - return { 'background-color': 'var(--color-input)' } + return { 'background-color': 'var(--fg)' } default: return { 'background-color': chargemodes[props.chargepoint.chargeMode].color, diff --git a/packages/modules/web_themes/colors/source/src/components/chargePointList/model.ts b/packages/modules/web_themes/colors/source/src/components/chargePointList/model.ts index ecd9b5a806..1b03fb1491 100755 --- a/packages/modules/web_themes/colors/source/src/components/chargePointList/model.ts +++ b/packages/modules/web_themes/colors/source/src/components/chargePointList/model.ts @@ -1,5 +1,5 @@ import { computed, reactive } from 'vue' -import { updateServer } from '@/assets/js/sendMessages' +import { updateChargeTemplate, updateServer } from '@/assets/js/sendMessages' import { ChargeMode, type PowerItem } from '@/assets/js/types' import { globalConfig } from '@/assets/js/themeConfig' import { masterData } from '@/assets/js/model' @@ -19,7 +19,7 @@ export class ChargePoint { isCharging = false private _isLocked = false private _connectedVehicle = 0 - chargeTemplate = 0 + chargeTemplate: ChargeTemplate | null = null evTemplate = 0 private _chargeMode = ChargeMode.pv_charging private _hasPriority = false @@ -52,11 +52,22 @@ export class ChargePoint { private _instantTargetCurrent = 0 private _instantTargetSoc = 0 private _instantMaxEnergy = 0 + private _instantTargetPhases = 0 private _pvFeedInLimit = false private _pvMinCurrent = 0 private _pvMaxSoc = 0 private _pvMinSoc = 0 private _pvMinSocCurrent = 0 + private _pvMinSocPhases = 1 + private _pvChargeLimitMode = '' + private _pvTargetSoc = 0 + private _pvMaxEnergy = 0 + private _pvTargetPhases = 0 + private _ecoMinCurrent = 0 + private _ecoTargetPhases = 0 + private _ecoChargeLimitMode = '' + private _ecoTargetSoc = 0 + private _ecoMaxEnergy = 0 private _etActive = false private _etMaxPrice = 20 @@ -96,97 +107,128 @@ export class ChargePoint { } } get chargeMode() { - return this._chargeMode + return this.chargeTemplate?.chargemode.selected ?? ChargeMode.stop } set chargeMode(cm: ChargeMode) { - this._chargeMode = cm - updateServer('chargeMode', cm, this.id) + console.log('set mode') + if (this.chargeTemplate) { + console.log('active') + this.chargeTemplate.chargemode.selected = cm + updateChargeTemplate(this.id) + } } - updateChargeMode(cm: ChargeMode) { + /* updateChargeMode(cm: ChargeMode) { this._chargeMode = cm - } + } */ get hasPriority() { - return this._hasPriority + return this.chargeTemplate?.prio ?? false } set hasPriority(prio: boolean) { - this._hasPriority = prio - updateServer('cpPriority', prio, this.id) + if (this.chargeTemplate) { + this.chargeTemplate.prio = prio + updateServer('cpPriority', prio, this.id) + } } - updateCpPriority(prio: boolean) { + /* updateCpPriority(prio: boolean) { this._hasPriority = prio - } + } */ get timedCharging() { - if (chargeTemplates[this.chargeTemplate]) { - return chargeTemplates[this.chargeTemplate].time_charging.active + if (this.chargeTemplate) { + return this.chargeTemplate.time_charging.active } else { return false } } set timedCharging(setting: boolean) { // chargeTemplates[this.chargeTemplate].time_charging.active = false - chargeTemplates[this.chargeTemplate].time_charging.active = setting - updateServer('cpTimedCharging', setting, this.chargeTemplate) + this.chargeTemplate!.time_charging.active = setting + updateServer('cpTimedCharging', setting, this.id) } get instantTargetCurrent() { - return this._instantTargetCurrent + return this.chargeTemplate?.chargemode.instant_charging.current ?? 0 } set instantTargetCurrent(current: number) { - this._instantTargetCurrent = current - updateServer('cpInstantTargetCurrent', current, this.id) + if (this.chargeTemplate) { + this.chargeTemplate.chargemode.instant_charging.current = current + updateChargeTemplate(this.id) + } } - updateInstantTargetCurrent(current: number) { + /* updateInstantTargetCurrent(current: number) { this._instantTargetCurrent = current } + */ get instantChargeLimitMode() { - return this._instantChargeLimitMode + return ( + this.chargeTemplate?.chargemode.instant_charging.limit.selected ?? 'none' + ) } set instantChargeLimitMode(mode: string) { - this._instantChargeLimitMode = mode - updateServer('cpInstantChargeLimitMode', mode, this.id) + if (this.chargeTemplate) { + this.chargeTemplate.chargemode.instant_charging.limit.selected = mode + updateChargeTemplate(this.id) + } } - updateInstantChargeLimitMode(mode: string) { + /* updateInstantChargeLimitMode(mode: string) { this._instantChargeLimitMode = mode - } + } */ get instantTargetSoc() { - return this._instantTargetSoc + return this.chargeTemplate?.chargemode.instant_charging.limit.soc ?? 0 } set instantTargetSoc(soc: number) { - this._instantTargetSoc = soc - updateServer('cpInstantTargetSoc', soc, this.id) + if (this.chargeTemplate) { + this.chargeTemplate.chargemode.instant_charging.limit.soc = soc + updateChargeTemplate(this.id) + } } - updateInstantTargetSoc(soc: number) { + /* updateInstantTargetSoc(soc: number) { this._instantTargetSoc = soc - } + } */ get instantMaxEnergy() { - return this._instantMaxEnergy + return this.chargeTemplate?.chargemode.instant_charging.limit.amount ?? 0 } set instantMaxEnergy(max: number) { - this._instantMaxEnergy = max - updateServer('cpInstantMaxEnergy', max, this.id) + if (this.chargeTemplate) { + this.chargeTemplate.chargemode.instant_charging.limit.amount = max + updateChargeTemplate(this.id) + } } - updateInstantMaxEnergy(max: number) { + /* updateInstantMaxEnergy(max: number) { this._instantMaxEnergy = max + } */ + get instantTargetPhases() { + return this.chargeTemplate?.chargemode.instant_charging.phases_to_use ?? 0 + } + set instantTargetPhases(phases: number) { + if (this.chargeTemplate) { + this.chargeTemplate.chargemode.instant_charging.phases_to_use = phases + updateChargeTemplate(this.id) + } } + get pvFeedInLimit() { - return this._pvFeedInLimit + return this.chargeTemplate?.chargemode.pv_charging.feed_in_limit ?? false } set pvFeedInLimit(setting: boolean) { - this._pvFeedInLimit = setting - updateServer('cpPvFeedInLimit', setting, this.id) + if (this.chargeTemplate) { + this.chargeTemplate.chargemode.pv_charging.feed_in_limit = setting + updateChargeTemplate(this.id) + } } - updatePvFeedInLimit(setting: boolean) { + /* updatePvFeedInLimit(setting: boolean) { this._pvFeedInLimit = setting - } + } */ get pvMinCurrent() { - return this._pvMinCurrent + return this.chargeTemplate?.chargemode.pv_charging.min_current ?? 0 } set pvMinCurrent(min: number) { - this._pvMinCurrent = min - updateServer('cpPvMinCurrent', min, this.id) + if (this.chargeTemplate) { + this.chargeTemplate.chargemode.pv_charging.min_current = min + updateChargeTemplate(this.id) + } } - updatePvMinCurrent(min: number) { + /* updatePvMinCurrent(min: number) { this._pvMinCurrent = min - } + } */ get pvMaxSoc() { return this._pvMaxSoc } @@ -198,24 +240,135 @@ export class ChargePoint { this._pvMaxSoc = max } get pvMinSoc() { - return this._pvMinSoc + return this.chargeTemplate?.chargemode.pv_charging.min_soc ?? 0 } set pvMinSoc(min: number) { - this._pvMinSoc = min - updateServer('cpPvMinSoc', min, this.id) + if (this.chargeTemplate) { + this.chargeTemplate.chargemode.pv_charging.min_soc = min + updateChargeTemplate(this.id) + } } - updatePvMinSoc(min: number) { + /* updatePvMinSoc(min: number) { this._pvMinSoc = min - } + } */ get pvMinSocCurrent() { - return this._pvMinSocCurrent + return this.chargeTemplate?.chargemode.pv_charging.min_soc_current ?? 0 } set pvMinSocCurrent(a: number) { - this._pvMinSocCurrent = a - updateServer('cpPvMinSocCurrent', a, this.id) + if (this.chargeTemplate) { + this.chargeTemplate.chargemode.pv_charging.min_soc_current = a + updateChargeTemplate(this.id) + } + } + set pvMinSocPhases(n: number) { + if (this.chargeTemplate) { + this.chargeTemplate.chargemode.pv_charging.phases_to_use_min_soc = n + updateChargeTemplate(this.id) + } + } + get pvMinSocPhases() { + return ( + this.chargeTemplate?.chargemode.pv_charging.phases_to_use_min_soc ?? 0 + ) + } + get pvChargeLimitMode() { + return this.chargeTemplate?.chargemode.pv_charging.limit.selected ?? 'none' + } + set pvChargeLimitMode(mode: string) { + if (this.chargeTemplate) { + this.chargeTemplate.chargemode.pv_charging.limit.selected = mode + updateChargeTemplate(this.id) + } + } + get pvTargetSoc() { + return this.chargeTemplate?.chargemode.pv_charging.limit.soc ?? 0 + } + set pvTargetSoc(soc: number) { + if (this.chargeTemplate) { + this.chargeTemplate.chargemode.pv_charging.limit.soc = soc + updateChargeTemplate(this.id) + } + } + get pvMaxEnergy() { + return this.chargeTemplate?.chargemode.pv_charging.limit.amount ?? 0 + } + set pvMaxEnergy(max: number) { + if (this.chargeTemplate) { + this.chargeTemplate.chargemode.pv_charging.limit.amount = max + updateChargeTemplate(this.id) + } + } + get pvTargetPhases() { + return this.chargeTemplate?.chargemode.pv_charging.phases_to_use ?? 0 + } + set pvTargetPhases(phases: number) { + if (this.chargeTemplate) { + this.chargeTemplate.chargemode.pv_charging.phases_to_use = phases + updateChargeTemplate(this.id) + } + } + get ecoMinCurrent() { + return this.chargeTemplate?.chargemode.eco_charging.current ?? 0 + } + set ecoMinCurrent(min: number) { + if (this.chargeTemplate) { + this.chargeTemplate.chargemode.eco_charging.current = min + updateChargeTemplate(this.id) + } + } + get ecoTargetPhases() { + return this.chargeTemplate?.chargemode.eco_charging.phases_to_use ?? 0 + } + set ecoTargetPhases(phases: number) { + if (this.chargeTemplate) { + this.chargeTemplate.chargemode.eco_charging.phases_to_use = phases + updateChargeTemplate(this.id) + } + } + get ecoChargeLimitMode() { + return this.chargeTemplate?.chargemode.eco_charging.limit.selected ?? 'none' + } + set ecoChargeLimitMode(mode: string) { + if (this.chargeTemplate) { + this.chargeTemplate.chargemode.eco_charging.limit.selected = mode + updateChargeTemplate(this.id) + } + } + get ecoTargetSoc() { + return this.chargeTemplate?.chargemode.eco_charging.limit.soc ?? 0 + } + set ecoTargetSoc(soc: number) { + if (this.chargeTemplate) { + this.chargeTemplate.chargemode.eco_charging.limit.soc = soc + updateChargeTemplate(this.id) + } + } + get ecoMaxEnergy() { + return this.chargeTemplate?.chargemode.eco_charging.limit.amount ?? 0 + } + set ecoMaxEnergy(max: number) { + if (this.chargeTemplate) { + this.chargeTemplate.chargemode.eco_charging.limit.amount = max + updateChargeTemplate(this.id) + } + } + get etMaxPrice() { + return ( + (this.chargeTemplate?.chargemode.eco_charging.max_price ?? 0) * 100000 + ) + } + set etMaxPrice(newPrice: number) { + if (this.chargeTemplate) { + this.chargeTemplate.chargemode.eco_charging.max_price = + Math.ceil(newPrice * 1000) / 100000000 + updateChargeTemplate(this.id) + } } - updatePvMinSocCurrent(a: number) { - this._pvMinSocCurrent = a + get etActive() { + return ( + this.chargeTemplate && + this.chargeTemplate.chargemode.selected == ChargeMode.eco_charging + ) } get realCurrent() { switch (this.phasesInUse) { @@ -231,29 +384,6 @@ export class ChargePoint { return 0 } } - get etActive() { - if (vehicles[this.connectedVehicle]) { - return vehicles[this.connectedVehicle].etActive - } else { - return false - } - } - set etActive(val) { - if (vehicles[this.connectedVehicle]) { - vehicles[this.connectedVehicle].etActive = val - } - } - get etMaxPrice() { - return vehicles[this.connectedVehicle].etMaxPrice ?? 0 - } - set etMaxPrice(newPrice: number) { - updateServer( - 'cpEtMaxPrice', - Math.ceil(newPrice * 1000) / 100000000, - this.id, - ) - //updateServer('cpEtMaxPrice', newPrice / 100000, this.id) - } toPowerItem(): PowerItem { return { name: this.name, @@ -279,8 +409,6 @@ export class Vehicle { this.id = index } private _chargeTemplateId = 0 - isSocConfigured = false - isSocManual = false get chargeTemplateId() { return this._chargeTemplateId } @@ -302,25 +430,6 @@ export class Vehicle { updateEvTemplateId(id: number) { this._evTemplateId = id } - get etActive() { - if (chargeTemplates[this.chargeTemplateId]) { - return chargeTemplates[this.chargeTemplateId].et.active - } else { - return false - } - } - set etActive(val) { - if (chargeTemplates[this.chargeTemplateId]) { - updateServer('priceCharging', val, this.chargeTemplateId) - } - } - get etMaxPrice() { - if (chargeTemplates[this.chargeTemplateId]) { - if (chargeTemplates[this.chargeTemplateId].et.active) { - return chargeTemplates[this.chargeTemplateId].et.max_price * 100000 - } - } - } get chargepoint(): ChargePoint | undefined { for (const cp of Object.values(chargePoints)) { if (cp.connectedVehicle == this.id) { @@ -374,34 +483,55 @@ export interface ChargeSchedule { } } export interface ChargeTemplate { + id: number name: string prio: boolean + load_default: boolean + time_charging: { + active: boolean + plans: object + } chargemode: { selected: ChargeMode - instant_charging: { + eco_charging: { current: number + dc_current: number limit: { selected: string soc: number amount: number } + max_price: number + phases_to_use: number } pv_charging: { + dc_min_current: number + dc_min_soc_current: number feed_in_limit: boolean + limit: { + selected: string + amount: number + soc: number + } min_current: number - max_soc: number - min_soc: number min_soc_current: number + min_soc: number + phases_to_use: number + phases_to_use_min_soc: number + } + scheduled_charging: { + plans: object + } + instant_charging: { + current: number + dc_current: number + limit: { + selected: string + soc: number + amount: number + } + phases_to_use: number } - } - time_charging: { - active: boolean - } - disable_after_unplug: boolean - load_default: boolean - et: { - active: boolean - max_price: number } } export interface EvTemplate { @@ -494,3 +624,8 @@ export const topVehicles = computed(() => { } return result }) +export const chargeLimitModes = [ + { name: 'keine', id: 'none' }, + { name: 'Ladestand', id: 'soc' }, + { name: 'Energie', id: 'amount' }, +] diff --git a/packages/modules/web_themes/colors/source/src/components/chargePointList/processMessages.ts b/packages/modules/web_themes/colors/source/src/components/chargePointList/processMessages.ts index fd35958b08..9f025ca99c 100755 --- a/packages/modules/web_themes/colors/source/src/components/chargePointList/processMessages.ts +++ b/packages/modules/web_themes/colors/source/src/components/chargePointList/processMessages.ts @@ -2,7 +2,7 @@ import { usageSummary, globalData, masterData } from '@/assets/js/model' import { chargePoints, vehicles, - chargeTemplates, + //chargeTemplates, evTemplates, Vehicle, type ChargeTimePlan, @@ -11,11 +11,11 @@ import { } from './model' import type { ConnectedVehicleConfig, - ChargeTemplate, + //ChargeTemplate, EvTemplate, ChargeSchedule, } from './model' -import { ChargeMode } from '@/assets/js/types' +// import { ChargeMode } from '@/assets/js/types' export function processChargepointMessages(topic: string, message: string) { const index = getIndex(topic) @@ -110,25 +110,11 @@ export function processChargepointMessages(topic: string, message: string) { ) ) { const config: ConnectedVehicleConfig = JSON.parse(message) - switch (config.chargemode) { - case 'instant_charging': - chargePoints[index].updateChargeMode(ChargeMode.instant_charging) - break - case 'pv_charging': - chargePoints[index].updateChargeMode(ChargeMode.pv_charging) - break - case 'scheduled_charging': - chargePoints[index].updateChargeMode(ChargeMode.scheduled_charging) - break - case 'standby': - chargePoints[index].updateChargeMode(ChargeMode.standby) - break - case 'stop': - chargePoints[index].updateChargeMode(ChargeMode.stop) - break - } - chargePoints[index].chargeTemplate = config.charge_template chargePoints[index].averageConsumption = config.average_consumption + } else if ( + topic.match(/^openwb\/chargepoint\/[0-9]+\/set\/charge_template$/i) + ) { + chargePoints[index].chargeTemplate = JSON.parse(message) } else { // console.warn('Ignored chargepoint message: ' + topic) } @@ -173,15 +159,13 @@ export function processVehicleMessages(topic: string, message: string) { cp.isSocManual = config.type == 'manual' } }) - vehicles[index].isSocConfigured = config.type !== null - vehicles[index].isSocManual = config.type == 'manual' } else { // console.warn('Ignored vehicle message [' + topic + ']=' + message) } } } export function processVehicleTemplateMessages(topic: string, message: string) { - if (topic.match(/^openwb\/vehicle\/template\/charge_template\/[0-9]+$/i)) { + /* if (topic.match(/^openwb\/vehicle\/template\/charge_template\/[0-9]+$/i)) { const match = topic.match(/[0-9]+$/i) if (match) { const index = +match[0] @@ -189,7 +173,8 @@ export function processVehicleTemplateMessages(topic: string, message: string) { chargeTemplates[index] = template updateCpFromChargeTemplate(index, template) } - } else if ( + } else */ + if ( topic.match( /^openwb\/vehicle\/template\/charge_template\/[0-9]+\/time_charging\/plans\/[0-9]+$/i, ) @@ -233,29 +218,29 @@ export function processVehicleTemplateMessages(topic: string, message: string) { // console.warn('Ignored VEHICLE TEMPLATE message [' + topic + ']=' + message) } } -function updateCpFromChargeTemplate(index: number, template: ChargeTemplate) { - Object.values(chargePoints).forEach((cp) => { - if (cp.chargeTemplate == index) { - cp.updateCpPriority(template.prio) - // cp.updateChargeMode(template.chargemode.selected) - cp.updateInstantChargeLimitMode( - template.chargemode.instant_charging.limit.selected, - ) - cp.updateInstantTargetCurrent( - template.chargemode.instant_charging.current, - ) - cp.updateInstantTargetSoc(template.chargemode.instant_charging.limit.soc) - cp.updateInstantMaxEnergy( - template.chargemode.instant_charging.limit.amount, - ) - cp.updatePvFeedInLimit(template.chargemode.pv_charging.feed_in_limit) - cp.updatePvMinCurrent(template.chargemode.pv_charging.min_current) - cp.updatePvMaxSoc(template.chargemode.pv_charging.max_soc) - cp.updatePvMinSoc(template.chargemode.pv_charging.min_soc) - cp.updatePvMinSocCurrent(template.chargemode.pv_charging.min_soc_current) - } - }) -} +//function updateCpFromChargeTemplate(index: number, template: ChargeTemplate) { +// Object.values(chargePoints).forEach((cp) => { +// if (cp.chargeTemplate == index) { +// cp.updateCpPriority(template.prio) +// cp.updateChargeMode(template.chargemode.selected) +//cp.updateInstantChargeLimitMode( +// template.chargemode.instant_charging.limit.selected, +//) +//cp.updateInstantTargetCurrent( +// template.chargemode.instant_charging.current, +//) +//cp.updateInstantTargetSoc(template.chargemode.instant_charging.limit.soc) +//cp.updateInstantMaxEnergy( +// template.chargemode.instant_charging.limit.amount, +//) +//cp.updatePvFeedInLimit(template.chargemode.pv_charging.feed_in_limit) +//cp.updatePvMinCurrent(template.chargemode.pv_charging.min_current) +//cp.updatePvMaxSoc(template.chargemode.pv_charging.max_soc) +//cp.updatePvMinSoc(template.chargemode.pv_charging.min_soc) +//cp.updatePvMinSocCurrent(template.chargemode.pv_charging.min_soc_current) +// } +// }) +//} function getIndex(topic: string): number | undefined { let index = 0 diff --git a/packages/modules/web_themes/colors/source/src/components/counterList/CounterList.vue b/packages/modules/web_themes/colors/source/src/components/counterList/CounterList.vue index a2734fa871..eb11aaca85 100755 --- a/packages/modules/web_themes/colors/source/src/components/counterList/CounterList.vue +++ b/packages/modules/web_themes/colors/source/src/components/counterList/CounterList.vue @@ -6,7 +6,11 @@ > Zähler -
+
diff --git a/packages/modules/web_themes/colors/source/src/components/inverterList/InverterList.vue b/packages/modules/web_themes/colors/source/src/components/inverterList/InverterList.vue index 789d4a2ba7..6055085647 100755 --- a/packages/modules/web_themes/colors/source/src/components/inverterList/InverterList.vue +++ b/packages/modules/web_themes/colors/source/src/components/inverterList/InverterList.vue @@ -11,7 +11,11 @@ {{ formatWatt(sourceSummary.pv.power) }} -
+
diff --git a/packages/modules/web_themes/colors/source/src/components/powerGraph/PgSoc.vue b/packages/modules/web_themes/colors/source/src/components/powerGraph/PgSoc.vue index 7385b562a5..56d5df951c 100755 --- a/packages/modules/web_themes/colors/source/src/components/powerGraph/PgSoc.vue +++ b/packages/modules/web_themes/colors/source/src/components/powerGraph/PgSoc.vue @@ -1,34 +1,32 @@ @@ -77,6 +75,7 @@ const myline = computed(() => { : d['soc' + topVehicles.value[1]!], ) ?? yScale.value(0), ) + let p = path(graphData.data) return p ? p : '' }) @@ -117,11 +116,11 @@ const cpColor = computed(() => { const nameX = computed(() => { switch (props.order) { case 0: - return 3 // first vehicle + return 3 case 1: - return props.width - 3 // 2nd vehicle + return props.width - 3 case 2: - return props.width / 2 // battery + return props.width / 2 default: return 0 // error } @@ -131,16 +130,15 @@ const nameY = computed(() => { if (graphData.data.length > 0) { let index: number switch (props.order) { - case 0: // 1st vehicle - index = 0 + case 0: + index = graphData.data.length - 1 return yScale.value( graphData.data[index]['soc' + topVehicles.value[0]] + 2, ) case 1: - index = graphData.data.length - 1 - return Math.max( - 12, - yScale.value(graphData.data[index]['soc' + topVehicles.value[1]] + 2), + index = 0 + return yScale.value( + graphData.data[index]['soc' + topVehicles.value[1]] + 2, ) case 2: index = Math.round(graphData.data.length / 2) diff --git a/packages/modules/web_themes/colors/source/src/components/powerGraph/PgSourceGraph.vue b/packages/modules/web_themes/colors/source/src/components/powerGraph/PgSourceGraph.vue index 9630a561e2..a64be7c66d 100755 --- a/packages/modules/web_themes/colors/source/src/components/powerGraph/PgSourceGraph.vue +++ b/packages/modules/web_themes/colors/source/src/components/powerGraph/PgSourceGraph.vue @@ -103,17 +103,14 @@ const keysToUse = computed(() => { if (globalConfig.showInverters) { const pattern = /pv\d+/ if (graphData.data.length > 0) { - /* additionalKeys = Object.keys(graphData.data[0]).reduce( - (list: string[], itemKey: string) => { - if (itemKey.match(pattern)) { - list.push(itemKey) + additionalKeys = Object.keys(graphData.data[0]).reduce( + (list: string[], element: string) => { + if (element.match(pattern)) { + list.push(element) } return list }, [], - ) */ - additionalKeys = Object.keys(graphData.data[0]).filter((itemKey) => - itemKey.match(pattern), ) } } diff --git a/packages/modules/web_themes/colors/source/src/components/powerGraph/PgUsageGraph.vue b/packages/modules/web_themes/colors/source/src/components/powerGraph/PgUsageGraph.vue index 23f23d5f1a..7c16ad8c83 100755 --- a/packages/modules/web_themes/colors/source/src/components/powerGraph/PgUsageGraph.vue +++ b/packages/modules/web_themes/colors/source/src/components/powerGraph/PgUsageGraph.vue @@ -141,18 +141,23 @@ const keysToUse = computed(() => { const pattern = /cp\d+/ let additionalKeys: string[] = [] if (graphData.data.length > 0) { - additionalKeys = Object.keys(graphData.data[0]).filter((itemKey) => - itemKey.match(pattern), + additionalKeys = Object.keys(graphData.data[0]).reduce( + (list: string[], element: string) => { + if (element.match(pattern)) { + list.push(element) + } + return list + }, + [], ) } additionalKeys.forEach((key, i) => { k.splice(idx + i, 0, key) - colors[key] = - chargePoints[+key.slice(2)]?.color ?? 'var(--color-charging)' + colors[key] = chargePoints[+key.slice(2)]?.color ?? 'black' }) - /* if (globalConfig.showInverters) { + if (globalConfig.showInverters) { k.push('evuOut') - } */ + } return k } }) diff --git a/packages/modules/web_themes/colors/source/src/components/powerGraph/PgXAxis.vue b/packages/modules/web_themes/colors/source/src/components/powerGraph/PgXAxis.vue index 61b9ac31e7..9d2b9e80b7 100755 --- a/packages/modules/web_themes/colors/source/src/components/powerGraph/PgXAxis.vue +++ b/packages/modules/web_themes/colors/source/src/components/powerGraph/PgXAxis.vue @@ -5,7 +5,7 @@ :transform="'translate(' + 0 + ',' + (height / 2 + 9) + ')'" > - + { return 'zoomed' }) - -const axisWidth = computed(() => { - if (['live', 'today', 'day'].includes(graphData.graphMode)) { - return props.width - } else { - return props.width + props.margin.left + props.margin.right - } -}) diff --git a/packages/modules/web_themes/colors/source/src/components/powerGraph/PowerGraph.vue b/packages/modules/web_themes/colors/source/src/components/powerGraph/PowerGraph.vue index 1d95fa5884..298be554fd 100755 --- a/packages/modules/web_themes/colors/source/src/components/powerGraph/PowerGraph.vue +++ b/packages/modules/web_themes/colors/source/src/components/powerGraph/PowerGraph.vue @@ -49,7 +49,7 @@ :stack-order="globalConfig.usageStackOrder" /> diff --git a/packages/modules/web_themes/colors/source/src/components/powerGraph/SocBat.vue b/packages/modules/web_themes/colors/source/src/components/powerGraph/SocBat.vue deleted file mode 100644 index 7385b562a5..0000000000 --- a/packages/modules/web_themes/colors/source/src/components/powerGraph/SocBat.vue +++ /dev/null @@ -1,193 +0,0 @@ - - - - diff --git a/packages/modules/web_themes/colors/source/src/components/powerGraph/SocCar1.vue b/packages/modules/web_themes/colors/source/src/components/powerGraph/SocCar1.vue deleted file mode 100644 index 7385b562a5..0000000000 --- a/packages/modules/web_themes/colors/source/src/components/powerGraph/SocCar1.vue +++ /dev/null @@ -1,193 +0,0 @@ - - - - diff --git a/packages/modules/web_themes/colors/source/src/components/powerGraph/SocCar2.vue b/packages/modules/web_themes/colors/source/src/components/powerGraph/SocCar2.vue deleted file mode 100644 index 7385b562a5..0000000000 --- a/packages/modules/web_themes/colors/source/src/components/powerGraph/SocCar2.vue +++ /dev/null @@ -1,193 +0,0 @@ - - - - diff --git a/packages/modules/web_themes/colors/source/src/components/powerGraph/SocGeneric.vue b/packages/modules/web_themes/colors/source/src/components/powerGraph/SocGeneric.vue deleted file mode 100644 index 3aa1bb1d41..0000000000 --- a/packages/modules/web_themes/colors/source/src/components/powerGraph/SocGeneric.vue +++ /dev/null @@ -1,97 +0,0 @@ - - - - diff --git a/packages/modules/web_themes/colors/source/src/components/powerGraph/model.ts b/packages/modules/web_themes/colors/source/src/components/powerGraph/model.ts index 005457afa3..9336d6835c 100755 --- a/packages/modules/web_themes/colors/source/src/components/powerGraph/model.ts +++ b/packages/modules/web_themes/colors/source/src/components/powerGraph/model.ts @@ -172,7 +172,7 @@ export const dayGraph = reactive({ graphData.waitForData = true sendCommand({ command: 'getDailyLog', - data: { date: dateString, day: dateString }, + data: { day: dateString }, }) } }, @@ -208,7 +208,7 @@ export const monthGraph = reactive({ graphData.waitForData = true sendCommand({ command: 'getMonthlyLog', - data: { date: dateString, month: dateString }, + data: { month: dateString }, }) }, deactivate() { @@ -256,7 +256,7 @@ export const yearGraph = reactive({ graphData.waitForData = true sendCommand({ command: 'getYearlyLog', - data: { date: dateString, year: dateString }, + data: { year: dateString }, }) }, deactivate() { @@ -360,9 +360,7 @@ export function updateEnergyValues( historicSummary.items.evuOut.energy += values.energy_exported } }) - if (Object.entries(totals.pv).length > 0) { - historicSummary.items.pv.energy = totals.pv.all.energy_exported - } + historicSummary.items.pv.energy = totals.pv.all.energy_exported if (totals.bat.all) { historicSummary.items.batIn.energy = totals.bat.all.energy_imported historicSummary.items.batOut.energy = totals.bat.all.energy_exported diff --git a/packages/modules/web_themes/colors/source/src/components/powerGraph/processMonthYearGraphData.ts b/packages/modules/web_themes/colors/source/src/components/powerGraph/processMonthYearGraphData.ts index 3b35a39f7f..25eb59fc1f 100755 --- a/packages/modules/web_themes/colors/source/src/components/powerGraph/processMonthYearGraphData.ts +++ b/packages/modules/web_themes/colors/source/src/components/powerGraph/processMonthYearGraphData.ts @@ -56,7 +56,6 @@ export function processMonthGraphMessages(topic: string, message: string) { // reloadMonthGraph(topic, message) } export function processYearGraphMessages(topic: string, message: string) { - console.log("process data") //const inputTable: RawDayGraphDataItem[] = JSON.parse(message).entries //const energyValues: RawDayGraphDataItem = JSON.parse(message).totals const { diff --git a/packages/modules/web_themes/colors/source/src/components/priceChart/PriceChart.vue b/packages/modules/web_themes/colors/source/src/components/priceChart/PriceChart.vue index 9542cfcbef..e21ae6fc78 100755 --- a/packages/modules/web_themes/colors/source/src/components/priceChart/PriceChart.vue +++ b/packages/modules/web_themes/colors/source/src/components/priceChart/PriceChart.vue @@ -1,5 +1,4 @@

Preisbasiertes Laden:

Anbieter: {{ etData.etProvider }}


@@ -15,7 +14,6 @@