Config UI: add circuit meter options (#23174)

This commit is contained in:
Michael Geers 2025-08-23 11:06:27 +02:00 • committed by GitHub
parent 4fe6749885
commit 2912067cb1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 49 additions and 5 deletions

View file

@ -9,19 +9,56 @@
endpoint="/config/circuits"
data-testid="circuits-modal"
@changed="$emit('changed')"
/>
>
<template #extra>
<p class="my-2 small">
{{ $t("config.circuits.usableMeters") }}:
<code v-for="meter in usableMeters" :key="meter.name" class="ms-1 meter">
{{ meter.name }}<span v-if="meter.title" class="ms-1">({{ meter.title }})</span>
</code>
</p>
</template>
</YamlModal>
</template>
<script>
<script lang="ts">
import YamlModal from "./YamlModal.vue";
import defaultYaml from "./defaultYaml/circuits.yaml?raw";
import type { ConfigMeter } from "@/types/evcc";
import type { PropType } from "vue";
export default {
name: "CircuitsModal",
components: { YamlModal },
props: {
gridMeter: { type: Object as PropType<ConfigMeter>, default: null },
extMeters: { type: Array as PropType<ConfigMeter[]>, default: () => [] },
},
emits: ["changed"],
data() {
return { defaultYaml: defaultYaml.trim() };
},
computed: {
usableMeters() {
const result = [];
if (this.gridMeter) {
result.push({ name: this.gridMeter.name, title: this.$t("config.grid.title") });
}
if (this.extMeters) {
result.push(
...this.extMeters.map((m) => ({
name: m.name,
title: m.deviceTitle || m.deviceProduct || m.config["template"] || m.type,
}))
);
}
return result;
},
},
};
</script>
<style scoped>
.meter:not(:last-child)::after {
content: ",";
}
</style>

View file

@ -16,6 +16,7 @@
:hidden="!modalVisible"
/>
</div>
<slot name="extra" />
<div class="mt-4 d-flex justify-content-between">
<button

View file

@ -375,7 +375,11 @@
<MessagingModal @changed="yamlChanged" />
<TariffsModal @changed="yamlChanged" />
<ModbusProxyModal @changed="yamlChanged" />
<CircuitsModal @changed="yamlChanged" />
<CircuitsModal
:gridMeter="gridMeter"
:extMeters="extMeters"
@changed="yamlChanged"
/>
<EebusModal @changed="yamlChanged" />
<BackupRestoreModal v-bind="backupRestoreProps" />
<PasswordModal update-mode />

View file

@ -65,7 +65,8 @@
},
"circuits": {
"description": "Stellt sicher, dass die Summe aller Ladepunkte, die an einen Stromkreis angeschlossen sind, die konfigurierten Leistungs- und Stromgrenzen nicht überschreitet. Stromkreise können verschachtelt werden, um eine Hierarchie aufzubauen.",
"title": "Lastmanagement"
"title": "Lastmanagement",
"usableMeters": "Verwendbare Zählerreferenzen"
},
"control": {
"description": "Normalerweise sind die Standardwerte in Ordnung. Ändere nur etwas, wenn du weißt, was du tust.",

View file

@ -65,7 +65,8 @@
},
"circuits": {
"description": "Ensures, that the sum of all loadpoints connected to a circuit does not exceed the configured power and current limits. Circuits can be nested to build a hierarchy.",
"title": "Load Management"
"title": "Load Management",
"usableMeters": "Usable meter references"
},
"control": {
"description": "Usually the default values are fine. Only change them if you know what you are doing.",