Ctrl K
ComunidadGuías…

hems/config.go

Rama master · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
package hems

import (
	"context"
	"errors"
	"strings"

	"github.com/evcc-io/evcc/core/site"
	"github.com/evcc-io/evcc/hems/config"
	_ "github.com/evcc-io/evcc/hems/custom"
	_ "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"
)

var registry = config.Registry

// Types returns the list of types
func Types() []string {
	return registry.Types()
}

// NewFromConfig creates hems from configuration
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")
	default:
		return config.NewFromConfig(ctx, typ, other, site)
	}
}