Loadpoint: fix config error for disabled loadpoints (#32880)
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: andig <cpuidle@gmail.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: Michael Geers <michael@geers.tv>
This commit is contained in:
parent
47fd73be33
commit
64d48e5800
3 changed files with 21 additions and 2 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue