envoy

package module
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2023 License: MIT Imports: 13 Imported by: 1

README

Go client for Envoy Gateway

License

License is MIT

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NilNotification = nilNotification{}

Functions

func GetJWTExpired added in v0.0.13

func GetJWTExpired(rawToken string) (*time.Time, error)

Types

type Client

type Client struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewClient

func NewClient(username, password, serial string, opts ...OptionFunc) (*Client, error)

func (*Client) CommCheck added in v0.0.9

func (c *Client) CommCheck() (*CommCheckResponse, *http.Response, error)

func (*Client) InvalidateSession added in v0.0.6

func (c *Client) InvalidateSession()

func (*Client) Inverters added in v0.0.8

func (c *Client) Inverters() (*[]Inverter, *http.Response, error)

func (*Client) Production

func (c *Client) Production() (*ProductionResponse, *http.Response, error)

type CommCheckResponse added in v0.0.9

type CommCheckResponse map[string]int

type DiscoverResponse added in v0.0.12

type DiscoverResponse struct {
	IPV4         string
	IPV6         string
	Serial       string
	ProtoVersion string
}

func Discover added in v0.0.10

func Discover() (*DiscoverResponse, error)

type Inverter added in v0.0.8

type Inverter struct {
	SerialNumber    string `json:"serialNumber"`
	LastReportDate  int    `json:"lastReportDate"`
	DevType         int    `json:"devType"`
	LastReportWatts int    `json:"lastReportWatts"`
	MaxReportWatts  int    `json:"maxReportWatts"`
}

type Line

type Line struct {
	WNow             float64 `json:"wNow"`
	WhLifetime       float64 `json:"whLifetime"`
	VarhLeadLifetime float64 `json:"varhLeadLifetime"`
	VarhLagLifetime  float64 `json:"varhLagLifetime"`
	VahLifetime      float64 `json:"vahLifetime"`
	RmsCurrent       float64 `json:"rmsCurrent"`
	RmsVoltage       float64 `json:"rmsVoltage"`
	ReactPwr         float64 `json:"reactPwr"`
	ApprntPwr        float64 `json:"apprntPwr"`
	PwrFactor        float64 `json:"pwrFactor"`
	WhToday          float64 `json:"whToday"`
	WhLastSevenDays  float64 `json:"whLastSevenDays"`
	VahToday         float64 `json:"vahToday"`
	VarhLeadToday    float64 `json:"varhLeadToday"`
	VarhLagToday     float64 `json:"varhLagToday"`
}

type LoginResponse

type LoginResponse struct {
	Message      string `json:"message"`
	SessionId    string `json:"session_id"`
	ManagerToken string `json:"manager_token"`
	IsConsumer   bool   `json:"is_consumer"`
}

type Measurement

type Measurement struct {
	Type             string  `json:"type"`
	ActiveCount      int     `json:"activeCount"`
	ReadingTime      int     `json:"readingTime"`
	WNow             float64 `json:"wNow"`
	WhLifetime       float64 `json:"whLifetime"`
	MeasurementType  string  `json:"measurementType,omitempty"`
	VarhLeadLifetime float64 `json:"varhLeadLifetime,omitempty"`
	VarhLagLifetime  float64 `json:"varhLagLifetime,omitempty"`
	VahLifetime      float64 `json:"vahLifetime,omitempty"`
	RmsCurrent       float64 `json:"rmsCurrent,omitempty"`
	RmsVoltage       float64 `json:"rmsVoltage,omitempty"`
	ReactPwr         float64 `json:"reactPwr,omitempty"`
	ApprntPwr        float64 `json:"apprntPwr,omitempty"`
	PwrFactor        float64 `json:"pwrFactor,omitempty"`
	WhToday          float64 `json:"whToday,omitempty"`
	WhLastSevenDays  float64 `json:"whLastSevenDays,omitempty"`
	VahToday         float64 `json:"vahToday,omitempty"`
	VarhLeadToday    float64 `json:"varhLeadToday,omitempty"`
	VarhLagToday     float64 `json:"varhLagToday,omitempty"`
	Lines            []Line  `json:"lines,omitempty"`
}

type Notification added in v0.0.6

type Notification interface {
	JWTRefreshed(string)
	JWTError(error)
	SessionRefreshed(string)
	SessionUsed(string)
	SessionError(error)
}

type OptionFunc

type OptionFunc func(*Client) error

func WithDebug added in v0.0.4

func WithDebug(debug bool) OptionFunc

func WithEnlightenBase

func WithEnlightenBase(enlightenBase string) OptionFunc

func WithGatewayAddress

func WithGatewayAddress(address string) OptionFunc

func WithJWT added in v0.0.13

func WithJWT(rawToken string) OptionFunc

func WithNotification added in v0.0.6

func WithNotification(notification Notification) OptionFunc

type ProductionResponse

type ProductionResponse struct {
	Production  []Measurement `json:"production"`
	Consumption []Measurement `json:"consumption"`
	Storage     []Storage     `json:"storage"`
}

type Storage

type Storage struct {
	Type        string  `json:"type"`
	ActiveCount int     `json:"activeCount"`
	ReadingTime int     `json:"readingTime"`
	WNow        float64 `json:"wNow"`
	WhNow       float64 `json:"whNow"`
	State       string  `json:"state"`
}

type TokenResponse

type TokenResponse struct {
	GenerationTime int64  `json:"generation_time"`
	Token          string `json:"token"`
	ExpiresAt      int64  `json:"expires_at"`
}

Jump to

Keyboard shortcuts

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