zero

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

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

Go to latest
Published: Nov 20, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const BaseUrl = "https://mongol.brono.com/mongol/api.php"

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

API is an api.Vehicle implementation for Zero Motorcycles

func NewAPI

func NewAPI(log *util.Logger, user, password string) (*API, error)

NewAPI creates a new vehicle

func (*API) Status

func (v *API) Status(unitId string) (State, error)

Status implements the /user/vehicles/<vin>/status api

func (*API) Vehicles

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

type ErrorAnswer

type ErrorAnswer struct {
	Error string
}

type Provider

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

Provider implements the vehicle api

func NewProvider

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

NewProvider creates a vehicle api 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 api.VehicleOdometer interface

func (*Provider) Position

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

Position implements the api.VehiclePosition 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 State

type State struct {
	Unitnumber       string  //"123456",
	Name             string  //"538ZFAZ76LCK00000",
	Unittype         string  //"5",
	Unitmodel        string  //"6",
	Mileage          float64 `json:",string"` //"4382.46",
	Software_version string  //"190430",
	Logic_state      string  //"2"
	Reason           string  //"2",
	Response         string  //"0",
	Driver           string  //"0",
	Latitude         float64 // 51.5000,
	Longitude        float64 // 4.5000,
	Altitude         string  //:"0",
	Gps_valid        string  //:"0",
	Gps_connected    string  //:"1",
	Satellites       string  //"0",
	Velocity         string  //"1",
	Heading          string  //"344",
	Emergency        string  //:"0",
	Shock            string  //:"",
	Ignition         string  //:"0",
	Door             string  //:"0",
	Hood             string  //:"0",
	Volume           string  //:"0",
	Water_temp       string  //:"",
	Oil_pressure     string  //:"0",
	Main_voltage     float64 //:13.08,
	Analog1          float64 //":"0.09",
	Analog2          float64 //":"0.09",
	Analog3          float64 //":"0.09",
	Siren            string  //:"0",
	Lock             string  //:"0",
	Int_lights       string  //:"0",
	DatetimeUtc      string  `json:"datetime_utc"`    //:"20191030162309",
	DatetimeActual   string  `json:"datetime_actual"` //:"20191102113548"
	Address          string  //:"YourCity, YourStreet",
	Perimeter        string  //:"",
	Color            int     //:2,
	Soc              int     //:91,
	Tipover          int     //:0,
	Charging         int     //:1,
	Chargecomplete   int     // 0,
	Pluggedin        int     //:1,
	Chargingtimeleft int     //:0
	Storage          int
	Battery          int
}

type Unit

type Unit struct {
	UnitNumber string //"123456",
	Name       string
}

Jump to

Keyboard shortcuts

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