Deprecate old settings

This commit is contained in:
andig 2021-08-26 19:22:35 +02:00
parent e4fe538b79
commit a2c5fc0217
3 changed files with 10 additions and 30 deletions

View file

@ -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 {

View file

@ -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 {

View file

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