heliospectra

package module
v0.0.0-...-62c3efb Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2017 License: MIT Imports: 12 Imported by: 0

README

heliospectra

GoDoc

A Go (golang) package to discover and control Heliospectra LX/RX LED lights.

Documentation

Overview

Package heliospectra discovers and controls Heliospectra LX/RX LED Grow Lights.

Discovery is done on the local network over UDP, and control of light intensities is performed via plain HTTP (also on the local network).

Index

Constants

View Source
const (
	// TCPPort is the TCP Port that Heliospectra LED fixtures listen on.
	TCPPort = 50630
	// UDPPort is the UDP Port that Heliospectra LED fixtures listen on.
	UDPPort = 50632
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	// contains filtered or unexported fields
}

Device is a Heliospectra LED device.

func NewDevice

func NewDevice(addr net.IP, client *http.Client) *Device

NewDevice creates a new device from an IP address. If client is nil, the http.DefaultClient is used.

func (*Device) Diagnostic

func (d *Device) Diagnostic(ctx context.Context) (*Diagnostic, error)

Diagnostic executes a diagnostic request against the Device.

func (*Device) SetIntensities

func (d *Device) SetIntensities(ctx context.Context, intensities ...int) error

SetIntensities sets the intensities for each wavelength of this Device. You must provide the same number of intensities as the number of distinct wavelengths this Device has.

func (*Device) Status

func (d *Device) Status(ctx context.Context) (*Status, error)

Status executes a status request against the Device.

type DeviceInfo

type DeviceInfo struct {
	MAC       string `xml:"MACAddress"`
	DHCP      bool
	IPAddr    net.IP `xml:"IPAddress"`
	NetMask   string
	Gateway   net.IP
	DNS1      net.IP
	DNS2      net.IP
	FwVersion string
	SerialNum string `xml:"SerialNr"`
}

DeviceInfo is the information about a device returned during a scan.

func ScanUDP

func ScanUDP(ctx context.Context) ([]DeviceInfo, error)

ScanUDP performs a UDP device scan. The scan ends when the ctx is closed or after 4 seconds.

type Diagnostic

type Diagnostic struct {
	Model          string         `xml:"model"`
	CPUFW          string         `xml:"cpuFW"`
	DriverFW       string         `xml:"driverFW"`
	EthernetMAC    string         `xml:"ethernetMAC"`
	WlanMAC        string         `xml:"wlanMAC"`
	Wavelengths    WavelengthList `xml:"wavelengths"`
	Clock          string         `xml:"clock"`
	OnSchedule     string         `xml:"onSchedule"`
	MasterOrSlave  string         `xml:"masterOrSlave"`
	SystemStatus   string         `xml:"systemStatus"`
	Runtime        string         `xml:"runtime"`
	LatestChange   string         `xml:"latestChange"`
	ChangedBy      string         `xml:"changedBy"`
	ChangeIP       string         `xml:"changeIP"`
	ChangeType     string         `xml:"changeType"`
	Temps          string         `xml:"temps"`
	Intensities    string         `xml:"intensities"`
	UseNTP         uint           `xml:"useNTP"`
	NetworkType    string         `xml:"networkType"`
	NetworkIP      net.IP         `xml:"networkIP"`
	NetworkSubnet  net.IP         `xml:"networkSubnet"`
	NetworkGateway net.IP         `xml:"networkGateway"`
	NetworkDNS1    net.IP         `xml:"networkDNS1"`
	NetworkDNS2    net.IP         `xml:"networkDNS2"`
	AllowedTemp    string         `xml:"allowedTemp"`
	Hs             string         `xml:"hs"`
	Title          string         `xml:"title"`
	WLANIP         net.IP         `xml:"wlanIP"`
	EthernetIP     net.IP         `xml:"ethernetIP"`
	NTPOffset      string         `xml:"ntpOffset"`
	Masters        string         `xml:"masters"`
	Dialog         string         `xml:"dialog"`
	PoweredLink    string         `xml:"poweredLink"`
	PoweredText    string         `xml:"poweredText"`
	NTPPoolType    string         `xml:"ntpPoolType"`
	NTPPoolCustom  string         `xml:"ntpPoolCustom"`
	Favicon        string         `xml:"favicon"`
	TempUnit       string         `xml:"tempUnit"`
	LockData       string         `xml:"lockData"`
	Shortcuts      string         `xml:"shortcuts"`
	NTPData        string         `xml:"ntpData"`
	MulticastIP    string         `xml:"multicastIP"`
	Tags           string         `xml:"tags"`
}

Diagnostic is the result of a diagnostic request against a Device.

type Status

type Status struct {
	InternalTime        string `xml:"a"`
	OnSchedule          string `xml:"b"`
	Status              string `xml:"c"`
	Uptime              string `xml:"d"`
	LastChangeAt        string `xml:"e"`
	LastChangeInterface string `xml:"f"`
	LastChangeBy        net.IP `xml:"g"`
	LastChangeType      string `xml:"h"`
	Temp                string `xml:"i"`
	Intensities         string `xml:"j"`
	Masters             string `xml:"k"`
	Reserved            string `xml:"l"`
	ControlMode         string `xml:"m"`
	NTPTimeSettings     string `xml:"q"`
}

Status is the response to a status.xml call.

type WavelengthDescription

type WavelengthDescription struct {
	Number     uint8
	Wavelength string
	Power      string
}

WavelengthDescription is a description of an available wavelength on a Device.

type WavelengthList

type WavelengthList []WavelengthDescription

WavelengthList is a list of WavelengthDescriptions.

func (*WavelengthList) UnmarshalXML

func (wl *WavelengthList) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML unmarshals a list of WavelengthDescriptions from XML.

Directories

Path Synopsis
cmd
hs

Jump to

Keyboard shortcuts

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