Tariff: set default currency
Some checks failed
Release / call-build-workflow (push) Has been cancelled
Release / Publish Docker :release (push) Has been cancelled
Release / Github & APT (push) Has been cancelled
Release / Demo (push) Has been cancelled
Release / Hassio Addon (push) Has been cancelled

This commit is contained in:
andig 2023-05-18 13:39:09 +02:00
parent 21aac8538c
commit ad250f6d3d
2 changed files with 5 additions and 6 deletions

View file

@ -34,7 +34,8 @@ func NewAwattarFromConfig(other map[string]interface{}) (api.Tariff, error) {
Currency string
Region string
}{
Region: "DE",
Currency: "EUR",
Region: "DE",
}
if err := util.DecodeOther(other, &cc); err != nil {

View file

@ -25,23 +25,21 @@ func init() {
}
func NewFixedFromConfig(other map[string]interface{}) (api.Tariff, error) {
var cc struct {
cc := struct {
Currency string
Price float64
Zones []struct {
Price float64
Days, Hours string
}
}{
Currency: "EUR",
}
if err := util.DecodeOther(other, &cc); err != nil {
return nil, err
}
if cc.Currency == "" {
cc.Currency = "EUR"
}
t := &Fixed{
unit: cc.Currency,
clock: clock.New(),