Tibber: use energy instead of total as base if charges or taxes are defined (#9000)

This commit is contained in:
andig 2023-07-17 21:46:08 +02:00 • committed by GitHub
parent 66b32d83f8
commit 0493978874
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)
}