nanoleaf

package
v0.0.0-...-2387267 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddUserResponse

type AddUserResponse struct {
	AuthToken *string `json:"auth_token,omitempty"`
}

AddUserResponse is returned when adding a new user

type Client

type Client interface {
	Authorize() error
	GetInfo() (*DeviceInfo, error)
	SetState(state *State) error
	GetPower() (*OnValue, error)
	SetPower(value bool) error
	GetBrightness() (*RangedValue, error)
	SetBrightness(value int) error
	SetBrightnessWithDuration(value int, duration int) error
	GetHue() (*RangedValue, error)
	SetHue(value int) error
	GetSaturation() (*RangedValue, error)
	SetSaturation(value int) error
	GetColorTemperature() (*RangedValue, error)
	SetColorTemperature(value int) error
	GetColorMode() (string, error)
	GetCurrentEffect() (string, error)
	GetAllEffects() ([]string, error)
	SelectEffect(effect string) error
}

Client defines the default client interface

func New

func New(address string, token string) (Client, error)

New returns a new client

type DeviceInfo

type DeviceInfo struct {
	Name            *string      `json:"name"`
	SerialNo        *string      `json:"serialNo"`
	Manufacturer    *string      `json:"manufacturer"`
	FirmwareVersion *string      `json:"firmwareVersion"`
	Model           *string      `json:"model"`
	State           *State       `json:"state"`
	Effects         *Effects     `json:"effects"`
	PanelLayout     *PanelLayout `json:"panelLayout"`
	Rhythm          *Rhythm      `json:"rhythm"`
}

DeviceInfo defines the general device info

type Effects

type Effects struct {
	Select      *string    `json:"select,omitempty"`
	EffectsList *[]*string `json:"effectsList,omitempty"`
}

Effects defines all effects

type Layout

type Layout struct {
	NumPanels    *int         `json:"numPanels,omitempty"`
	SideLength   *int         `json:"sideLength,omitempty"`
	PositionData *[]*Position `json:"positionData,omitempty"`
}

Layout defines the panel layout

type OnValue

type OnValue struct {
	Value *bool `json:"value,omitempty"`
}

OnValue defines th power struct

type PanelLayout

type PanelLayout struct {
	Layout            *Layout      `json:"layout,omitempty"`
	GlobalOrientation *RangedValue `json:"globalOrientation,omitempty"`
}

PanelLayout defines the panel layout

type Position

type Position struct {
	PanelID *int     `json:"panelId,omitempty"`
	X       *int     `json:"x,omitempty"`
	Y       *int     `json:"y,omitempty"`
	O       *float64 `json:"o,omitempty"`
}

Position defines the panelID

type RangedValue

type RangedValue struct {
	Value    *int `json:"value,omitempty"`
	Max      *int `json:"max,omitempty"`
	Min      *int `json:"min,omitempty"`
	Duration *int `json:"duration,omitempty"`
}

RangedValue defines values like brightness, etc.

type Rhythm

type Rhythm struct {
	RhythmConnected *bool     `json:"rhythmConnected,omitempty"`
	RhythmActive    *bool     `json:"rhythmActive,omitempty"`
	RhythmID        *int      `json:"rhythmId,omitempty"`
	HardwareVersion *string   `json:"hardwareVersion,omitempty"`
	FirmwareVersion *string   `json:"firmwareVersion,omitempty"`
	AuxAvailable    *bool     `json:"auxAvailable,omitempty"`
	RhythmMode      *int      `json:"rhythmMode,omitempty"`
	RhythmPos       *Position `json:"rhythmPos,omitempty"`
}

Rhythm defines the rythm module

type State

type State struct {
	On         *OnValue     `json:"on,omitempty"`
	Brightness *RangedValue `json:"brightness,omitempty"`
	Hue        *RangedValue `json:"hue,omitempty"`
	Sat        *RangedValue `json:"sat,omitempty"`
	CT         *RangedValue `json:"ct,omitempty"`
	ColorMode  *string      `json:"colormode,omitempty"`
}

State defines the base state

Jump to

Keyboard shortcuts

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