From 768656e0c3182af611bbe58716b239a7ed382a12 Mon Sep 17 00:00:00 2001 From: Maschga <88616799+Maschga@users.noreply.github.com> Date: Sun, 1 Feb 2026 11:59:02 +0100 Subject: [PATCH] EEBUS: configure by default (#26944) --- api/globalconfig/types.go | 28 ++-- assets/js/components/Config/DeviceCard.vue | 13 +- assets/js/components/Config/EebusModal.vue | 147 ++++++++++++++++-- assets/js/components/Config/HemsModal.vue | 2 +- assets/js/components/Config/JsonModal.vue | 12 +- .../components/Config/PropertyCertField.vue | 3 +- assets/js/components/Config/PropertyField.vue | 4 +- .../components/Config/defaultYaml/eebus.yaml | 12 -- assets/js/types/evcc.ts | 25 ++- assets/js/views/Config.vue | 109 +++++-------- cmd/helper.go | 16 ++ cmd/helper_test.go | 34 ++++ cmd/root.go | 34 ++-- cmd/setup.go | 46 ++---- i18n/bg.json | 7 +- i18n/bs.json | 5 +- i18n/cs.json | 7 +- i18n/da.json | 7 +- i18n/de.json | 26 +++- i18n/el.json | 7 +- i18n/en.json | 26 +++- i18n/es.json | 7 +- i18n/fi.json | 7 +- i18n/fr.json | 7 +- i18n/hr.json | 7 +- i18n/hu.json | 7 +- i18n/it.json | 7 +- i18n/lb.json | 7 +- i18n/lt.json | 7 +- i18n/nl.json | 7 +- i18n/no.json | 7 +- i18n/pl.json | 7 +- i18n/pt.json | 7 +- i18n/ro.json | 7 +- i18n/ru.json | 7 +- i18n/sl.json | 7 +- i18n/sv.json | 7 +- i18n/ta.json | 4 +- i18n/tr.json | 7 +- i18n/uk.json | 7 +- i18n/zh-Hans.json | 4 +- server/eebus/eebus.go | 44 ++---- server/eebus/test/cs_test.go | 5 +- server/eebus/types.go | 73 ++++++++- server/http.go | 2 +- server/http_config_site_other_handler.go | 15 +- server/http_global_settings_handler.go | 15 +- tests/config-eebus.evcc.yaml | 27 ++++ tests/config-eebus.spec.ts | 137 ++++++++++++++++ tests/config-ocpp.spec.ts | 2 - util/redact.go | 8 + util/sponsor/auth.go | 4 +- 52 files changed, 712 insertions(+), 324 deletions(-) delete mode 100644 assets/js/components/Config/defaultYaml/eebus.yaml create mode 100644 cmd/helper_test.go create mode 100644 tests/config-eebus.evcc.yaml create mode 100644 tests/config-eebus.spec.ts create mode 100644 util/redact.go diff --git a/api/globalconfig/types.go b/api/globalconfig/types.go index 3756f2f8c..4925bae63 100644 --- a/api/globalconfig/types.go +++ b/api/globalconfig/types.go @@ -18,6 +18,13 @@ import ( "github.com/evcc-io/evcc/util/modbus" ) +// ConfigStatus for publishing config, status and source to UI and external systems +type ConfigStatus struct { + Config any `json:"config,omitempty"` + Status any `json:"status,omitempty"` + FromYaml bool `json:"fromYaml,omitempty"` +} + type All struct { Network Network Ocpp ocpp.Config @@ -79,13 +86,6 @@ func (c Hems) Redacted() any { var _ api.Redactor = (*Mqtt)(nil) -func masked(s any) string { - if s != "" { - return "***" - } - return "" -} - type Mqtt struct { mqtt.Config `mapstructure:",squash"` Topic string `json:"topic"` @@ -97,12 +97,12 @@ func (m Mqtt) Redacted() any { Config: mqtt.Config{ Broker: m.Broker, User: m.User, - Password: masked(m.Password), + Password: util.Masked(m.Password), ClientID: m.ClientID, Insecure: m.Insecure, - CaCert: masked(m.CaCert), - ClientCert: masked(m.ClientCert), - ClientKey: masked(m.ClientKey), + CaCert: util.Masked(m.CaCert), + ClientCert: util.Masked(m.ClientCert), + ClientKey: util.Masked(m.ClientKey), }, Topic: m.Topic, } @@ -124,10 +124,10 @@ func (c Influx) Redacted() any { return Influx{ URL: c.URL, Database: c.Database, - Token: masked(c.Token), + Token: util.Masked(c.Token), Org: c.Org, User: c.User, - Password: masked(c.Password), + Password: util.Masked(c.Password), Insecure: c.Insecure, } } @@ -147,7 +147,7 @@ type MessagingEventTemplate struct { Title, Msg string } -func (c Messaging) Configured() bool { +func (c Messaging) IsConfigured() bool { return len(c.Services) > 0 || len(c.Events) > 0 } diff --git a/assets/js/components/Config/DeviceCard.vue b/assets/js/components/Config/DeviceCard.vue index 5c8eddbf4..aa8c030a8 100644 --- a/assets/js/components/Config/DeviceCard.vue +++ b/assets/js/components/Config/DeviceCard.vue @@ -6,9 +6,10 @@ 'round-box--error': error, 'round-box--warning': warning, 'root--unconfigured': unconfigured, + 'root--with-tags': $slots.tags, }" > -
+
@@ -33,8 +34,10 @@
-
- +
+
+ +
@@ -67,7 +70,7 @@ export default { } let title = `${this.$t("config.main.name")}: ${this.name}`; if (!this.editable) { - title += `
${this.$t("config.main.yaml")}
`; + title += `
${this.$t("config.general.fromYamlHint")}
`; } return `
${title}
`; }, @@ -105,6 +108,8 @@ export default { list-style-type: none; border-radius: 1rem; padding: 1rem 1.5rem; +} +.root--with-tags { min-height: 8rem; } .root--unconfigured { diff --git a/assets/js/components/Config/EebusModal.vue b/assets/js/components/Config/EebusModal.vue index d4e499669..ff7c48df5 100644 --- a/assets/js/components/Config/EebusModal.vue +++ b/assets/js/components/Config/EebusModal.vue @@ -1,26 +1,153 @@ - diff --git a/assets/js/components/Config/HemsModal.vue b/assets/js/components/Config/HemsModal.vue index cd293ef25..cab449f58 100644 --- a/assets/js/components/Config/HemsModal.vue +++ b/assets/js/components/Config/HemsModal.vue @@ -31,7 +31,7 @@

- {{ $t("config.hems.yamlConfigured") }} + {{ $t("config.general.fromYamlHint") }}

diff --git a/assets/js/components/Config/JsonModal.vue b/assets/js/components/Config/JsonModal.vue index e3338bf55..010028e01 100644 --- a/assets/js/components/Config/JsonModal.vue +++ b/assets/js/components/Config/JsonModal.vue @@ -88,6 +88,7 @@ export default { saveMethod: { type: String, default: "post" }, storeValuesInArray: Boolean, size: { type: String }, + confirmRemove: String, }, emits: ["changed", "open"], data() { @@ -121,7 +122,13 @@ export default { await this.load(); }, async load() { - this.serverValues = this.stateKey ? store.state[this.stateKey] : store.state; + if (this.stateKey) { + // Support nested keys like "eebus.config" + const keys = this.stateKey.split("."); + this.serverValues = keys.reduce((obj, key) => obj?.[key], store.state); + } else { + this.serverValues = store.state; + } if (this.transformReadValues) { this.serverValues = this.transformReadValues(this.serverValues); } @@ -155,6 +162,9 @@ export default { this.saving = false; }, async remove() { + if (this.confirmRemove && !window.confirm(this.confirmRemove)) { + return; + } this.removing = true; this.error = ""; try { diff --git a/assets/js/components/Config/PropertyCertField.vue b/assets/js/components/Config/PropertyCertField.vue index c71722301..df64a242d 100644 --- a/assets/js/components/Config/PropertyCertField.vue +++ b/assets/js/components/Config/PropertyCertField.vue @@ -1,6 +1,6 @@