Some checks failed
Build / Build (push) Failing after 6m48s
Build / Build UI (push) Failing after 1m29s
Validate Schema / build (push) Failing after 3s
Build / Publish :latest (push) Has been skipped
Build / Publish :release (push) Has been skipped
Build / Release (push) Has been skipped
24 lines
452 B
Go
24 lines
452 B
Go
package tariff
|
|
|
|
import (
|
|
"errors"
|
|
"strings"
|
|
|
|
"github.com/andig/evcc/api"
|
|
)
|
|
|
|
// NewFromConfig creates new HEMS from config
|
|
func NewFromConfig(typ string, other map[string]interface{}) (t api.Tariff, err error) {
|
|
switch strings.ToLower(typ) {
|
|
case "fixed":
|
|
t, err = NewFixed(other)
|
|
case "awattar":
|
|
t, err = NewAwattar(other)
|
|
case "tibber":
|
|
t, err = NewTibber(other)
|
|
default:
|
|
return nil, errors.New("unknown tariff: " + typ)
|
|
}
|
|
|
|
return
|
|
}
|