v0.0.0-...-175a4df Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2023 License: MIT Imports: 19 Imported by: 0




View Source
const (
	AuthURI       = ""
	TokenURI      = ""
	ClientID      = "9fb503e0-715b-47e8-adfd-ad4b7770f73b"
	ApplicationID = "1E8C7794-FF5F-49BC-9596-A1E0C86C5B19"
View Source
const ApiURI = ""
View Source
const TimeFormat = "01-02-2006 15:04:05" // time format used by Ford API, time is in UTC


View Source
var OAuth2Config = &oauth2.Config{
	ClientID: ClientID,
	Endpoint: oauth2.Endpoint{
		AuthURL:  fmt.Sprintf("%s/v1.0/endpoint/default/authorize", AuthURI),
		TokenURL: fmt.Sprintf("%s/oidc/endpoint/default/token", AuthURI),
	RedirectURL: "fordapp://userauthorized",
	Scopes:      []string{"openid"},


This section is empty.


type API

type API struct {

API is the Ford api client

func NewAPI

func NewAPI(log *util.Logger, ts oauth2.TokenSource) *API

NewAPI creates a new api client

func (*API) RefreshRequest

func (v *API) RefreshRequest(vin string) (string, error)

RefreshRequest requests status refresh tracked by commandId

func (*API) RefreshResult

func (v *API) RefreshResult(vin, refreshId string) (StatusResponse, error)

RefreshResult retrieves a refresh result using /statusrefresh

func (*API) Status

func (v *API) Status(vin string) (StatusResponse, error)

Status performs a /status request

func (*API) Vehicles

func (v *API) Vehicles() ([]string, error)

Vehicles returns the list of user vehicles

func (*API) WakeUp

func (v *API) WakeUp(vin string) error

WakeUp performs a wakeup request

type Identity

type Identity struct {

	// contains filtered or unexported fields

func NewIdentity

func NewIdentity(log *util.Logger, user, password string) *Identity

NewIdentity creates Ford identity

func (*Identity) Login

func (v *Identity) Login() error

Login authenticates with username/password to get new aws credentials

func (*Identity) RefreshToken

func (v *Identity) RefreshToken(token *oauth2.Token) (*oauth2.Token, error)

RefreshToken implements oauth.TokenRefresher

type Provider

type Provider struct {
	// contains filtered or unexported fields

func NewProvider

func NewProvider(api *autonomic.API, vin string, cache time.Duration) *Provider

func (*Provider) Odometer

func (v *Provider) Odometer() (float64, error)

Odometer implements the api.VehicleOdometer interface

func (*Provider) Position

func (v *Provider) Position() (float64, float64, error)

Position implements the api.VehiclePosition interface

func (*Provider) Range

func (v *Provider) Range() (int64, error)

Range implements the api.VehicleRange interface

func (*Provider) Soc

func (v *Provider) Soc() (float64, error)

Soc implements the api.Battery interface

func (*Provider) Status

func (v *Provider) Status() (api.ChargeStatus, error)

Status implements the api.ChargeState interface

func (*Provider) WakeUp

func (v *Provider) WakeUp() error

WakeUp implements the api.Resurrector interface

type StatusResponse

type StatusResponse struct {
	VehicleStatus struct {
		BatteryFillLevel struct {
			Value     float64
			Timestamp Timestamp
		ElVehDTE struct {
			Value     float64
			Timestamp Timestamp
		ChargingStatus struct {
			Value     string
			Timestamp Timestamp
		ChargeEndTime struct {
			Value     Timestamp
			Timestamp Timestamp
		PlugStatus struct {
			Value     int
			Timestamp Timestamp
		Odometer struct {
			Value     float64
			Timestamp Timestamp
		Gps struct {
			Latitude  float64 `json:",string"`
			Longitude float64 `json:",string"`
			GpsState  string
			Timestamp Timestamp
		LastRefresh Timestamp
	Status int

StatusResponse is the response to the vehicle status request

type Timestamp

type Timestamp struct {

Timestamp implements JSON unmarshal

func (*Timestamp) UnmarshalJSON

func (ct *Timestamp) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes string timestamp into time.Time

type VehiclesResponse

type VehiclesResponse struct {
	UserVehicles struct {
		VehicleDetails []struct {
			VIN string


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL