Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotOK is returned if any of the Envoy APIs does not return a 200 ErrNotOK = errors.New("server did not return 200") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides the API for interacting with the Envoy APIs
func NewClient ¶
NewClient creates a new Client that will talk to an Envoy unit at *address*, creating its own http.Client underneath.
func NewClientWithHTTP ¶
NewClientWithHTTP creates a new Client that will talk to an Envoy unit at *address* using the provided http.Client.
func (*Client) Inventory ¶
Inventory returns the list of parts installed in the system and registered with the Envoy unit
func (*Client) Production ¶
func (c *Client) Production() (Production, error)
Production returns the current data for Production and Consumption sensors, if equipped.
type DevControl ¶
type DevControl struct {
Gficlearset bool `json:"gficlearset,omitempty"`
}
DevControl is a list of controls for devices
type Device ¶
type Device struct { PartNum string `json:"part_num,omitempty"` Installed int `json:"installed,omitempty"` SerialNum int `json:"serial_num,omitempty"` DeviceStatus []string `json:"device_status,omitempty"` LastReportDate int `json:"last_report_date,omitempty"` AdminState int `json:"admin_state,omitempty"` DevType int `json:"dev_type,omitempty"` CreatedDate int `json:"created_date,omitempty"` ImgLoadDate int `json:"img_load_date,omitempty"` ImgPnumRunning string `json:"img_pnum_running,omitempty"` Ptpn string `json:"ptpn,omitempty"` Chaneid int `json:"chaneid,omitempty"` DeviceControl []DevControl `json:"device_control,omitempty"` Producing bool `json:"producing,omitempty"` Communicating bool `json:"communicating,omitempty"` Provisioned bool `json:"provisioned,omitempty"` Operating bool `json:"operating,omitempty"` }
Device describes a device attached to the Envoy system
type Inventory ¶
type Inventory struct { Type string `json:"type,omitempty"` Devices []Device `json:"devices,omitempty"` }
Inventory describes a list of Devices of a certain Type
type Production ¶
type Production struct { Production []ProductionData `json:"production,omitempty"` Consumption []ProductionData `json:"consumption,omitempty"` Storage []ProductionData `json:"storage,omitempty"` }
Production is the collection of all power sensors in the system.
type ProductionData ¶
type ProductionData struct { Type string `json:"type,omitempty"` ActiveCount int `json:"activeCount,omitempty"` MeasurementType string `json:"measurementType,omitempty"` ReadingTime int `json:"readingTime,omitempty"` WNow float64 `json:"wNow,omitempty"` WhLifetime float64 `json:"whLifetime,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"` }
ProductionData describes a power reading from a particular sensor. May be a consumption meter.