From 64d48e58005f67211319db140883c254b1eb2323 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 17 Aug 2026 07:30:49 +0000 Subject: [PATCH] Loadpoint: fix config error for disabled loadpoints (#32880) Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: andig Co-authored-by: Claude Opus 5 (1M context) Co-authored-by: Michael Geers --- server/http_config_loadpoint_handler.go | 4 +++- server/http_config_loadpoint_handler_test.go | 1 + tests/config-disable.spec.ts | 18 +++++++++++++++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/server/http_config_loadpoint_handler.go b/server/http_config_loadpoint_handler.go index 23f875c48..c30359536 100644 --- a/server/http_config_loadpoint_handler.go +++ b/server/http_config_loadpoint_handler.go @@ -13,6 +13,7 @@ import ( "github.com/evcc-io/evcc/util" "github.com/evcc-io/evcc/util/config" "github.com/evcc-io/evcc/util/templates" + "github.com/go-viper/mapstructure/v2" "github.com/gorilla/mux" ) @@ -119,8 +120,9 @@ func loadpointConfig(dev config.Device[loadpoint.API]) (loadpointFullConfig, err return loadpointFullConfig{}, err } + // non-strict: runtime settings (mode, ...) are persisted alongside the config var static loadpoint.StaticConfig - if err := util.DecodeOther(staticMap, &static); err != nil { + if err := mapstructure.Decode(staticMap, &static); err != nil { return loadpointFullConfig{}, err } diff --git a/server/http_config_loadpoint_handler_test.go b/server/http_config_loadpoint_handler_test.go index e9ddf4a49..a8050bd62 100644 --- a/server/http_config_loadpoint_handler_test.go +++ b/server/http_config_loadpoint_handler_test.go @@ -25,6 +25,7 @@ func TestLoadpointConfigDisabledNilInstance(t *testing.T) { "charger": "wallbox", "meter": "lp-meter", "title": "Garage", + "mode": "pv", // runtime setting persisted by the settings adapter }, } diff --git a/tests/config-disable.spec.ts b/tests/config-disable.spec.ts index 4d94087ed..744bb07e7 100644 --- a/tests/config-disable.spec.ts +++ b/tests/config-disable.spec.ts @@ -59,6 +59,21 @@ test.describe("disable / enable", async () => { await page.reload(); await createLoadpoint(page, "Garage"); + // restart to bring both loadpoints live + await restart(); + await page.reload(); + + // switch charge mode on dashboard; runtime setting is persisted next to the loadpoint config + await page.goto("/"); + const modeButton = page + .getByTestId("loadpoint") + .nth(0) + .getByTestId("mode") + .getByRole("button", { name: "Fast" }); + await modeButton.click(); + await expect(modeButton).toHaveClass(/active/); + await page.goto("/#/config"); + const target = page.getByTestId("loadpoint").nth(0); await toggleLoadpointDisable(page, 0, "Disable"); @@ -66,10 +81,11 @@ test.describe("disable / enable", async () => { // card shows disabled state await expect(disabledBadge(target)).toBeVisible(); - // restart, no fatal + // restart, no fatal, both loadpoints still listed await restart(); await page.reload(); await expectNoFatal(page); + await expect(page.getByTestId("loadpoint")).toHaveCount(2); await expect(disabledBadge(target)).toBeVisible(); // re-enable by clicking the disabled card