diff --git a/vehicle/smart-hello.go b/vehicle/smart-hello.go index 70f89c584..114dc274b 100644 --- a/vehicle/smart-hello.go +++ b/vehicle/smart-hello.go @@ -51,11 +51,18 @@ func NewSmartHelloFromConfig(other map[string]any) (api.Vehicle, error) { api := hello.NewAPI(log, identity) - cc.VIN, err = ensureVehicle(cc.VIN, api.Vehicles) - - if err == nil { - v.Provider = hello.NewProvider(log, api, cc.VIN, cc.Cache) + vehicle, err := ensureVehicleEx(cc.VIN, api.Vehicles, func(v hello.Vehicle) (string, error) { + return v.VIN, nil + }) + if err != nil { + return v, err } - return v, err + if vehicle.ProprietaryPlatform != 0 { + return v, fmt.Errorf("unsupported vehicle platform: %s", vehicle.SeriesCodeVs) + } + + v.Provider = hello.NewProvider(log, api, vehicle.VIN, cc.Cache) + + return v, nil } diff --git a/vehicle/smart/hello/api.go b/vehicle/smart/hello/api.go index b22f2a049..7c6aa6396 100644 --- a/vehicle/smart/hello/api.go +++ b/vehicle/smart/hello/api.go @@ -11,7 +11,6 @@ import ( "github.com/evcc-io/evcc/util" "github.com/evcc-io/evcc/util/request" "github.com/evcc-io/evcc/util/transport" - "github.com/samber/lo" ) // https://github.com/TA2k/ioBroker.smart-eq @@ -85,7 +84,7 @@ func (v *API) request(method, path string, params url.Values, body io.Reader) (* return req, err } -func (v *API) Vehicles() ([]string, error) { +func (v *API) Vehicles() ([]Vehicle, error) { var res struct { Code Int Message string @@ -116,11 +115,7 @@ func (v *API) Vehicles() ([]string, error) { return nil, err } - vehicles := lo.Map(res.Data.List, func(v Vehicle, _ int) string { - return v.VIN - }) - - return vehicles, err + return res.Data.List, err } func (v *API) UpdateSession(vin string) error { diff --git a/vehicle/smart/hello/types.go b/vehicle/smart/hello/types.go index 14e70a734..de61ecf7c 100644 --- a/vehicle/smart/hello/types.go +++ b/vehicle/smart/hello/types.go @@ -50,7 +50,10 @@ type AppToken struct { } type Vehicle struct { - VIN string + VIN string + SeriesCodeVs string `json:"seriesCodeVs"` // "HC11" (legacy), "HY11" (newer platform) + ModelName string `json:"modelName"` // e.g. "HY11_EUL_Pro+_RWD_000" + ProprietaryPlatform Int `json:"proprietaryPlatform"` // 0: legacy tsp backend (supported), 1: newer platform (status endpoint returns 8063) } type VehicleStatus struct {