UI: add unit property (#21396)

This commit is contained in:
andig 2025-05-30 11:47:51 +02:00 • committed by GitHub
parent 0b033933aa
commit c136ebc2e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 105 additions and 71 deletions

View file

@ -10,10 +10,11 @@
<PropertyField
:id="id"
v-model="value"
class="me-2"
:masked="Mask"
:property="Name"
:type="Type"
class="me-2"
:unit="Unit"
:required="Required"
:choice="Choice"
/>
@ -37,6 +38,7 @@ export default {
Help: String,
Example: String,
Type: String,
Unit: String,
Mask: Boolean,
Choice: Array,
modelValue: [String, Number, Boolean, Object],

View file

@ -163,9 +163,6 @@ export default {
if (this.unit) {
return this.unit;
}
if (this.property === "capacity") {
return "kWh";
}
return null;
},
icons() {

View file

@ -438,6 +438,10 @@ func (c *CmdConfigure) processInputConfig(param templates.Param) string {
label = langLabel
}
if param.Unit != "" {
label = fmt.Sprintf("%s (%s)", label, param.Unit)
}
value := c.askValue(question{
label: label,
defaultValue: param.Default,

View file

@ -129,8 +129,13 @@ func (c *CmdConfigure) askParam(p templates.Param) string {
required = *p.Required
}
label := p.Description.String(c.lang)
if p.Unit != "" {
label = fmt.Sprintf("%s (%s)", label, p.Unit)
}
return c.askValue(question{
label: p.Description.String(c.lang),
label: label,
valueType: p.Type,
choice: p.Choice,
mask: mask,

View file

@ -6,9 +6,9 @@ requirements:
params:
- name: host #IP address or hostname (can be found on 3rd page of SECC display)
required: true
description:
en: IP address or hostname (can be found on 3rd page of SECC display)
de: IP-Adresse oder Hostname (wird auf der dritten Displayseite des SECC angezeigt)
help:
en: Shown on 3rd page of SECC display
de: Wird auf der dritten Displayseite des SECC angezeigt
render: |
type: pulsatrix
host: {{ .host }}

View file

@ -38,8 +38,8 @@ params:
- name: maxacpower
- name: defaultmode
help:
de: Standardmodus für die aktive Batteriesteuerung. Gültige Werte sind 0 (Eigenbedarfsmodus), 1 (Nutzungszeitmodus), 2 (Zeitmodus), 4 (Peak-shaving Modus)
en: Default mode for battery control. Valid values are 0 (self use), 1 (time of use), 2 (timing mode), 4 (peak-shaving mode)
de: Gültige Werte sind 0 (Eigenbedarfsmodus), 1 (Nutzungszeitmodus), 2 (Zeitmodus), 4 (Peak-shaving Modus)
en: Valid values are 0 (self use), 1 (time of use), 2 (timing mode), 4 (peak-shaving mode)
default: 0 # self use
advanced: true
# battery control

View file

@ -38,9 +38,6 @@ params:
default: self-consumption
required: true
advanced: true
help:
de: Standardmodus für die aktive Batteriesteuerung
en: Default mode for active battery control
usages: ["battery"]
- name: chargepower
deprecated: true

View file

@ -49,7 +49,7 @@ test.describe("battery meter", async () => {
// edit #1
await page.getByTestId("battery").getByRole("button", { name: "edit" }).click();
await expectModalVisible(meterModal);
await meterModal.getByLabel("Battery capacity (kWh)").fill("20");
await meterModal.getByLabel("Battery capacity").fill("20");
await meterModal.getByRole("button", { name: "Validate & save" }).click();
await expectModalHidden(meterModal);

View file

@ -51,9 +51,6 @@ params:
description:
de: Port
en: Port
help:
de: Port
en: Port
type: int
- name: interface
description:
@ -66,27 +63,29 @@ params:
de: Benutzerkonto
en: Username
help:
de: Benutzerkonto (bspw. E-Mail Adresse, User Id, etc.)
en: User account (e.g. email address, user id, etc.)
de: bspw. E-Mail Adresse, User Id, etc.
en: e.g. email address, user id, etc.
- name: password
description:
de: Passwort
en: Password
help:
de: Passwort des Benutzerkontos (bei führenden Nullen bitte in einfache Hochkommata setzen)
en: Password of the user account (use single quotes in case of leading zeros)
de: Bei führenden Nullen bitte in einfache Hochkommata setzen
en: Use single quotes in case of leading zeros
mask: true
- name: capacity
unit: kWh
description:
de: Akkukapazität (kWh)
en: Battery capacity (kWh)
de: Akkukapazität
en: Battery capacity
example: 50
type: float
usages: ["vehicle", "battery"]
- name: maxacpower
unit: W
description:
de: Maximale AC Leistung des Hybrid-Wechselrichters (W)
en: Maximum AC power of the hybrid inverter (W)
de: Maximale AC Leistung des Hybrid-Wechselrichters
en: Maximum AC power of the hybrid inverter
default: 0
example: 5000
type: float
@ -97,8 +96,8 @@ params:
de: Fahrzeugidentifikationsnummer
en: Vehicle Identification Number
help:
de: Erforderlich, wenn mehrere Fahrzeuge des Herstellers vorhanden sind
en: Required if you own multiple vehicles of the same brand
de: Wenn mehrere Fahrzeuge eines Herstellers vorhanden sind
en: If you own multiple vehicles from the same manufacturer
example: W...
- name: phases
description:
@ -140,36 +139,40 @@ params:
en: Possible values are Off, Now, MinPV and PV, or empty if none should be set
type: chargemodes
- name: minsoc
unit: "%"
description:
de: Minimaler Ladestand (%)
en: Minimum charge (%)
de: Minimaler Ladestand
en: Minimum charge
help:
de: Untere Grenze beim Entladen der Batterie (normaler Betrieb)
en: Lower limit when discharging the battery (normal operation)
de: Untere Grenze beim Entladen der Batterie im normalen Betrieb
en: Lower limit when discharging the battery in normal operation
example: 25
type: int
- name: maxsoc
unit: "%"
description:
de: Maximaler Ladestand (%)
en: Maximum charge (%)
de: Maximaler Ladestand
en: Maximum charge
help:
de: Oberes Limit beim Laden der Batterie aus dem Netz
en: Upper limit when charging the battery from the grid
example: 95
type: int
- name: mincurrent
unit: A
description:
de: Minimale Stromstärke in Ampere (A)
en: Minimum amperage (A)
de: Minimale Stromstärke
en: Minimum amperage
help:
de: Definiert die minimale Stromstärke pro angeschlossener Phase mit welcher das Fahrzeug geladen werden soll
en: The minimum amperage per connected phase with which the car should be charged
example: 6
type: int
- name: maxcurrent
unit: A
description:
de: Maximale Stromstärke in Ampere (A)
en: Maximum amperage (A)
de: Maximale Stromstärke
en: Maximum amperage
help:
de: Definiert die maximale Stromstärke pro angeschlossener Phase mit welcher das Fahrzeug geladen werden soll
en: The maximum amperage per connected phase with which the car shuold be charged
@ -192,9 +195,10 @@ params:
en: Priority of the loadpoint or vehicle in relation to other loadpoints or vehicles for allocating pv energy
type: int
- name: standbypower
unit: W
description:
de: Standby-Leistung (W)
en: Standby power (W)
de: Standby-Leistung
en: Standby power
help:
de: Leistung oberhalb des angegebenen Wertes wird als Ladeleistung gewertet
en: Power values above this value will be considered as charging power
@ -203,9 +207,6 @@ params:
description:
de: Sprache
en: Language
help:
de: "'de' für Deutsch und 'en' für Englisch"
en: "'en' for English and 'de' for German"
default: en
type: choice
choice: ["en", "de"]
@ -214,8 +215,8 @@ params:
de: Icon
en: Icon
help:
de: "Icon in der Benutzeroberfläche"
en: "Icon as shown in user interface"
de: Wird in der Benutzeroberfläche angezeigt
en: Will be displayed in the user interface
type: choice
choice:
- car
@ -264,8 +265,8 @@ params:
en: Subject Key Identifier (SKI)
de: Identifikationsschlüssel (SKI)
help:
en: The SKI of the wallbox, usually found on the web interface of the wallbox
de: Die SKI der Wallbox, üblicherweise im Web Interface der Wallbox zu finden
en: Usually found on the web interface of the wallbox
de: Üblicherweise im Web Interface der Wallbox zu finden
- name: uri
description:
generic: URI
@ -279,8 +280,8 @@ params:
en: Actor Identification Number (AIN)
de: Aktoridentifikationsnummer (AIN)
help:
en: The AIN is printed on the type label on the back of the device. Embed it in double quotes in case of leading zeroes.
de: Die AIN ist auf dem Typenschild auf der Geräterückseite aufgedruckt. Bei führenden Nullen bitte in doppelte Hochkommata setzen.
en: Printed on the type label on the back of the device. Embed it in double quotes in case of leading zeroes.
de: Ist auf dem Typenschild auf der Geräterückseite aufgedruckt. Bei führenden Nullen bitte in doppelte Hochkommata setzen.
- name: coarsecurrent
type: bool
help:
@ -304,27 +305,29 @@ params:
de: Standardmodus für die aktive Batteriesteuerung
en: Default mode for battery control
help:
de: Standardmodus für die aktive Batteriesteuerung auf die der Wechselrichter wieder nach einem Laden des Speichers oder Unterbinden der Entladung zurückfällt.
en: Default mode for battery control to which the inverter falls back after charging the battery or after stopping discharge.
de: Wechselrichter fällt nach einem Laden des Speichers oder Unterbinden der Entladung zurück auf diesen Modus.
en: Inverter falls back to this mode after charging the battery or after stopping discharge.
- name: maxchargepower
unit: W
type: int
usages: ["battery"]
description:
en: Maximum charge power (W)
de: Maximale Ladeleistung (W)
en: Maximum charge power
de: Maximale Ladeleistung
help:
en: Maximum charge power for forced charging of the battery in watts.
de: Maximale Ladeleistung für erzwungenes Laden des Speichers in Watt.
en: For forced charging of the battery in watts.
de: Für erzwungenes Laden des Speichers in Watt.
advanced: true
- name: maxchargerate
unit: "%"
type: int
usages: ["battery"]
description:
en: Maximum charge power (%)
de: Maximale Ladeleistung (%)
en: Maximum charge power
de: Maximale Ladeleistung
help:
en: Maximum charge power for forced charging of the battery in percent in relation to the maximum charge power of the battery inverter.
de: Maximale Leistung für erzwungenes Laden des Speichers in Prozent in Relation zur maximalen Ladeleistung des Batteriewechselrichters.
en: For forced charging of the battery in percent in relation to the maximum charge power of the battery inverter.
de: Für erzwungenes Laden des Speichers in Prozent in Relation zur maximalen Ladeleistung des Batteriewechselrichters.
default: 100
advanced: true
@ -389,17 +392,26 @@ presets:
- name: charges
type: int
advanced: true
description:
en: Charge
de: Aufschlag
help:
de: Zusätzlicher fester Aufschlag pro kWh (z.B. 0.05 für 5 Cent)
en: Additional fixed charge per kWh (e.g. 0.05 for 5 cents)
- name: tax
type: int
advanced: true
description:
en: Tax
de: Steuer
help:
de: Zusätzlicher prozentualer Aufschlag (z.B. 0.2 für 20%)
en: Additional percentage charge (e.g. 0.2 for 20%)
- name: formula
type: string
description:
en: Formula
de: Formel
advanced: true
help:
de: Individuelle Formel zur Berechnung des Preises
@ -433,8 +445,9 @@ presets:
required: true
- name: kwp
description:
en: Maximum generator power [kWp]
de: Maximale Generatorleistung [kWp]
en: Maximum generator power
de: Maximale Generatorleistung
unit: kWp
type: float
example: 9.8
required: true
@ -442,9 +455,6 @@ presets:
eebus:
params:
- name: ski
help:
de: SKI (Subject Key Identifier)
en: SKI (Subject Key Identifier)
- name: ip
switchsocket:
params:
@ -453,29 +463,41 @@ presets:
- name: integrateddevice
type: bool
advanced: true
description:
en: Integrated device
de: Integriertes Gerät
help:
de: Integriertes Gerät (keine Fahrzeugverbindung)
en: Integrated device (no vehicle connection)
de: Fest angeschlossenes Gerät. Keine Ladevorgänge
en: Integrated device. No charging sessions
- name: heating
type: bool
advanced: true
description:
en: Heating device
de: Wärmeerzeuger
help:
de: Wärmeerzeuger (°C anstatt %)
en: Heating device (°C instead of %)
de: Zeigt °C anstatt % an
en: Shows °C instead of %
- name: icon
advanced: true
ocpp:
params:
- name: stationid
type: string
description:
en: Station ID
de: Station ID
help:
en: "Station ID of the charging point. Only required if multiple OCPP charging stations are set up to assign them correctly. A single OCPP charging station can also be automatically assigned. Note: In exceptional cases, it may be necessary to manually append this ID to the OCPP URL of the charging station in the form ws://<evcc-address>:8887/<stationid>. Most charging stations automatically add the ID internally."
de: "Station ID des Ladepunktes. Nur erforderlich wenn mehrere OCPP-Ladestationen eingerichtet sind um diese korrekt zuzuweisen. Eine einzelne OCPP-Ladestation kann auch automatisch zugeordnet werden. Hinweis: In Ausnahmefällen kann es erforderlich sein, diese ID manuell an die OCPP-URL der Ladestation in der Form ws://<evcc-adresse>:8887/<stationid> anzuhängen. Die meisten Ladestationen fügen die ID intern automatisch hinzu."
example: EVB-P12354
- name: connector
description:
en: Connector number
de: Anschlussnummer
help:
de: Anschlussnummer bei Ladestationen mit mehreren Anschlüssen. Die Zählung beginnt bei 1 für den ersten Anschluss.
en: Connector number for charging stations with multiple connectors. Counting starts at 1 for the first connector.
de: Bei Ladestationen mit mehreren Anschlüssen. Die Zählung beginnt bei 1 für den ersten Anschluss.
en: For charging stations with multiple connectors. Counting starts at 1 for the first connector.
default: 1
- name: remotestart
advanced: true

View file

@ -3,14 +3,20 @@
{{- range .Values }}
- {{ . }}
{{- end }}
{{- $unit := .Unit -}}
{{- $description := localize .Description | replace "\n" " " -}}
{{- $help := localize .Help | replace "\n" " " -}}
{{- $choices := join ", " .Choice -}}
{{- $optional := not .IsRequired -}}
{{- if or $help $choices $optional }} # {{end}}
{{- if or $help $choices $optional $description }} # {{end}}
{{- if $description }}{{ $description }}
{{- if $unit }} ({{ $unit }}){{- end }}
{{- if or $help $choices $optional }}, {{end}}
{{- end}}
{{- if $help }}{{ $help }} {{end}}
{{- if $choices }}[{{ $choices }}] {{end}}
{{- if $optional }}
{{- if or $help $choices }}(optional){{ else }}optional{{end }}
{{- if or $help $choices }}(optional){{ else }}optional{{end }}
{{- end }}
{{- end }}

View file

@ -186,6 +186,7 @@ type Param struct {
Example string `json:",omitempty"` // cli example value
Value string `json:"-"` // user provided value via cli configuration
Values []string `json:",omitempty"` // user provided list of values e.g. for Type "list"
Unit string `json:",omitempty"` // unit of the value, e.g. "kW", "kWh", "A", "V"
Usages []string `json:",omitempty"` // restrict param to these usage types, e.g. "battery" for home battery capacity
Type ParamType // string representation of the value type, "string" is default
Choice []string `json:",omitempty"` // defines a set of choices, e.g. "grid", "pv", "battery", "charge" for "usage"