From 1e96e693298296962cb550450a94f36308b4f855 Mon Sep 17 00:00:00 2001 From: andig Date: Tue, 11 Jul 2023 20:40:01 +0200 Subject: [PATCH] Tibber: add configurable charges and taxes (#8923) --- tariff/tibber.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tariff/tibber.go b/tariff/tibber.go index 6f991d5dcb..80a395e112 100644 --- a/tariff/tibber.go +++ b/tariff/tibber.go @@ -15,6 +15,7 @@ import ( ) type Tibber struct { + *embed mux sync.Mutex log *util.Logger homeID string @@ -31,6 +32,7 @@ func init() { func NewTibberFromConfig(other map[string]interface{}) (api.Tariff, error) { var cc struct { + embed `mapstructure:",squash"` Token string HomeID string Unit string @@ -47,6 +49,7 @@ func NewTibberFromConfig(other map[string]interface{}) (api.Tariff, error) { log := util.NewLogger("tibber").Redact(cc.Token, cc.HomeID) t := &Tibber{ + embed: &cc.embed, log: log, homeID: cc.HomeID, client: tibber.NewClient(log, cc.Token), @@ -116,7 +119,7 @@ func (t *Tibber) rates(pi []tibber.Price) api.Rates { ar := api.Rate{ Start: r.StartsAt.Local(), End: r.StartsAt.Add(time.Hour).Local(), - Price: r.Total, + Price: t.totalPrice(r.Total), } data = append(data, ar) }