api

package
v0.0.0-...-e05b1bb Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const Custom = "custom"

Custom meter/charger/vehicle type

Variables

View Source
var ErrAsleep error = errAsleep{}

ErrAsleep indicates that vehicle is asleep. Caller may chose to wake up the vehicle and retry.

View Source
var ErrMissingCredentials = errors.New("missing credentials")

ErrMissingCredentials indicates that user/password are missing

View Source
var ErrMustRetry = errors.New("must retry")

ErrMustRetry indicates that a rate-limited operation should be retried

View Source
var ErrNotAvailable = errors.New("not available")

ErrNotAvailable indicates that a feature is not available

View Source
var ErrOutdated = errors.New("outdated")

ErrOutdated indicates that result is outdated

View Source
var ErrSponsorRequired = errors.New("sponsorship required, see https://github.com/connectorjs/evcm#sponsorship")

ErrSponsorRequired indicates that a sponsor token is required

View Source
var ErrTimeout error = errTimeoutError{}

ErrTimeout is the error returned when a timeout happened. Modeled after context.DeadlineError

Functions

func FeatureStrings

func FeatureStrings() []string

FeatureStrings returns a slice of all String values of the enum

func TariffTypeStrings

func TariffTypeStrings() []string

TariffTypeStrings returns a slice of all String values of the enum

Types

type ActionConfig

type ActionConfig struct {
	Mode       *ChargeMode `mapstructure:"mode,omitempty"`       // Charge Mode
	MinCurrent *float64    `mapstructure:"minCurrent,omitempty"` // Minimum Current
	MaxCurrent *float64    `mapstructure:"maxCurrent,omitempty"` // Maximum Current
	MinSoc_    *int        `mapstructure:"minSoc,omitempty"`     // Minimum Soc (deprecated)
	TargetSoc  *int        `mapstructure:"targetSoc,omitempty"`  // Target Soc
	Priority   *int        `mapstructure:"priority,omitempty"`   // Priority
}

ActionConfig defines an action to take on event

func (ActionConfig) Merge

Merge merges all non-nil properties of the additional config into the base config. The receiver's config remains immutable.

func (ActionConfig) String

func (a ActionConfig) String() string

String implements Stringer and returns the ActionConfig as comma-separated key:value string

type AuthProvider

type AuthProvider interface {
	SetCallbackParams(baseURL, redirectURL string, authenticated chan<- bool)
	LoginHandler() http.HandlerFunc
	LogoutHandler() http.HandlerFunc
}

AuthProvider is the ability to provide OAuth authentication through the ui

type Authorizer

type Authorizer interface {
	Authorize(key string) error
}

Authorizer authorizes a charging session by supplying RFID credentials

type Battery

type Battery interface {
	Soc() (float64, error)
}

Battery provides battery Soc in %

type BatteryCapacity

type BatteryCapacity interface {
	Capacity() float64
}

BatteryCapacity provides a capacity in kWh

type ChargeMode

type ChargeMode string

ChargeMode is the charge operation mode. Valid values are off, now, minpv and pv

const (
	ModeEmpty ChargeMode = ""
	ModeOff   ChargeMode = "off"
	ModeNow   ChargeMode = "now"
	ModeMinPV ChargeMode = "minpv"
	ModePV    ChargeMode = "pv"
)

Charge modes

func ChargeModeString

func ChargeModeString(mode string) (ChargeMode, error)

ChargeModeString converts string to ChargeMode

func (ChargeMode) String

func (c ChargeMode) String() string

String implements Stringer

func (*ChargeMode) UnmarshalText

func (c *ChargeMode) UnmarshalText(text []byte) error

type ChargeRater

type ChargeRater interface {
	ChargedEnergy() (float64, error)
}

ChargeRater provides charged energy amount in kWh

type ChargeState

type ChargeState interface {
	Status() (ChargeStatus, error)
}

ChargeState provides current charging status

type ChargeStatus

type ChargeStatus string

ChargeStatus is the EV's charging status from A to F

const (
	StatusNone ChargeStatus = ""
	StatusA    ChargeStatus = "A" // Fzg. angeschlossen: nein    Laden aktiv: nein    Ladestation betriebsbereit, Fahrzeug getrennt
	StatusB    ChargeStatus = "B" // Fzg. angeschlossen:   ja    Laden aktiv: nein    Fahrzeug verbunden, Netzspannung liegt nicht an
	StatusC    ChargeStatus = "C" // Fzg. angeschlossen:   ja    Laden aktiv:   ja    Fahrzeug lädt, Netzspannung liegt an
	StatusD    ChargeStatus = "D" // Fzg. angeschlossen:   ja    Laden aktiv:   ja    Fahrzeug lädt mit externer Belüfungsanforderung (für Blei-Säure-Batterien)
	StatusE    ChargeStatus = "E" // Fzg. angeschlossen:   ja    Laden aktiv: nein    Fehler Fahrzeug / Kabel (CP-Kurzschluss, 0V)
	StatusF    ChargeStatus = "F" // Fzg. angeschlossen:   ja    Laden aktiv: nein    Fehler EVSE oder Abstecken simulieren (CP-Wake-up, -12V)
)

Charging states

func ChargeStatusString

func ChargeStatusString(status string) (ChargeStatus, error)

ChargeStatusString converts a string to ChargeStatus

func ChargeStatusStringWithMapping

func ChargeStatusStringWithMapping(s string, m map[ChargeStatus]ChargeStatus) (ChargeStatus, error)

ChargeStatusStringWithMapping converts a string to ChargeStatus. In case of error, mapping is applied.

func (ChargeStatus) String

func (c ChargeStatus) String() string

String implements Stringer

type ChargeTimer

