SGready: fix panic

This commit is contained in:
andig 2026-03-16 18:01:33 +01:00
parent db1870021d
commit d0a0dc52d1

View file

@ -73,14 +73,14 @@ func NewSgReadyFromConfig(ctx context.Context, other map[string]any) (api.Charge
return nil, err
}
modeS, err := cc.SetMode.IntSetter(ctx, "mode")
modeSet, err := cc.SetMode.IntSetter(ctx, "mode")
if err != nil {
return nil, err
}
log := util.ContextLoggerWithDefault(ctx, util.NewLogger("sgready"))
modeS = func(mode int64) error {
modeS := func(mode int64) error {
switch mode {
case Dim:
log.DEBUG.Printf("set sgready mode: %s", "dim")
@ -89,7 +89,7 @@ func NewSgReadyFromConfig(ctx context.Context, other map[string]any) (api.Charge
case Boost:
log.DEBUG.Printf("set sgready mode: %s", "boost")
}
return modeS(mode)
return modeSet(mode)
}
modeG, err := cc.GetMode.IntGetter(ctx)