evcc-io/hems/template.go
andig 06f6eb1d26
HEMS: add templates (#25832)
Co-authored-by: Michael Geers <michael@geers.tv>
Co-authored-by: premultiply <4681172+premultiply@users.noreply.github.com>
2026-06-27 14:32:13 +02:00

22 lines
507 B
Go

package hems
import (
"context"
"github.com/evcc-io/evcc/core/site"
"github.com/evcc-io/evcc/hems/hems"
"github.com/evcc-io/evcc/util/templates"
)
func init() {
registry.AddCtx("template", NewHemsFromTemplateConfig)
}
func NewHemsFromTemplateConfig(ctx context.Context, other map[string]any, site site.API) (hems.API, error) {
instance, err := templates.RenderInstance(templates.Hems, other)
if err != nil {
return nil, err
}
return NewFromConfig(ctx, instance.Type, instance.Other, site)
}