Ensure upper-case VINs

This commit is contained in:
andig 2020-09-30 13:38:00 +02:00
parent d136456e41
commit fb99917cb6
5 changed files with 6 additions and 5 deletions

View file

@ -97,7 +97,7 @@ func NewAudiFromConfig(other map[string]interface{}) (api.Vehicle, error) {
Helper: request.NewHelper(log),
user: cc.User,
password: cc.Password,
vin: cc.VIN,
vin: strings.ToUpper(cc.VIN),
brand: "Audi",
country: "DE",
}

View file

@ -64,7 +64,7 @@ func NewBMWFromConfig(other map[string]interface{}) (api.Vehicle, error) {
Helper: request.NewHelper(log),
user: cc.User,
password: cc.Password,
vin: cc.VIN,
vin: strings.ToUpper(cc.VIN),
}
v.chargeStateG = provider.NewCached(v.chargeState, cc.Cache).FloatGetter()

View file

@ -78,7 +78,7 @@ func NewPorscheFromConfig(other map[string]interface{}) (api.Vehicle, error) {
Helper: request.NewHelper(util.NewLogger("porsche")),
user: cc.User,
password: cc.Password,
vin: cc.VIN,
vin: strings.ToUpper(cc.VIN),
}
v.chargeStateG = provider.NewCached(v.chargeState, cc.Cache).FloatGetter()

View file

@ -123,7 +123,7 @@ func NewRenaultFromConfig(other map[string]interface{}) (api.Vehicle, error) {
Helper: request.NewHelper(log),
user: cc.User,
password: cc.Password,
vin: cc.VIN,
vin: strings.ToUpper(cc.VIN),
}
err := v.apiKeys(cc.Region)

View file

@ -3,6 +3,7 @@ package vehicle
import (
"errors"
"net/http"
"strings"
"time"
"github.com/andig/evcc/api"
@ -66,7 +67,7 @@ func NewTeslaFromConfig(other map[string]interface{}) (api.Vehicle, error) {
v.vehicle = vehicles[0].Vehicle
} else {
for _, vehicle := range vehicles {
if vehicle.Vin == cc.VIN {
if vehicle.Vin == strings.ToUpper(cc.VIN) {
v.vehicle = vehicle.Vehicle
}
}