Documentation ¶
Index ¶
- type BatteryRecords
- type ChargingStatus
- type Location
- type PluginState
- type Session
- func (s *Session) ChargingStatus() (*BatteryRecords, *TemperatureRecords, error)
- func (s *Session) ClimateOff() error
- func (s *Session) ClimateOn() error
- func (s *Session) FlashLights() error
- func (s *Session) Honk() error
- func (s *Session) Load() error
- func (s *Session) LocateVehicle() (*Location, error)
- func (s *Session) LockDoors() error
- func (s *Session) Login() (*VehicleInfo, *BatteryRecords, *TemperatureRecords, error)
- func (s *Session) StartCharging() error
- func (s *Session) UnlockDoors() error
- func (s *Session) VehicleInfo() *VehicleInfo
- type TemperatureRecords
- type TimeRequired
- type VehicleInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BatteryRecords ¶
type BatteryRecords struct { LastUpdatedDateAndTime time.Time `json:"lastUpdatedDateAndTime"` BatteryStatus struct { BatteryChargingStatus ChargingStatus `json:"batteryChargingStatus"` BatteryCapacity int `json:"batteryCapacity"` BatteryRemainingAmount int `json:"batteryRemainingAmount"` SOC struct { Value int `json:"value"` } `json:"soc"` } `json:"batteryStatus"` PluginState PluginState `json:"pluginState"` CruisingRangeACOn float64 `json:"cruisingRangeAcOn"` CruisingRangeACOff float64 `json:"cruisingRangeAcOff"` TimeRequired TimeRequired `json:"timeRequired"` TimeRequired200 TimeRequired `json:"timeRequired200"` TimeRequired200_6kW TimeRequired `json:"timeRequired200_6kW"` }
BatteryRecords represents all known information about the vehicle's battery and charging state.
type ChargingStatus ¶
type ChargingStatus string
ChargingStatus represents the current charging status.
func (ChargingStatus) IsCharging ¶
func (cs ChargingStatus) IsCharging() bool
IsCharging returns true if the vehicle is charging.
func (ChargingStatus) String ¶
func (cs ChargingStatus) String() string
String converts the charging status to "yes" or "no".
type PluginState ¶
type PluginState string
PluginState represents whether the vehicle is plugged in (not necessarily charging).
func (PluginState) String ¶
func (ps PluginState) String() string
String converts the plugin state to "connected" or "not connected".
type Session ¶
type Session struct { Username string Password string Country string Debug bool Filename string VIN string PIN string // contains filtered or unexported fields }
Session represents a connection to the Nissan API server.
func (*Session) ChargingStatus ¶
func (s *Session) ChargingStatus() (*BatteryRecords, *TemperatureRecords, error)
ChargingStatus returns the current battery and temperature records.
func (*Session) ClimateOff ¶
ClimateOff turns off the HVAC system.
func (*Session) FlashLights ¶
FlashLights flashes the vehicle lights.
func (*Session) LocateVehicle ¶
LocateVehicle returns the current vehicle location.
func (*Session) Login ¶
func (s *Session) Login() (*VehicleInfo, *BatteryRecords, *TemperatureRecords, error)
Login sets up a new session with the Nissan API and retrieves the last known vehicle, battery and temperature records.
func (*Session) StartCharging ¶
StartCharging turns on the vehicle charger.
func (*Session) UnlockDoors ¶
UnlockDoors unlocks the vehicle doors.
func (*Session) VehicleInfo ¶
func (s *Session) VehicleInfo() *VehicleInfo
type TemperatureRecords ¶
type TemperatureRecords struct {
Temperature string `json:"inc_temp"`
}
TemperatureRecords represent the current interior temperature.
type TimeRequired ¶
type TimeRequired struct { HourRequiredToFull int `json:"hourRequiredToFull"` MinutesRequiredToFull int `json:"minutesRequiredToFull"` }
TimeRequired represents the time needed until fully charged.
func (TimeRequired) IsZero ¶
func (tr TimeRequired) IsZero() bool
IsZero checks if the charge time is 0.
func (TimeRequired) String ¶
func (tr TimeRequired) String() string
String returns a human readable duration in minutes or hours and minutes.