bluelink

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

Documentation

Index

Constants

View Source
const (
	VehiclesURL = "/api/v1/spa/vehicles"
	StatusURL   = "/api/v1/spa/vehicles/%s/status"
)
View Source
const (
	DeviceIdURL        = "/api/v1/spa/notifications/register"
	IntegrationInfoURL = "/api/v1/user/integrationinfo"
	SilentSigninURL    = "/api/v1/user/silentsignin"
	LanguageURL        = "/api/v1/user/language"
	LoginURL           = "/api/v1/user/signin"
	TokenURL           = "/api/v1/user/oauth2/token"
)

Variables

View Source
var ErrAuthFail = errors.New("authorization failed")

ErrAuthFail indicates authorization failure

Functions

This section is empty.

Types

type API

type API struct {
	*request.Helper

	Vehicle Vehicle
	// contains filtered or unexported fields
}

API implements the Kia/Hyundai bluelink api. Based on https://github.com/Hacksore/bluelinky.

func NewAPI

func NewAPI(log *util.Logger, identity *Identity, cache time.Duration) *API

New creates a new BlueLink API

func (*API) FinishTime

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

FinishTime implements the api.VehicleFinishTimer interface

func (*API) Range

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

Range implements the api.VehicleRange interface

func (*API) SoC

func (v *API) SoC() (float64, error)

SoC implements the api.Vehicle interface

func (*API) Vehicles

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

type Config

type Config struct {
	URI               string
	BrandAuthUrl      string // v2
	BasicToken        string
	CCSPServiceID     string
	CCSPApplicationID string
}

Config is the bluelink API configuration

type DrivingDistance

type DrivingDistance struct {
	RangeByFuel struct {
		EvModeRange struct {
			Value int
		}
	}
}

type Identity

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

API implements the Kia/Hyundai bluelink api. Based on https://github.com/Hacksore/bluelinky.

func NewIdentity

func NewIdentity(log *util.Logger, config Config) (*Identity, error)

NewIdentity creates a new BlueLink API

func (*Identity) Login

func (v *Identity) Login(user, password string) (err error)

func (*Identity) Refresh

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

Refresh implements token refresh

func (*Identity) Request

func (v *Identity) Request(method, path string) (*http.Request, error)

Request creates authenticated request

type Stamps

type Stamps map[string][]string

Stamps collects stamps for a single brand

func (Stamps) New

func (s Stamps) New(id string) string

New creates a new stamp

type StatusResponse

type StatusResponse struct {
	RetCode string
	ResMsg  struct {
		EvStatus struct {
			BatteryStatus float64
			RemainTime2   struct {
				Atc struct {
					Value, Unit int
				}
			}
			DrvDistance []DrivingDistance
		}
		Vehicles []Vehicle
	}
	// contains filtered or unexported fields
}

type Vehicle

type Vehicle struct {
	Vin, VehicleName, VehicleID string
}

type VehiclesResponse

type VehiclesResponse struct {
	RetCode string
	ResMsg  struct {
		Vehicles []Vehicle
	}
}

Jump to

Keyboard shortcuts

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