porsche

package
v0.0.0-...-0c7050d Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApiURI = "https://api.porsche.com"

	PairingComplete  = "PAIRINGCOMPLETE"
	PairingInProcess = "INPROCESS"
)
View Source
const (
	OAuthURI = "https://identity.porsche.com"
	ClientID = "UYsK00My6bCqJdbQhTQ0PbWmcSdIAMig"
)

Variables

View Source
var (
	OAuth2Config = &oauth2.Config{
		ClientID:    ClientID,
		RedirectURL: "https://my.porsche.com/",
		Endpoint: oauth2.Endpoint{
			AuthURL:   OAuthURI + "/authorize",
			TokenURL:  OAuthURI + "/oauth/token",
			AuthStyle: oauth2.AuthStyleInParams,
		},
		Scopes: []string{"openid", "offline_access"},
	}
)

https://identity.porsche.com/.well-known/openid-configuration

Functions

func IsPaired

func IsPaired(status string) bool

Types

type API

type API struct {
	*request.Helper
}

API is an api.Vehicle implementation for Porsche PHEV cars

func NewAPI

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

NewAPI creates a new vehicle

func (*API) PairingStatus

func (v *API) PairingStatus(vin string) (VehiclePairingResponse, error)

PairingStatus implements the vehicle pairing status response

func (*API) Status

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

Status implements the vehicle status response

func (*API) Vehicles

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

Vehicles implements the vehicle list response

type CapabilitiesResponse

type CapabilitiesResponse struct {
	DisplayParkingBrake      bool
	NeedsSPIN                bool
	HasRDK                   bool
	EngineType               string
	CarModel                 string
	OnlineRemoteUpdateStatus struct {
		EditableByUser bool
		Active         bool
	}
	HeatingCapabilities struct {
		FrontSeatHeatingAvailable bool
		RearSeatHeatingAvailable  bool
	}
	SteeringWheelPosition string
	HasHonkAndFlash       bool
}

type EmobilityAPI

type EmobilityAPI struct {
	*request.Helper
}

EmobilityAPI is the Porsche Emobility API

func NewEmobilityAPI

func NewEmobilityAPI(log *util.Logger, identity oauth2.TokenSource) *EmobilityAPI

NewEmobilityAPI creates a new vehicle

func (*EmobilityAPI) Capabilities

func (v *EmobilityAPI) Capabilities(vin string) (CapabilitiesResponse, error)

func (*EmobilityAPI) Status

func (v *EmobilityAPI) Status(vin, model string) (EmobilityResponse, error)

Status implements the vehicle status response

type EmobilityResponse

type EmobilityResponse struct {
	BatteryChargeStatus *struct {
		ChargeRate struct {
			Unit             string
			Value            float64
			ValueInKmPerHour int64
		}
		ChargingInDCMode                            bool
		ChargingMode                                string
		ChargingPower                               float64
		ChargingReason                              string
		ChargingState                               string
		ChargingTargetDateTime                      string
		ExternalPowerSupplyState                    string
		PlugState                                   string
		RemainingChargeTimeUntil100PercentInMinutes int64
		StateOfChargeInPercentage                   int64
		RemainingERange                             struct {
			OriginalUnit      string
			OriginalValue     int64
			Unit              string
			Value             int64
			ValueInKilometers int64
		}
	}
	ChargingStatus string
	DirectCharge   struct {
		Disabled bool
		IsActive bool
	}
	DirectClimatisation struct {
		ClimatisationState         string
		RemainingClimatisationTime int64
	}
	PcckErrorMessage string
}

type Identity

type Identity struct {
	*request.Helper
	// contains filtered or unexported fields
}

Identity is the Porsche Identity client

func NewIdentity

func NewIdentity(log *util.Logger) *Identity

NewIdentity creates Porsche identity

func (*Identity) Login

func (v *Identity) Login(oc *oauth2.Config, user, password string) (oauth2.TokenSource, error)

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider is an api.Vehicle implementation for Porsche PHEV cars

func NewProvider

func NewProvider(log *util.Logger, connect *API, emobility *EmobilityAPI, vin, carModel string, cache time.Duration) *Provider

NewProvider creates a vehicle api provider

func (*Provider) Climater

func (v *Provider) Climater() (bool, error)

Climater implements the api.VehicleClimater interface

func (*Provider) FinishTime

func (v *Provider) FinishTime() (time.Time, error)

FinishTime implements the api.VehicleFinishTimer interface

func (*Provider) Odometer

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

Odometer implements the api.VehicleOdometer 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.Vehicle 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 {
	BatteryLevel struct {
		Unit  string
		Value float64
	}
	Mileage struct {
		Unit  string
		Value float64
	}
	RemainingRanges struct {
		ElectricalRange struct {
			Distance struct {
				Unit  string
				Value float64
			}
		}
	}
}

type Vehicle

type Vehicle struct {
	VIN              string
	ModelDescription string
	Pictures         []struct {
		URL         string
		View        string
		Size        int
		Width       int
		Height      int
		Transparent bool
	}
}

type VehiclePairingResponse

type VehiclePairingResponse struct {
	VIN                string
	PairingCode        string
	Status             string
	CanSendPairingCode bool
}

Jump to

Keyboard shortcuts

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