vw

package
v0.0.0-...-e6e1b3f Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2021 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionCharge      = "batterycharge"
	ActionChargeStart = "start"
	ActionChargeStop  = "stop"
)
View Source
const (
	// IdentityURI is the VW OIDC identidy provider uri
	IdentityURI = "https://identity.vwgroup.io"

	// OauthTokenURI is used for refreshing tokens
	OauthTokenURI = "https://mbboauth-1d.prd.ece.vwg-connect.com/mbbcoauth/mobile/oauth2/v1/token"

	// OauthRevokeURI is used for revoking tokens
	OauthRevokeURI = "https://mbboauth-1d.prd.ece.vwg-connect.com/mbbcoauth/mobile/oauth2/v1/revoke"
)
View Source
const DefaultBaseURI = "https://msg.volkswagen.de/fs-car"

DefaultBaseURI is the VW api base URI

View Source
const RegionAPI = "https://mal-1a.prd.ece.vwg-connect.com/api"

RegionAPI is the VW api used for determining the home region

Variables

This section is empty.

Functions

func ChallengeVerifier

func ChallengeVerifier() (string, string, error)

ChallengeVerifier returns a challenge/verifier base64-encoded code combination

func RandomString

func RandomString(n int) string

RandomString creates random string of N integers

Types

type API

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

API is the VW api client

func NewAPI

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

NewAPI creates a new api client

func (*API) Action

func (v *API) Action(vin, action, value string) error

Action implements vehicle actions

func (*API) Any

func (v *API) Any(base, vin string) (interface{}, error)

Any implements any api response

func (*API) Charger

func (v *API) Charger(vin string) (ChargerResponse, error)

Charger implements the /charger response

func (*API) Climater

func (v *API) Climater(vin string) (ClimaterResponse, error)

Climater implements the /climater response

func (*API) HomeRegion

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

HomeRegion updates the home region for the given vehicle

func (*API) RolesRights

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

RolesRights updates the home region for the given vehicle

func (*API) Vehicles

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

Vehicles implements the /vehicles response

type ChargerResponse

type ChargerResponse struct {
	Charger struct {
		Status struct {
			BatteryStatusData struct {
				StateOfCharge         TimedInt
				RemainingChargingTime TimedInt
			}
			ChargingStatusData struct {
				ChargingState            TimedString // off, charging
				ChargingMode             TimedString // invalid, AC
				ChargingReason           TimedString // invalid, immediate
				ExternalPowerSupplyState TimedString // unavailable, available
				EnergyFlow               TimedString // on, off
			}
			PlugStatusData struct {
				PlugState TimedString // connected
			}
			CruisingRangeStatusData struct {
				EngineTypeFirstEngine  TimedString // typeIsElectric, petrolGasoline
				EngineTypeSecondEngine TimedString // typeIsElectric, petrolGasoline
				PrimaryEngineRange     TimedInt
				SecondaryEngineRange   TimedInt
				HybridRange            TimedInt
			}
		}
	}
}

ChargerResponse is the /bs/batterycharge/v1/%s/%s/vehicles/%s/charger api

type ClimaterResponse

type ClimaterResponse struct {
	Climater struct {
		Settings struct {
			TargetTemperature TimedTemperature
			HeaterSource      TimedString
		}
		Status struct {
			ClimatisationStatusData struct {
				ClimatisationState         TimedString
				ClimatisationReason        TimedString
				RemainingClimatisationTime TimedInt
			}
			TemperatureStatusData struct {
				OutdoorTemperature TimedTemperature
			}
			VehicleParkingClockStatusData struct {
				VehicleParkingClock TimedString
			}
		}
	}
}

ClimaterResponse is the /bs/climatisation/v1/%s/%s/vehicles/%s/climater api

type FormVars

type FormVars struct {
	Action     string
	Csrf       string
	RelayState string
	Hmac       string
}

FormVars holds HTML form input values required for login

func FormValues

func FormValues(reader io.Reader, id string) (FormVars, error)

FormValues extracts FormVars from given HTML document

type HomeRegion

type HomeRegion struct {
	HomeRegion struct {
		BaseURI struct {
			SystemID string
			Content  string // api url
		}
	}
}

HomeRegion is the home region API response

type Identity

type Identity struct {
	*request.Helper

	oauth2.TokenSource
	// contains filtered or unexported fields
}

Identity provides the identity.vwgroup.io login token source

func NewIdentity

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

NewIdentity creates VW identity

func (*Identity) Login

func (v *Identity) Login(query url.Values, user, password string) error

Login performs the identity.vwgroup.io login

type Provider

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

Provider implements the evcc vehicle api

func NewProvider

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

NewProvider provides the evcc vehicle api provider

func (*Provider) Climater

func (v *Provider) Climater() (active bool, outsideTemp float64, targetTemp float64, err 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) Range

func (v *Provider) Range() (rng int64, err 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

type TimedInt

type TimedInt struct {
	Content   int
	Timestamp string
}

TimedInt is an int value with timestamp

type TimedString

type TimedString struct {
	Content   string
	Timestamp string
}

TimedString is a string value with timestamp

type TimedTemperature

type TimedTemperature struct {
	Content   float64
	Timestamp string
}

TimedTemperature is the api temperature with timestamp

func (*TimedTemperature) UnmarshalJSON

func (t *TimedTemperature) UnmarshalJSON(data []byte) error

type VehiclesResponse

type VehiclesResponse struct {
	UserVehicles struct {
		Vehicle []string
	}
}

VehiclesResponse is the /usermanagement/users/v1/%s/%s/vehicles api

Jump to

Keyboard shortcuts

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