From a2c5fc0217be75c0436a2cb15871b6f1e9a823a5 Mon Sep 17 00:00:00 2001 From: andig Date: Thu, 26 Aug 2021 19:22:35 +0200 Subject: [PATCH] Deprecate old settings --- core/loadpoint.go | 20 +++++--------------- meter/sma.go | 7 +------ vehicle/tesla.go | 13 ++++--------- 3 files changed, 10 insertions(+), 30 deletions(-) diff --git a/core/loadpoint.go b/core/loadpoint.go index 02f39fcaf..e2664f65d 100644 --- a/core/loadpoint.go +++ b/core/loadpoint.go @@ -42,12 +42,10 @@ type PollConfig struct { // SoCConfig defines soc settings, estimation and update behaviour type SoCConfig struct { - Poll PollConfig `mapstructure:"poll"` - AlwaysUpdate bool `mapstructure:"alwaysUpdate"` - Estimate bool `mapstructure:"estimate"` - Min int `mapstructure:"min"` // Default minimum SoC, guarded by mutex - Target int `mapstructure:"target"` // Default target SoC, guarded by mutex - Levels []int `mapstructure:"levels"` // deprecated + Poll PollConfig `mapstructure:"poll"` + Estimate bool `mapstructure:"estimate"` + Min int `mapstructure:"min"` // Default minimum SoC, guarded by mutex + Target int `mapstructure:"target"` // Default target SoC, guarded by mutex } // Poll modes @@ -153,11 +151,7 @@ func NewLoadPointFromConfig(log *util.Logger, cp configProvider, other map[strin if lp.SoC.Poll.Mode != "" { log.WARN.Printf("invalid poll mode: %s", lp.SoC.Poll.Mode) } - if lp.SoC.AlwaysUpdate { - log.WARN.Println("alwaysUpdate is deprecated and will be removed in a future release. Use poll instead.") - } else { - lp.SoC.Poll.Mode = pollConnected - } + lp.SoC.Poll.Mode = pollConnected } // set vehicle polling interval @@ -169,10 +163,6 @@ func NewLoadPointFromConfig(log *util.Logger, cp configProvider, other map[strin } } - if len(lp.SoC.Levels) > 0 { - log.WARN.Printf("vehicle.levels are deprecated and will be removed in an upcoming release") - } - if lp.SoC.Target == 0 { lp.SoC.Target = lp.OnDisconnect.TargetSoC // use disconnect value as default soc if lp.SoC.Target == 0 { diff --git a/meter/sma.go b/meter/sma.go index c9e3a4614..2fad48700 100644 --- a/meter/sma.go +++ b/meter/sma.go @@ -33,7 +33,6 @@ func NewSMAFromConfig(other map[string]interface{}) (api.Meter, error) { cc := struct { URI, Password, Interface string Serial uint32 - Power, Energy string Scale float64 // power only }{ Password: "0000", @@ -44,10 +43,6 @@ func NewSMAFromConfig(other map[string]interface{}) (api.Meter, error) { return nil, err } - if cc.Power != "" || cc.Energy != "" { - util.NewLogger("sma").WARN.Println("energy and power setting are deprecated and will be removed in a future release") - } - return NewSMA(cc.URI, cc.Password, cc.Interface, cc.Serial, cc.Scale) } @@ -62,7 +57,7 @@ func NewSMA(uri, password, iface string, serial uint32, scale float64) (api.Mete discoverer, err := sma.GetDiscoverer(iface) if err != nil { - return nil, fmt.Errorf("failed to get discoverer failed: %w", err) + return nil, fmt.Errorf("discoverer: %w", err) } switch { diff --git a/vehicle/tesla.go b/vehicle/tesla.go index 73a1b9e59..8a6ccf39c 100644 --- a/vehicle/tesla.go +++ b/vehicle/tesla.go @@ -29,11 +29,10 @@ func init() { // NewTeslaFromConfig creates a new vehicle func NewTeslaFromConfig(other map[string]interface{}) (api.Vehicle, error) { cc := struct { - embed `mapstructure:",squash"` - User, Password string // deprecated - Tokens Tokens - VIN string - Cache time.Duration + embed `mapstructure:",squash"` + Tokens Tokens + VIN string + Cache time.Duration }{ Cache: interval, } @@ -42,10 +41,6 @@ func NewTeslaFromConfig(other map[string]interface{}) (api.Vehicle, error) { return nil, err } - if cc.User != "" { - return nil, errors.New("user/password authentication deprecated, use `evcc token` to create credentials") - } - if err := cc.Tokens.Error(); err != nil { return nil, err }