Documentation ¶
Overview ¶
Package with a LightStrand that implementes the hue.API interface. It maps light ids to socket locations on a strand of lights.
Index ¶
- type LightStrand
- func (lg *LightStrand) ChangeLength(newLength int)
- func (lg *LightStrand) CleanInvalidLightIds() error
- func (lg *LightStrand) GetLightAttributes(socketId string) (*hue.LightAttributes, error)
- func (lg *LightStrand) GetLights() ([]hue.Light, error)
- func (lg *LightStrand) GetMap() map[string]string
- func (lg *LightStrand) GetNewLights() ([]hue.Light, time.Time, error)
- func (lg *LightStrand) GetUnmappedLightIds() ([]string, error)
- func (lg *LightStrand) IsMappedSocketId(socketId string) bool
- func (lg *LightStrand) MapUnmappedLights(normalState, selectedState *hue.LightState, ...) error
- func (lg *LightStrand) SearchForNewLights() error
- func (lg *LightStrand) SetGroupState(groupId string, state *hue.LightState) error
- func (lg *LightStrand) SetLightName(socketId string, name string) error
- func (lg *LightStrand) SetLightState(socketId string, state *hue.LightState) error
- type TwoWayMap
- func (m *TwoWayMap) DeleteWithKey(key string) bool
- func (m *TwoWayMap) DeleteWithValue(value string) bool
- func (m *TwoWayMap) GetKey(value string) string
- func (m *TwoWayMap) GetKeys() []string
- func (m *TwoWayMap) GetValue(key string) string
- func (m *TwoWayMap) GetValues() []string
- func (m *TwoWayMap) Length() int
- func (m *TwoWayMap) Set(key, value string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LightStrand ¶
Structure that holds the mapping from socket id to light id. This implements the hue.API interface so it can be used as a drop in replacement.
func NewLightStrand ¶
func NewLightStrand(length int, api hue.API) *LightStrand
Create a new light strand with the given length and hue.API to delegate to.
func NewLightStrandWithMap ¶
func NewLightStrandWithMap(length int, api hue.API, initMap map[string]string) *LightStrand
Create a new light strand with the given length and hue.API to delegate to.
func (*LightStrand) ChangeLength ¶
func (lg *LightStrand) ChangeLength(newLength int)
func (*LightStrand) CleanInvalidLightIds ¶
func (lg *LightStrand) CleanInvalidLightIds() error
func (*LightStrand) GetLightAttributes ¶
func (lg *LightStrand) GetLightAttributes(socketId string) (*hue.LightAttributes, error)
GetLightAttributes() is same as hue.User.GetLightAttributes() except all light ids are mapped to socket ids.
func (*LightStrand) GetLights ¶
func (lg *LightStrand) GetLights() ([]hue.Light, error)
GetLights() is same as hue.User.GetLights() except all light ids are mapped to socket ids.
func (*LightStrand) GetMap ¶
func (lg *LightStrand) GetMap() map[string]string
func (*LightStrand) GetNewLights ¶
func (lg *LightStrand) GetNewLights() ([]hue.Light, time.Time, error)
GetNewLights() is same as hue.User.GetNewLights() except all light ids are mapped to socket ids.
func (*LightStrand) GetUnmappedLightIds ¶
func (lg *LightStrand) GetUnmappedLightIds() ([]string, error)
Get a list of the unmapped light ids.
func (*LightStrand) IsMappedSocketId ¶
func (lg *LightStrand) IsMappedSocketId(socketId string) bool
func (*LightStrand) MapUnmappedLights ¶
func (lg *LightStrand) MapUnmappedLights(normalState, selectedState *hue.LightState, socketToLightFunc func(string) string) error
An interactive way of mapping all unmapped light bulbs on the hue bridge. This function does the following:
- Turn all lights normal state
- For each unmapped light a. Turn the bulb selectedState b. Call socketToLightFunc - The implementation should return the socket id for the unmapped light. If 'x' returned, skip mapping the bulb. c. Map the bulb to the socket id d. Turn the buld normal state and continue
This should be used to interactively prompt a person to map a light to a position in the strand.
func (*LightStrand) SearchForNewLights ¶
func (lg *LightStrand) SearchForNewLights() error
SearchForNewLights() is same as hue.User.SearchForNewLights() except all light ids are mapped to socket ids.
func (*LightStrand) SetGroupState ¶
func (lg *LightStrand) SetGroupState(groupId string, state *hue.LightState) error
SetGroupState() is same as hue.User.SetGroupState().
func (*LightStrand) SetLightName ¶
func (lg *LightStrand) SetLightName(socketId string, name string) error
SetLightName() is same as hue.User.SetLightName() except all light ids are mapped to socket ids.
func (*LightStrand) SetLightState ¶
func (lg *LightStrand) SetLightState(socketId string, state *hue.LightState) error
SetLightState() is same as hue.User.SetLightState() except all light ids are mapped to socket ids.
type TwoWayMap ¶
func LoadTwoWayMap ¶
func NewTwoWayMap ¶
func NewTwoWayMap() *TwoWayMap