lights

package
v0.0.0-...-b044761 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bridge

type Bridge struct {
	Hostname string
	Username string
}

Bridge implements a hue light bridge

func NewBridge

func NewBridge(hostname, username string) *Bridge

NewBridge creates a new hue bridge by given hostname and username.

func (*Bridge) GetLights

func (l *Bridge) GetLights() ([]Light, error)

GetLights returns all lights in the given bridge

type Light

type Light struct {
	ID        int     `json:"id,omitempty"`
	Name      string  `json:"name"`
	State     State   `json:"state,omitempty"`
	Type      string  `json:"type,omitempty"`
	ModelID   string  `json:"modelid,omitempty"`
	SWVersion string  `json:"swversion,omitempty"`
	Bridge    *Bridge `json:"-"`
}

Light represents an individual light component

func (*Light) Turn

func (l *Light) Turn(on bool) (bool, error)

Turn turns the lights on or off.

type State

type State struct {
	On             bool      `json:"on"`
	Hue            uint16    `json:"hue,omitempty"`
	Effect         string    `json:"effect,omitempty"`
	Bri            uint8     `json:"bri,omitempty"`
	Sat            uint8     `json:"sat,omitempty"`
	CT             uint16    `json:"ct,omitempty"`
	XY             []float32 `json:"xy,omitempty"`
	Alert          string    `json:"alert,omitempty"`
	TransitionTime uint16    `json:"transitiontime,omitempty"`
	Reachable      bool      `json:"reachable,omitempty"`
	ColorMode      string    `json:"colormode,omitempty"`
}

State represents all states of a light light

Jump to

Keyboard shortcuts

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