Config UI: fix editing custom device with type override (#29379)

This commit is contained in:
Michael Geers 2026-04-27 20:01:27 +02:00 • committed by GitHub
parent 23c46dd311
commit e711ccaa86
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 61 additions and 40 deletions

View file

@ -222,7 +222,7 @@ NEXT:
}
}
typ, other, err := customDevice(cc.Type, cc.Other)
typ, other, err := config.CustomDevice(cc.Type, cc.Other)
if err != nil {
return fmt.Errorf("cannot decode custom circuit '%s': %w", cc.Name, err)
}
@ -327,7 +327,7 @@ func configurableInstance[T any](typ string, conf *config.Config, newFromConf ne
cc := conf.Named()
ctx, cancel := context.WithCancel(util.WithLogger(context.TODO(), loggerForConfig(conf))) //nolint:govet
typ, other, err := customDevice(cc.Type, cc.Other)
typ, other, err := config.CustomDevice(cc.Type, cc.Other)
if err != nil {
err = &DeviceError{cc.Name, fmt.Errorf("cannot decode custom %s '%s': %w", typ, cc.Name, err)}
}
@ -443,7 +443,7 @@ func configureChargers(static []config.Named, names ...string) error {
func vehicleInstance(cc config.Named) (api.Vehicle, error) {
ctx := util.WithLogger(context.TODO(), util.NewLogger(cc.Name))
typ, other, err := customDevice(cc.Type, cc.Other)
typ, other, err := config.CustomDevice(cc.Type, cc.Other)
var instance api.Vehicle
if err == nil {
@ -791,7 +791,7 @@ func configureHEMS(conf *globalconfig.Hems, site *core.Site) (hemsapi.API, error
return nil, nil
}
typ, other, err := customDevice(conf.Type, conf.Other)
typ, other, err := config.CustomDevice(conf.Type, conf.Other)
if err != nil {
return nil, fmt.Errorf("cannot decode custom hems '%s': %w", conf.Type, err)
}
@ -968,7 +968,7 @@ func configureMessengers(confMessaging *globalconfig.Messaging, confEvents *glob
func tariffInstance(name string, conf config.Typed) (api.Tariff, error) {
ctx := util.WithLogger(context.TODO(), util.NewLogger(name))
typ, other, err := customDevice(conf.Type, conf.Other)
typ, other, err := config.CustomDevice(conf.Type, conf.Other)
if err != nil {
return nil, fmt.Errorf("cannot decode custom tariff '%s': %w", name, err)
}