envoy

package
v0.0.0-...-106dcdb Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Discover

func Discover() (string, error)

func SetConfig

func SetConfig(host, user, pass, serial string)

func SetLoggerLevel

func SetLoggerLevel(l logrus.Level)

Types

type Entry

type Entry struct {
	Type             string  `json:"type"`
	ActiveCount      int     `json:"activeCount"`
	MeasurementType  string  `json:"measurementType"`
	ReadingTime      int     `json:"readingTime"`
	WNow             float64 `json:"wNow,omitempty"`
	WhLifetime       float64 `json:"whLifetime,omitempty"`
	WhNow            float64 `json:"whNow,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"`
	State            string  `json:"state,omitempty"`
	Lines            []Line  `json:"lines,omitempty"`
}

type Envoy

type Envoy struct {
	Host             string `json:"host"`
	Username         string `json:"username"`
	Password         string `json:"password"`
	EnvoySerial      string `json:"serial"`
	JWTToken         string `json:"jwt_token"`
	ManagerSessionId string `json:"-"`
	LocalSessionId   string `json:"-"`
	// contains filtered or unexported fields
}

func New

func New() *Envoy

func (*Envoy) Close

func (e *Envoy) Close()

func (*Envoy) GetLocalSessionCookie

func (e *Envoy) GetLocalSessionCookie() (err error)

func (*Envoy) GetToken

func (e *Envoy) GetToken() (err error)

func (*Envoy) Home

func (e *Envoy) Home() (*Home, error)

func (*Envoy) Info

func (e *Envoy) Info() (*EnvoyInfo, error)

func (*Envoy) Inventory

func (e *Envoy) Inventory() (*[]Inventory, error)

http://envoy.local/inventory.json?deleted=1

func (*Envoy) Inverters

func (e *Envoy) Inverters() (*[]Inverter, error)

func (*Envoy) Login

func (e *Envoy) Login() (err error)

func (*Envoy) Now

func (e *Envoy) Now() (float64, float64, float64, error)

func (*Envoy) Production

func (e *Envoy) Production() (*Production, error)

func (*Envoy) Rediscover

func (e *Envoy) Rediscover() error

func (*Envoy) SystemMax

func (e *Envoy) SystemMax() (uint64, error)

func (*Envoy) Today

func (e *Envoy) Today() (float64, float64, float64, error)

type EnvoyInfo

type EnvoyInfo struct {
	XMLName xml.Name `xml:"envoy_info"`
	Text    string   `xml:",chardata"`
	Time    string   `xml:"time"`
	Device  struct {
		Text     string `xml:",chardata"`
		Sn       string `xml:"sn"`
		Pn       string `xml:"pn"`
		Software string `xml:"software"`
		Euaid    string `xml:"euaid"`
		Seqnum   string `xml:"seqnum"`
		Apiver   string `xml:"apiver"`
		Imeter   string `xml:"imeter"`
	} `xml:"device"`
	Package []struct {
		Text    string `xml:",chardata"`
		Name    string `xml:"name,attr"`
		Pn      string `xml:"pn"`
		Version string `xml:"version"`
		Build   string `xml:"build"`
	} `xml:"package"`
	BuildInfo struct {
		Text         string `xml:",chardata"`
		BuildTimeGmt string `xml:"build_time_gmt"`
		BuildID      string `xml:"build_id"`
	} `xml:"build_info"`
}

type Home

type Home struct {
	SoftwareBuildEpoch int     `json:"software_build_epoch"`
	IsNonvoy           bool    `json:"is_nonvoy"`
	DbSize             string  `json:"db_size"`
	DbPercentFull      string  `json:"db_percent_full"`
	Timezone           string  `json:"timezone"`
	CurrentDate        string  `json:"current_date"`
	CurrentTime        string  `json:"current_time"`
	Network            Homenet `json:"network"`
	Tariff             string  `json:"tariff"`
	Comm               struct {
		Num   int        `json:"num"`
		Level int        `json:"level"`
		Pcu   Homenumlev `json:"pcu"`
		Acb   Homenumlev `json:"acb"`
		Nsrb  Homenumlev `json:"nsrb"`
	} `json:"comm"`
	Alerts       []interface{} `json:"alerts"` // dunno on this one yet
	UpdateStatus string        `json:"update_status"`
}

http://envoy.local/home.json

type Homenet

type Homenet struct {
	WebComm                 bool        `json:"web_comm"`
	EverReportedToEnlighten bool        `json:"ever_reported_to_enlighten"`
	LastEnlightenReportTime int         `json:"last_enlighten_report_time"`
	PrimaryInterface        string      `json:"primary_interface"`
	Interfaces              []Homenetif `json:"interfaces"`
}

type Homenetif

type Homenetif struct {
	SignalStrength    int    `json:"signal_strength"`
	SignalStrengthMax int    `json:"signal_strength_max"`
	Network           bool   `json:"network,omitempty"`
	Type              string `json:"type"`
	Interface         string `json:"interface"`
	Dhcp              bool   `json:"dhcp"`
	IP                string `json:"ip"`
	Carrier           bool   `json:"carrier"`
	Mac               string `json:"mac,omitempty"`
	Supported         bool   `json:"supported,omitempty"`
	Present           bool   `json:"present,omitempty"`
	Configured        bool   `json:"configured,omitempty"`
	Status            string `json:"status,omitempty"`
}

type Homenumlev

type Homenumlev struct {
	Num   int `json:"num"`
	Level int `json:"level"`
}

type Inventory

type Inventory struct {
	Type    string `json:"type"`
	Devices []struct {
		PartNum        string   `json:"part_num"`
		Installed      string   `json:"installed"`
		SerialNum      string   `json:"serial_num"`
		DeviceStatus   []string `json:"device_status"`
		LastRptDate    string   `json:"last_rpt_date"`
		AdminState     int      `json:"admin_state"`
		DevType        int      `json:"dev_type"`
		CreatedDate    string   `json:"created_date"`
		ImgLoadDate    string   `json:"img_load_date"`
		ImgPnumRunning string   `json:"img_pnum_running"`
		Ptpn           string   `json:"ptpn"`
		Chaneid        int      `json:"chaneid"`
		DeviceControl  []struct {
			Gficlearset bool `json:"gficlearset"`
		} `json:"device_control"`
		Producing     bool `json:"producing"`
		Communicating bool `json:"communicating"`
		Provisioned   bool `json:"provisioned"`
		Operating     bool `json:"operating"`
	} `json:"devices"`
}

inventory

type Inverter

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

requires authentication http://envoy.local/api/v1/production/inverters uint8 for Watts might be good enough, but mine are hitting 246...

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 Production

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

from the production endpoint

type Stream

type Stream struct {
	Production       streamSet `json:"production"`
	NetConsumption   streamSet `json:"net-consumption"`
	TotalConsumption streamSet `json:"total-consumption"`
}

Stream is the type for the webstream

Jump to

Keyboard shortcuts

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