diff --git a/vehicle/psa/api.go b/vehicle/psa/api.go index 0c4bf2fc5..625ee662c 100644 --- a/vehicle/psa/api.go +++ b/vehicle/psa/api.go @@ -4,7 +4,6 @@ import ( "fmt" "net/http" "net/url" - "time" "github.com/evcc-io/evcc/util" "github.com/evcc-io/evcc/util/request" @@ -40,14 +39,6 @@ func NewAPI(log *util.Logger, identity oauth2.TokenSource, realm, id string) *AP return v } -// Vehicle is a single vehicle -type Vehicle struct { - ID string `json:"id"` - Label string `json:"label"` - Pictures []string `json:"pictures"` - VIN string `json:"vin"` -} - // Vehicles implements the /vehicles response func (v *API) Vehicles() ([]Vehicle, error) { data := url.Values{ @@ -72,51 +63,6 @@ func (v *API) Vehicles() ([]Vehicle, error) { return res.Embedded.Vehicles, err } -// Status is the /status response -type Status struct { - Battery struct { - Capacity int64 - Health struct { - Capacity int64 - Resistance int64 - } - } - Charging struct { - ChargingMode string - ChargingRate int64 - NextDelayedTime string - Plugged bool - RemainingTime string - Status string - } - Preconditionning struct { - AirConditioning struct { - UpdatedAt time.Time - Status string // Disabled - } - } - Energy []Energy - Odometer struct { - Mileage float64 - } `json:"timed.odometer"` -} - -// Energy is the /status partial energy response -type Energy struct { - UpdatedAt time.Time - Type string // Fuel/Electric - Level int - Autonomy int - Charging struct { - Plugged bool - Status string // InProgress - RemainingTime Duration - ChargingRate int - ChargingMode string // "Slow" - NextDelayedTime Duration - } -} - // Status implements the /vehicles//status response func (v *API) Status(vid string) (Status, error) { data := url.Values{ diff --git a/vehicle/psa/types.go b/vehicle/psa/types.go new file mode 100644 index 000000000..202e8652d --- /dev/null +++ b/vehicle/psa/types.go @@ -0,0 +1,56 @@ +package psa + +import "time" + +// Vehicle is a single vehicle +type Vehicle struct { + ID string `json:"id"` + Label string `json:"label"` + Pictures []string `json:"pictures"` + VIN string `json:"vin"` +} + +// Status is the /status response +type Status struct { + Battery struct { + Capacity int64 + Health struct { + Capacity int64 + Resistance int64 + } + } + Charging struct { + ChargingMode string + ChargingRate int64 + NextDelayedTime string + Plugged bool + RemainingTime string + Status string + } + Preconditionning struct { + AirConditioning struct { + UpdatedAt time.Time + Status string // Disabled + } + } + Energy []Energy + Odometer struct { + Mileage float64 + } `json:"timed.odometer"` +} + +// Energy is the /status partial energy response +type Energy struct { + UpdatedAt time.Time + Type string // Fuel/Electric + Level int + Autonomy int + Charging struct { + Plugged bool + Status string // InProgress + RemainingTime Duration + ChargingRate int + ChargingMode string // "Slow" + NextDelayedTime Duration + } +}