Skip to content

numerischer Charger Status #749

Answered by andig
pfandfrei asked this question in Allgemein
Mar 12, 2021 · 6 comments · 16 replies
Discussion options

You must be logged in to vote

Wenn Du magst, kannst Du die calc.go mal ersetzen:

package provider

import (
	"fmt"

	"github.com/andig/evcc/util"
)

type calcProvider struct {
	add []func() (float64, error)
}

func init() {
	registry.Add("calc", NewCalcFromConfig)
}

// NewCalcFromConfig creates calc provider
func NewCalcFromConfig(other map[string]interface{}) (IntProvider, error) {
	cc := struct {
		Add []Config
	}{}

	if err := util.DecodeOther(other, &cc); err != nil {
		return nil, err
	}

	o := &calcProvider{}

	for idx, cc := range cc.Add {
		f, err := NewFloatGetterFromConfig(cc)
		if err != nil {
			return nil, fmt.Errorf("add[%d]: %w", idx, err)
		}
		o.add = append(o.add, f)
	}

	return o, nil
}

func (o *c…

Replies: 6 comments 16 replies

Comment options

You must be logged in to vote
3 replies
@pfandfrei
Comment options

@andig
Comment options

@andig
Comment options

Comment options

You must be logged in to vote
3 replies
@pfandfrei
Comment options

@premultiply
Comment options

@andig
Comment options

Comment options

You must be logged in to vote
4 replies
@pfandfrei
Comment options

@andig
Comment options

@andig
Comment options

@pfandfrei
Comment options

Answer selected by pfandfrei
Comment options

You must be logged in to vote
5 replies
@andig
Comment options

@L-Online
Comment options

@pfandfrei
Comment options

@L-Online
Comment options

@pfandfrei
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@L-Online
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants