Skip to content

Commit

Permalink
Tibber: add configurable charges and taxes (#8923)
Browse files Browse the repository at this point in the history
  • Loading branch information
andig authored Jul 11, 2023
1 parent 850c093 commit 1e96e69
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tariff/tibber.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
)

type Tibber struct {
*embed
mux sync.Mutex
log *util.Logger
homeID string
Expand All @@ -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
Expand All @@ -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),
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 1e96e69

Please sign in to comment.