Skip to content

UI: add unit property #21396

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
May 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion assets/js/components/Config/PropertyEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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"
/>
Expand All @@ -37,6 +38,7 @@ export default {
Help: String,
Example: String,
Type: String,
Unit: String,
Mask: Boolean,
Choice: Array,
modelValue: [String, Number, Boolean, Object],
Expand Down
3 changes: 0 additions & 3 deletions assets/js/components/Config/PropertyField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,6 @@ export default {
if (this.unit) {
return this.unit;
}
if (this.property === "capacity") {
return "kWh";
}
return null;
},
icons() {
Expand Down
4 changes: 4 additions & 0 deletions cmd/configure/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 6 additions & 1 deletion cmd/configure/survey.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions templates/definition/charger/pulsatrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
4 changes: 2 additions & 2 deletions templates/definition/meter/sofarsolar-g3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions templates/definition/meter/sonnenbatterie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/config-battery.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Loading
Loading