evcc-io/hems/config.go
thecem 4f943650b2
Hems/FNN: add curtail and dim for TAB26 Steuerbox relay standard (#29886)
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: andig <cpuidle@gmail.com>
Co-authored-by: andig <andi@evcc.io>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-28 12:05:10 +02:00

29 lines
918 B
Go

package hems
import (
"context"
"errors"
"strings"
"github.com/evcc-io/evcc/core/site"
"github.com/evcc-io/evcc/hems/eebus"
"github.com/evcc-io/evcc/hems/fnn"
"github.com/evcc-io/evcc/hems/hems"
"github.com/evcc-io/evcc/hems/relay"
)
// NewFromConfig creates new HEMS from config
func NewFromConfig(ctx context.Context, typ string, other map[string]any, site site.API) (hems.API, error) {
switch strings.ToLower(typ) {
case "sma", "shm", "semp":
return nil, errors.New("breaking change: Sunny Home Manager integration is always on. See https://github.com/evcc-io/evcc/releases and https://docs.evcc.io/en/docs/integrations/sma-sunny-home-manager")
case "eebus":
return eebus.NewFromConfig(ctx, other, site)
case "fnn", "fnn-3":
return fnn.NewFromConfig(ctx, other, site)
case "relay":
return relay.NewFromConfig(ctx, other, site)
default:
return nil, errors.New("unknown hems: " + typ)
}
}