id

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: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionCharge         = "charging"
	ActionStopCharge     = "stopcharging"
	ActionChargeStart    = "start"
	ActionChargeStop     = "stop"
	ActionChargeSettings = "settings" // body: targetSOC_pct

	ActionClimatisation      = "climatisation"
	ActionClimatisationStart = "start"
	ActionClimatisationStop  = "stop"
)

Actions and action values

View Source
const BaseURL = "https://mobileapi.apps.emea.vwapps.io"

BaseURL is the API base url

Variables

This section is empty.

Functions

func Refresher

func Refresher(log *util.Logger) oauth.TokenRefresher

Types

type API

type API struct {
	*request.Helper
}

API is an api.Vehicle implementation for VW ID cars

func NewAPI

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

NewAPI creates a new vehicle

func (*API) Action

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

Action implements vehicle actions

func (*API) Any

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

Any implements any api response

func (*API) Status

func (v *API) Status(vin string) (res Status, err error)

Status implements the /status response

func (*API) Vehicles

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

Vehicles implements the /vehicles response

type BatteryStatus

type BatteryStatus struct {
	CarCapturedTimestamp    string
	CurrentSOCPercent       int `json:"currentSOC_pct"`
	CruisingRangeElectricKm int `json:"cruisingRangeElectric_km"`
}

BatteryStatus is the /status.batteryStatus api

type ChargingSettings

type ChargingSettings struct {
	CarCapturedTimestamp      string
	MaxChargeCurrentAC        string // reduced, maximum
	AutoUnlockPlugWhenCharged string
	TargetSOCPercent          int `json:"targetSOC_pct"`
}

ChargingSettings is the /status.chargingSettings api

type ChargingStatus

type ChargingStatus struct {
	CarCapturedTimestamp               string
	ChargingState                      string  // readyForCharging
	RemainingChargingTimeToCompleteMin int     `json:"remainingChargingTimeToComplete_min"`
	ChargePowerKW                      float64 `json:"chargePower_kW"`
	ChargeRateKmph                     int     `json:"chargeRate_kmph"`
}

ChargingStatus is the /status.chargingStatus api

type ClimatisationSettings

type ClimatisationSettings struct {
	CarCapturedTimestamp              string
	TargetTemperatureK                float64 `json:"targetTemperature_K"`
	TargetTemperatureC                float64 `json:"targetTemperature_C"`
	ClimatisationWithoutExternalPower bool
	ClimatisationAtUnlock             bool // ClimatizationAtUnlock?
	WindowHeatingEnabled              bool
	ZoneFrontLeftEnabled              bool
	ZoneFrontRightEnabled             bool
	ZoneRearLeftEnabled               bool
	ZoneRearRightEnabled              bool
}

ClimatisationSettings is the /status.climatisationSettings api

type ClimatisationStatus

type ClimatisationStatus struct {
	CarCapturedTimestamp          string
	RemainingClimatisationTimeMin int    `json:"remainingClimatisationTime_min"`
	ClimatisationState            string // off
}

ClimatisationStatus is the /status.climatisationStatus api

type PlugStatus

type PlugStatus struct {
	CarCapturedTimestamp string
	PlugConnectionState  string // connected, disconnected
	PlugLockState        string
}

PlugStatus is the /status.plugStatus api

type Provider

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

Provider is an api.Vehicle implementation for VW ID cars

func NewProvider

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

NewProvider creates a new vehicle

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() (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) StartCharge

func (v *Provider) StartCharge() error

StartCharge implements the api.VehicleStartCharge interface

func (*Provider) Status

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

Status implements the api.ChargeState interface

type RangeStatus

type RangeStatus struct {
	CarCapturedTimestamp string
	CarType              string
	PrimaryEngine        struct {
		Type              string
		CurrentSOCPercent int `json:"currentSOC_pct"`
		RemainingRangeKm  int `json:"remainingRange_km"`
	}
	TotalRangeKm int `json:"totalRange_km"`
}

RangeStatus is the /status.rangeStatus api

type Status

type Status struct {
	Data struct {
		BatteryStatus         BatteryStatus
		ChargingStatus        ChargingStatus
		ChargingSettings      ChargingSettings
		PlugStatus            PlugStatus
		RangeStatus           RangeStatus
		ClimatisationSettings ClimatisationSettings
		ClimatisationStatus   ClimatisationStatus // may be currently not available
	}
}

Status is the /status api

type Token

type Token oauth2.Token

Token is the VW ID token

func (*Token) UnmarshalJSON

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

Jump to

Keyboard shortcuts

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