Documentation
¶
Overview ¶
Package gohue controls hue lights. See http://developers.meethue.com.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Bright represents the brightest a light can be Bright = uint8(255) // Dim represents the dimmest a light can be. Dim = uint8(0) )
var ( // Indicates that the light ID is not found. NoSuchResourceError = errors.New("gohue: No such resource error.") // Indicates that some general error happened. GeneralError = errors.New("gohue: General error.") )
var ( Red = NewColor(0.675, 0.322) Green = NewColor(0.4077, 0.5154) Blue = NewColor(0.167, 0.04) Yellow = Red.Blend(Green, 0.5) Magenta = Blue.Blend(Red, 0.5) Cyan = Blue.Blend(Green, 0.5) Purple = NewColor(0.2522, 0.0882) White = NewColor(0.3848, 0.3629) Pink = NewColor(0.55, 0.3394) Orange = Red.Blend(Yellow, 0.5) )
Functions ¶
This section is empty.
Types ¶
type Color ¶
type Color struct {
// contains filtered or unexported fields
}
Color represents a particular color. Programs using Colors should typically store and pass them as values, not pointers.
func NewColor ¶
NewColor returns a new Color. x and y are the coordinates of the color in the color XY space. x and y are between 0.0 and 1.0 inclusive.
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context represents a connection with a hue bridge.
func NewContext ¶
NewContext creates a new Context instance. ipAddress is the private ip address of the hue bridge, but could be a DNS name. userId is the user Id / developer Id (See hue documentation).
func NewContextWithOptions ¶
NewContextWithOptions creates a new Context instance. ipAddress is the private ip address of the hue bridge, but could be a DNS name. userId is the user Id / developer Id (See hue documentation). options contains optional settings for the created context.
func (*Context) Get ¶
func (c *Context) Get(lightId int) ( properties *LightProperties, response []byte, err error)
Get gets the properties of a light. lightId is the ID of the light. properties is the returned properties. response is the raw response from the hue bridge or nil if communication failed. This function may return both a non-nil response and an error if the response from the hue bridge indicates an error. For most applications, it is enough just to look at properties and err.
func (*Context) Set ¶
func (c *Context) Set( lightId int, properties *LightProperties) (response []byte, err error)
Set sets the properties of a light. lightId is the ID of the light to set. 0 means all lights. response is the raw response from the hue bridge or nil if communication failed. This function may return both a non-nil response and an error if the response from the hue bridge indicates an error. For most applications, it is enough just to look at err.
type LightProperties ¶
type LightProperties struct { // C is the Color. Nothing means leave color as-is. C MaybeColor // Bri is the brightness. Nothing means leave brightness as is. Bri maybe.Uint8 // On is true if light is on or false if it is off. Nothing // means leave the on/off state as is. On maybe.Bool // The transition time in multiples of 100ms. Nothing means the default // transition time. See http://developers.meethue.com. // Used only with Context.Set(). Context.Get() does not populate. TransitionTime maybe.Uint16 }
LightProperies represents the properties of a light.
type MaybeColor ¶
type MaybeColor struct { Color // True if this instance represents a Color or false otherwise. Valid bool }
MaybeColor instances represent a Color or nothing. The zero value is nothing.
func NewMaybeColor ¶
func NewMaybeColor(c Color) MaybeColor
NewMaybeColor returns a new instance that represents c.
func (*MaybeColor) Clear ¶
func (m *MaybeColor) Clear()
Clear makes this instance represent nothing.
func (MaybeColor) String ¶
func (m MaybeColor) String() string
Directories
¶
Path | Synopsis |
---|---|
Package actions controls hue lights via asynchronous tasks.
|
Package actions controls hue lights via asynchronous tasks. |
Package json_structs contains structures used internally for parsing json.
|
Package json_structs contains structures used internally for parsing json. |