Tariffs: remove unused units (#8723)
This commit is contained in:
parent
e04b1e28bc
commit
78a5c44f71
4 changed files with 2 additions and 15 deletions
|
|
@ -18,7 +18,6 @@ type Awattar struct {
|
|||
mux sync.Mutex
|
||||
log *util.Logger
|
||||
uri string
|
||||
unit string
|
||||
data api.Rates
|
||||
updated time.Time
|
||||
}
|
||||
|
|
@ -49,7 +48,6 @@ func NewAwattarFromConfig(other map[string]interface{}) (api.Tariff, error) {
|
|||
t := &Awattar{
|
||||
embed: &cc.embed,
|
||||
log: util.NewLogger("awattar"),
|
||||
unit: cc.Currency,
|
||||
uri: fmt.Sprintf(awattar.RegionURI, strings.ToLower(cc.Region)),
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ type Elering struct {
|
|||
*embed
|
||||
mux sync.Mutex
|
||||
log *util.Logger
|
||||
unit string
|
||||
region string
|
||||
data api.Rates
|
||||
updated time.Time
|
||||
|
|
@ -49,7 +48,6 @@ func NewEleringFromConfig(other map[string]interface{}) (api.Tariff, error) {
|
|||
t := &Elering{
|
||||
embed: &cc.embed,
|
||||
log: util.NewLogger("Elering"),
|
||||
unit: cc.Currency,
|
||||
region: strings.ToLower(cc.Region),
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ import (
|
|||
)
|
||||
|
||||
type Fixed struct {
|
||||
unit string
|
||||
clock clock.Clock
|
||||
zones fixed.Zones
|
||||
dynamic bool
|
||||
|
|
@ -39,7 +38,6 @@ func NewFixedFromConfig(other map[string]interface{}) (api.Tariff, error) {
|
|||
}
|
||||
|
||||
t := &Fixed{
|
||||
unit: cc.Currency,
|
||||
clock: clock.New(),
|
||||
dynamic: len(cc.Zones) > 1,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ type Tibber struct {
|
|||
mux sync.Mutex
|
||||
log *util.Logger
|
||||
homeID string
|
||||
unit string
|
||||
client *tibber.Client
|
||||
data api.Rates
|
||||
updated time.Time
|
||||
|
|
@ -50,22 +49,16 @@ func NewTibberFromConfig(other map[string]interface{}) (api.Tariff, error) {
|
|||
t := &Tibber{
|
||||
log: log,
|
||||
homeID: cc.HomeID,
|
||||
unit: cc.Unit,
|
||||
client: tibber.NewClient(log, cc.Token),
|
||||
}
|
||||
|
||||
if t.homeID == "" || t.unit == "" {
|
||||
if t.homeID == "" {
|
||||
home, err := t.client.DefaultHome(t.homeID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if t.homeID == "" {
|
||||
t.homeID = home.ID
|
||||
}
|
||||
if t.unit == "" {
|
||||
t.unit = home.CurrentSubscription.PriceInfo.Current.Currency
|
||||
}
|
||||
t.homeID = home.ID
|
||||
}
|
||||
|
||||
done := make(chan error)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue