From 0493978874efae31734f1b7789188e63cd015625 Mon Sep 17 00:00:00 2001 From: andig Date: Mon, 17 Jul 2023 21:46:08 +0200 Subject: [PATCH] Tibber: use energy instead of total as base if charges or taxes are defined (#9000) --- tariff/tibber.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tariff/tibber.go b/tariff/tibber.go index 80a395e11..16faebed6 100644 --- a/tariff/tibber.go +++ b/tariff/tibber.go @@ -116,10 +116,14 @@ func (t *Tibber) run(done chan error) { func (t *Tibber) rates(pi []tibber.Price) api.Rates { data := make(api.Rates, 0, len(pi)) for _, r := range pi { + price := r.Total + if t.Charges != 0 || t.Tax != 0 { + price = t.totalPrice(r.Energy) + } ar := api.Rate{ Start: r.StartsAt.Local(), End: r.StartsAt.Add(time.Hour).Local(), - Price: t.totalPrice(r.Total), + Price: price, } data = append(data, ar) }