Ctrl K
ComunidadGuías…

tariff/template.go

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

Archivo original ↗Preguntar a KiBot
package tariff

import (
	"context"

	"github.com/evcc-io/evcc/api"
	"github.com/evcc-io/evcc/util/templates"
)

func init() {
	registry.AddCtx("template", NewFromTemplateConfig)
}

func NewFromTemplateConfig(ctx context.Context, other map[string]any) (api.Tariff, error) {
	instance, err := templates.RenderInstance(templates.Tariff, other)
	if err != nil {
		return nil, err
	}

	return NewProxyFromConfig(ctx, instance.Type, instance.Other)
}