Tibber: use energy instead of total as base if charges or taxes are defined (#9000)
This commit is contained in:
parent
66b32d83f8
commit
0493978874
1 changed files with 5 additions and 1 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue