device

package
v1.3.5 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEVICE_INFORMATION = "status"
	DEVICE_VERSION     = "status+2"
	DEVICE_NETWORK     = "status+5"
	DEVICE_ENERGY      = "status+8"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	Status struct {
		Name string `json:"DeviceName"`
		On   int    `json:"Power"`
	}
}

type Metadata added in v1.3.0

type Metadata struct {
	IP   string
	Name string
	Type string
}

type Network

type Network struct {
	Status struct {
		Hostname string `json:"Hostname"`
		Address  string `json:"IPAddress"`
	} `json:"StatusNET"`
}

type PowerDevice

type PowerDevice struct {
	Information Metadata
	// contains filtered or unexported fields
}

func New

func New(address string, username string, password string, name string, Type string) PowerDevice

func (PowerDevice) DeviceInformation

func (p PowerDevice) DeviceInformation(ctx context.Context) (Device, error)

func (PowerDevice) Network

func (p PowerDevice) Network(ctx context.Context) (Network, error)

func (PowerDevice) Status

func (p PowerDevice) Status(ctx context.Context) (PowerStatus, error)

func (PowerDevice) Version

func (p PowerDevice) Version(ctx context.Context) (Version, error)

type PowerStatus

type PowerStatus struct {
	Status struct {
		Energy struct {
			Total         float64
			Yesterday     float64
			Today         float64
			Power         int
			ApparentPower int
			ReactivePower int
			Factor        float64
			Voltage       int
			Current       float64
		} `json:"ENERGY"`
	} `json:"StatusSNS"`
}

type Version

type Version struct {
	Status struct {
		SDK     string `json:"SDK"`
		Version string `json:"Version"`
	} `json:"StatusFWR"`
}

Jump to

Keyboard shortcuts

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