emporia

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Circuit

type Circuit struct {
	Name    string `yaml:"name"`
	Channel int    `yaml:"channel"`
}

Circuit specific configuration.

type CircuitEnergy

type CircuitEnergy struct {
	Name   string
	Energy float64
}

type CircuitPower

type CircuitPower struct {
	Name  string
	Power float64
}

type Emporia

type Emporia struct {
	RootTempDir string
	Timezone    string
	Username    string
	Password    string
	ClientID    string
	UserPoolID  string
	DeviceGID   int
	Circuits    []Circuit `yaml:"circuits"`
}

Emporia models components needed.

func (*Emporia) FileExists

func (e *Emporia) FileExists(name string) bool

FileExists returns true if a filepath exists.

func (*Emporia) GetCustomerDevices

func (e *Emporia) GetCustomerDevices(token *string) (err error)

TODO: Parse the response out.

func (*Emporia) GetDayEnergy

func (e *Emporia) GetDayEnergy(token *string) (ce []CircuitEnergy, err error)

func (*Emporia) GetLogin

func (e *Emporia) GetLogin() (token *string, err error)

func (*Emporia) GetModifiedTime

func (e *Emporia) GetModifiedTime(filename string) (*time.Time, error)

GetModifiedTime reads when the filename was last modified to see if the file contains today's max/min. On midnight, this will be yesterday and the file removed for the new days recordings.

func (*Emporia) GetPower

func (e *Emporia) GetPower(token *string) (cp []CircuitPower, err error)

func (*Emporia) LocalTime

func (e *Emporia) LocalTime() (*time.Time, error)

LocalTime sets a time in location per specified config.

func (*Emporia) ReadStringFromFile

func (e *Emporia) ReadStringFromFile(filename string) (string, error)

ReadStringFromFile reads a value from filename.

func (*Emporia) WriteValueToFile

func (e *Emporia) WriteValueToFile(filename string, value string) error

WriteValueToFile writes a value to filename.

type EnergyInput

type EnergyInput struct {
	DeviceGID int
	Channel   int
	Start     string
	End       string
	Scale     string
	Unit      string
}

EnergyInput is required to get energy values.

type EnergyOutput

type EnergyOutput struct {
	UsageList []float64 `json:"usageList"`
}

EnergyOutput models energy values returned.

type PowerInput

type PowerInput struct {
	DeviceGID int
	Instant   string
	Scale     string
	Unit      string
}

PowerInput is required to get power values.

type PowerOutput

type PowerOutput struct {
	DeviceListUsage struct {
		Devices []struct {
			DeviceGID     int `json:"deviceGid"`
			ChannelUsages []struct {
				Name  string  `json:"name"`
				Usage float64 `json:"usage"`
			} `json:"channelUsages"`
		} `json:"devices"`
	} `json:"deviceListUsages"`
}

PowerOutput models power values returned.

Jump to

Keyboard shortcuts

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