Documentation ¶
Index ¶
- Constants
- Variables
- func BuildURL(rawurl, rawpath string) string
- func Float32Ptr(v float32) *float32
- func Float64Ptr(v float64) *float64
- func Int16Ptr(v int16) *int16
- func IntPtr(v int) *int
- func StringPtr(v string) *string
- func WithDebug(debug bool) func(*Client)
- func WithUserAgent(userAgent string) func(*Client)
- type Breathe
- type Capabilities
- type Client
- func (c *Client) Breathe(selector string, breathe Breathe) (*LifxResponse, error)
- func (c *Client) FastPowerOff(selector string)
- func (c *Client) FastPowerOn(selector string)
- func (c *Client) FastSetState(selector string, state State) (*LifxResponse, error)
- func (c *Client) ListLights(selector string) ([]Light, error)
- func (c *Client) NewRequest(method, url string, body io.Reader) (req *http.Request, err error)
- func (c *Client) PowerOff(selector string) (*LifxResponse, error)
- func (c *Client) PowerOn(selector string) (*LifxResponse, error)
- func (c *Client) SetState(selector string, state State) (*LifxResponse, error)
- func (c *Client) SetStates(states States) (*LifxResponse, error)
- func (c *Client) StateDelta(selector string, delta StateDelta) (*LifxResponse, error)
- func (c *Client) Toggle(selector string, duration float64) (*LifxResponse, error)
- func (c *Client) ValidateColor(color Color) (Color, error)
- type Color
- type Error
- type HSBKColor
- func NewCyan() (HSBKColor, error)
- func NewGreen() (HSBKColor, error)
- func NewHSBColor(h, s, b float32) (HSBKColor, error)
- func NewHSColor(h, s float32) (HSBKColor, error)
- func NewOrange() (HSBKColor, error)
- func NewPink() (HSBKColor, error)
- func NewPurple() (HSBKColor, error)
- func NewRed() (HSBKColor, error)
- func NewWhite(k int16) (HSBKColor, error)
- func NewWhiteString(s string) (HSBKColor, error)
- func NewYellow() (HSBKColor, error)
- type LifxResponse
- type Light
- type NamedColor
- type Product
- type RGBColor
- type RateLimit
- type Response
- type Result
- type Selector
- type State
- type StateDelta
- type StateWithSelector
- type States
- type Status
- type Toggle
- type Warning
Constants ¶
View Source
const ( KelvinCandlelight = 1500 KelvinSunset = 2000 KelvinUltraWarm = 2500 KelvinIncandescent = 2700 KelvinWarm = 3000 KelvinCool = 4000 KelvinCoolDaylight = 4500 KelvinSoftDaylight = 5000 KelvinDaylight = 5600 KelvinNoonDaylight = 6000 KelvinBrightDaylight = 6500 KelvinCloudDaylight = 7000 KelvinBlueDaylight = 7500 KelvinBlueOvercast = 8000 KelvinBlueIce = 9000 HueWhite = 0 HueRed = 0 HueOrange = 36 HueYellow = 60 HueGreen = 120 HueCyan = 180 HueBlue = 250 HuePurple = 280 HuePink = 325 )
View Source
const Version = "0.1.0-pre"
Variables ¶
View Source
var ( Endpoint = "https://api.lifx.com/v1" EndpointState = func(selector string) string { return BuildURL(Endpoint, fmt.Sprintf("/lights/%s/state", selector)) } EndpointStateDelta = func(selector string) string { return BuildURL(Endpoint, fmt.Sprintf("/lights/%s/state/delta", selector)) } EndpointListLights = func(selector string) string { return BuildURL(Endpoint, fmt.Sprintf("/lights/%s", selector)) } EndpointStates = func() string { return BuildURL(Endpoint, "/lights/states") } EndpointColor = func() string { return BuildURL(Endpoint, "/color") } EndpointToggle = func(selector string) string { return BuildURL(Endpoint, fmt.Sprintf("/lights/%s/toggle", selector)) } EndpointBreathe = func(selector string) string { return BuildURL(Endpoint, fmt.Sprintf("/lights/%s/effects/breathe", selector)) } )
View Source
var ( DefaultBreatheCycles float64 = 1 DefaultBreathePeriod float64 = 1 DefaultBreathePersist bool = false DefaultBreathePowerOn bool = true DefaultBreathePeak float64 = 0.5 )
View Source
var ( DefaultWhites = map[string]int{ "candlelight": KelvinCandlelight, "sunset": KelvinSunset, "ultrawarm": KelvinUltraWarm, "incandescent": KelvinIncandescent, "warm": KelvinWarm, "cool": KelvinCool, "cooldaylight": KelvinCoolDaylight, "softdaylight": KelvinSoftDaylight, "daylight": KelvinDaylight, "noondaylight": KelvinNoonDaylight, "brightdaylight": KelvinBrightDaylight, "clouddaylight": KelvinCloudDaylight, "bluedaylight": KelvinBlueDaylight, "blueovercast": KelvinBlueOvercast, "blueice": KelvinBlueIce, } )
Functions ¶
func Float32Ptr ¶
func Float64Ptr ¶
func WithUserAgent ¶
Types ¶
type Breathe ¶
type Breathe struct { Color Color `json:"color,omitempty"` FromColor Color `json:"from_color,omitempty"` Period float64 `json:"period,omitempty"` Cycles float64 `json:"cycles,omitempty"` Persist bool `json:"persist,omitempty"` PowerOn bool `json:"power_on,omitempty"` Peak float64 `json:"peak,omitempty"` }
func NewBreathe ¶
func NewBreathe() Breathe
type Capabilities ¶
type Client ¶
func NewClientWithUserAgent ¶
func (*Client) Breathe ¶
func (c *Client) Breathe(selector string, breathe Breathe) (*LifxResponse, error)
func (*Client) FastPowerOff ¶
func (*Client) FastPowerOn ¶
func (*Client) FastSetState ¶
func (c *Client) FastSetState(selector string, state State) (*LifxResponse, error)
func (*Client) NewRequest ¶
func (*Client) SetState ¶
func (c *Client) SetState(selector string, state State) (*LifxResponse, error)
func (*Client) StateDelta ¶
func (c *Client) StateDelta(selector string, delta StateDelta) (*LifxResponse, error)
type HSBKColor ¶
type HSBKColor struct { H *float32 `json:"hue"` S *float32 `json:"saturation"` B *float32 `json:"brightness"` K *int16 `json:"kelvin"` }
func NewHSBColor ¶
func NewHSColor ¶
func NewWhiteString ¶
func (HSBKColor) ColorString ¶
func (HSBKColor) MarshalText ¶
type LifxResponse ¶
type Light ¶
type Light struct { Id string `json:"id"` UUID string `json:"uuid"` Label string `json:"label"` Connected bool `json:"connected"` Power string `json:"power"` Color HSBKColor `json:"color"` Brightness float64 `json:"brightness"` Effect string `json:"effect"` Group Selector `json:"group"` Location Selector `json:"location"` Product Product `json:"product"` LastSeen *time.Time `json:"last_seen,omitempty"` SecondsLastSeen float64 `json:"seconds_last_seen"` }
type NamedColor ¶
type NamedColor string
func (NamedColor) ColorString ¶
func (c NamedColor) ColorString() string
func (NamedColor) String ¶
func (c NamedColor) String() string
type Product ¶
type Product struct { Name string `json:"name"` Identifier string `json:"identifier"` Company string `json:"company"` Capabilities Capabilities `json:"capabilities"` }
type RGBColor ¶
type RGBColor struct {
R, G, B uint8
}
func NewRGBColor ¶
func (RGBColor) ColorString ¶
func (RGBColor) MarshalText ¶
type Response ¶
func (*Response) GetLifxError ¶
type StateDelta ¶
type StateDelta struct { Power *string `json:"power,omitempty"` Duration *float64 `json:"duration,omitempty"` Infrared *float64 `json:"infrared,omitempty"` Hue *float64 `json:"hue,omitempty"` Saturation *float64 `json:"saturation,omitempty"` Brightness *float64 `json:"brightness,omitempty"` Kelvin *int `json:"kelvin,omitempty"` }
type StateWithSelector ¶
type States ¶
type States struct { States []StateWithSelector `json:"states,omitempty"` Defaults State `json:"defaults,omitempty"` }
Click to show internal directories.
Click to hide internal directories.