evcc-io/tariff/fixed.go
2022-01-02 22:58:13 +01:00

30 lines
474 B
Go

package tariff
import (
"github.com/evcc-io/evcc/api"
"github.com/evcc-io/evcc/util"
)
type Fixed struct {
Price float64
}
var _ api.Tariff = (*Fixed)(nil)
func NewFixed(other map[string]interface{}) (*Fixed, error) {
cc := Fixed{}
if err := util.DecodeOther(other, &cc); err != nil {
return nil, err
}
return &cc, nil
}
func (t *Fixed) CurrentPrice() (float64, error) {
return t.Price, nil
}
func (t *Fixed) IsCheap() (bool, error) {
return false, nil
}