polestar

package
v0.0.0-...-610f8f3 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApiURI   = "https://pc-api.polestar.com/eu-north-1"
	ApiURIv2 = ApiURI + "/mystar-v2"
)
View Source
const (
	OAuthURI    = "https://polestarid.eu.polestar.com"
	ClientID    = "l3oopkc_10"
	RedirectURI = "https://www.polestar.com/sign-in-callback"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

func NewAPI

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

func (*API) Odometer

func (v *API) Odometer(ctx context.Context, vin string) (OdometerData, error)

func (*API) Status

func (v *API) Status(ctx context.Context, vin string) (BatteryData, error)

func (*API) Vehicles

func (v *API) Vehicles(ctx context.Context) ([]ConsumerCar, error)

type BatteryData

type BatteryData struct {
	BatteryChargeLevelPercentage       float64
	ChargerConnectionStatus            string
	ChargingStatus                     string
	EstimatedChargingTimeToFullMinutes int
	EstimatedDistanceToEmptyKm         int
	EventUpdatedTimestamp              EventUpdatedTimestamp
}

type ConsumerCar

type ConsumerCar struct {
	VIN                       string
	InternalVehicleIdentifier string
}

type EventUpdatedTimestamp

type EventUpdatedTimestamp struct {
	ISO time.Time
}

type Identity

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

func NewIdentity

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

NewIdentity creates Polestar identity

func (*Identity) Token

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

Token implements oauth.TokenSource

func (*Identity) TokenSource

func (v *Identity) TokenSource() oauth2.TokenSource

TokenSource implements oauth.TokenSource

type OdometerData

type OdometerData struct {
	OdometerMeters        float64
	EventUpdatedTimestamp EventUpdatedTimestamp
}

type Provider

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

func NewProvider

func NewProvider(log *util.Logger, api *API, vin string, timeout, cache time.Duration) *Provider

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 Provider.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)

Range implements the api.VehicleRange interface

Jump to

Keyboard shortcuts

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