type ChargeTimer interface {
	ChargingTime() (time.Duration, error)
}

ChargeTimer provides current charge cycle duration

type Charger

type Charger interface {
	ChargeState
	Enabled() (bool, error)
	Enable(enable bool) error
	CurrentLimiter
}

Charger provides current charging status and enable/disable charging

type ChargerEx

type ChargerEx interface {
	MaxCurrentMillis(current float64) error
}

ChargerEx provides milli-amp precision charger current control

type CsvWriter

type CsvWriter interface {
	WriteCsv(context.Context, io.Writer) error
}

CsvWriter converts to csv

type CurrentGetter

type CurrentGetter interface {
	GetMaxCurrent() (float64, error)
}

CurrentGetter provides getting charging maximum charging current for validation

type CurrentLimiter

type CurrentLimiter interface {
	MaxCurrent(current int64) error
}

CurrentLimiter provides settings charging maximum charging current

type Diagnosis

type Diagnosis interface {
	Diagnose()
}

Diagnosis is a helper interface that allows to dump diagnostic data to console

type Feature

type Feature int
const (
	Offline Feature
	CoarseCurrent
	IntegratedDevice
	Heating
)

func FeatureString

func FeatureString(s string) (Feature, error)

FeatureString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func FeatureValues

func FeatureValues() []Feature

FeatureValues returns all values of the enum

func (Feature) IsAFeature

func (i Feature) IsAFeature() bool

IsAFeature returns "true" if the value is listed in the enum definition. "false" otherwise

func (Feature) String

func (i Feature) String() string

func (*Feature) UnmarshalText

func (f *Feature) UnmarshalText(text []byte) error

type FeatureDescriber

type FeatureDescriber interface {
	Features() []Feature
}

FeatureDescriber optionally provides a list of supported non-api features

type IconDescriber

type IconDescriber interface {
	Icon() string
}

IconDescriber optionally provides an icon

type Identifier

type Identifier interface {
	Identify() (string, error)
}

Identifier identifies a vehicle and is implemented by the charger

type Meter

type Meter interface {
	CurrentPower() (float64, error)
}

Meter provides total active power in W

type MeterEnergy

type MeterEnergy interface {
	TotalEnergy() (float64, error)
}

MeterEnergy provides total energy in kWh

type PhaseCurrents

type PhaseCurrents interface {
	Currents() (float64, float64, float64, error)
}

PhaseCurrents provides per-phase current A

type PhasePowers

type PhasePowers interface {
	Powers() (float64, float64, float64, error)
}

PhasePowers provides signed per-phase power W

type PhaseSwitcher

type PhaseSwitcher interface {
	Phases1p3p(phases int) error
}

PhaseSwitcher provides 1p3p switching

type PhaseVoltages

type PhaseVoltages interface {
	Voltages() (float64, float64, float64, error)
}

PhaseVoltages provides per-phase voltage V

type Rate

type Rate struct {
	Start time.Time `json:"start"`
	End   time.Time `json:"end"`
	Price float64   `json:"price"`
}

Rate is a grid tariff rate

func (Rate) IsEmpty

func (r Rate) IsEmpty() bool

IsEmpty returns is the rate is the zero value

type Rates

type Rates []Rate

Rates is a slice of (future) tariff rates

func (Rates) Current

func (r Rates) Current(now time.Time) (Rate, error)

Current returns the rates current rate or error

type Resurrector

type Resurrector interface {
	WakeUp() error
}

Resurrector provides wakeup calls to the vehicle with an API call or a CP interrupt from the charger

type SocLimiter

type SocLimiter interface {
	TargetSoc() (float64, error)
}

SocLimiter returns the vehicles charge limit

type Tariff

type Tariff interface {
	Rates() (Rates, error)
	Type() TariffType
}

Tariff is a tariff capable of retrieving tariff rates

type TariffType

type TariffType int
const (
	TariffTypePriceStatic TariffType
	TariffTypePriceDynamic
	TariffTypePriceForecast
	TariffTypeCo2
)

func TariffTypeString

func TariffTypeString(s string) (TariffType, error)

TariffTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func TariffTypeValues

func TariffTypeValues() []TariffType

TariffTypeValues returns all values of the enum

func (TariffType) IsATariffType

func (i TariffType) IsATariffType() bool

IsATariffType returns "true" if the value is listed in the enum definition. "false" otherwise

func (TariffType) String

func (i TariffType) String() string

type Vehicle

type Vehicle interface {
	Battery
	BatteryCapacity
	IconDescriber
	Title() string
	SetTitle(string)
	Phases() int
	Identifiers() []string
	OnIdentified() ActionConfig
}

Vehicle represents the EV and it's battery

type VehicleChargeController

type VehicleChargeController interface {
	StartCharge() error
	StopCharge() error
}

VehicleChargeController allows to start/stop the charging session on the vehicle side

type VehicleClimater

type VehicleClimater interface {
	Climater() (bool, error)
}

VehicleClimater provides climatisation data

type VehicleFinishTimer

type VehicleFinishTimer interface {
	FinishTime() (time.Time, error)
}

VehicleFinishTimer provides estimated charge cycle finish time. Finish time is normalized for charging to 100% and may deviate from vehicle display if soc limit is effective.

type VehicleOdometer

type VehicleOdometer interface {
	Odometer() (float64, error)
}

VehicleOdometer returns the vehicles milage

type VehiclePosition

type VehiclePosition interface {
	Position() (float64, float64, error)
}

VehiclePosition returns the vehicles position in latitude and longitude

type VehicleRange

type VehicleRange interface {
	Range() (int64, error)
}

VehicleRange provides the vehicles remaining km range

Directories

Path Synopsis
proto
pb

Jump to

Keyboard shortcuts

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