Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrEngineInvalidSpecial = errors.New("Engine: invalid special action")
var ErrEngineMissingBridge = errors.New("Engine: missing index")
var ErrEngineMissingIndex = errors.New("Engine: missing index")
var ErrEngineNoConnect = errors.New("Engine: No Connect function")
var ErrIndexNilBridge = errors.New("NewIndex: bridge is nil")
var ErrInvalidAction = errors.New("action.Do: Invalid action")
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct { Group *HueGroup `json:"group,omitempty"` Light *HueLight `json:"light,omitempty"` Scene *HueScene `json:"scene,omitempty"` OnOff BoolOnOff `json:"onoff,omitempty"` Special *HueSpecial `json:"special,omitempty"` }
Action represents single action
type Engine ¶
type Engine struct { // Connect is a user-defined function to connect to a bridge Connect func() (bridge *huego.Bridge, err error) // contains filtered or unexported fields }
Engine coordinates an engine and index regeneration
func (*Engine) RefreshIndex ¶
type HueGroup ¶
HueGroup represents a hue group
func NewHueGroup ¶
NewHueGroup creates a new hue group.
Any internal call to this function should take care to place any unused instance back into groupPool.
func (*HueGroup) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
For safety reasons this only unmarshals the ID from the data source. Any call should be followed by a call to Refresh.
type HueLight ¶
HueLight represents a hue light
func NewHueLight ¶
NewHueLight creates a new hue light.
Any internal call to this function should take care to place any unused instance back into lightPool.
func (*HueLight) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler
For safety reasons this only unmarshals the ID from the data source. Any call should be followed by a call to Refresh.
type HueScene ¶
HueScene represents a hue scene
func NewHueScene ¶
NewHueScene creates a new hue scene.
Any internal call to this function should take care to place any unused instance back into scenePool.
func (*HueScene) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
For safety reasons this only unmarshals the ID from the data source. Any call should be followed by a call to Refresh.
type HueSpecial ¶
type HueSpecial struct { ID string `json:"id"` Data struct { Message string `json:"message"` } `json:"data"` }
HueSpecial represents a special action that can be returned by the webserver
type Index ¶
Index provides cached data contained in a hue bridge
func (Index) Query ¶
func (index Index) Query(queries []Query) (actions []Action, matchScores []MatchScore, scores []Score)
Query queries an index for a set of queries It returns a list of matching actions
func (Index) QueryString ¶
func (index Index) QueryString(input string) ([]Action, []MatchScore, []Score)
QueryString sends a string query to this index
type MatchScore ¶
type MatchScore [][]float64
MatchScore represents the score of a single action
func (MatchScore) AsFloat64 ¶
func (m MatchScore) AsFloat64() (total float64)
AsFloat64 returns the score of this action as a single float64
type Query ¶
type Query struct { // Name is the name of an action to pattern match against Name string // Action is the name of an action (scene or on/off) to pattern match against Action string }
Query describes a query for the huelio system.
func ParseQuery ¶
ParseQuery generates a set of queries from an input string
func (Query) MatchGroup ¶
MatchGroup scores the object stored in this room against a group.
func (Query) MatchLight ¶
MatchLight scores the object stored in this room against a light.
func (Query) MatchOnOff ¶
MatchOnOff scores the action stored in this scene against an on/off action.
func (Query) MatchScene ¶
MatchLights scores the object stored in this room against a scene action.
type Results ¶
type Results struct {
// contains filtered or unexported fields
}
Ranking represents a set of results
func (*Results) Add ¶
func (r *Results) Add(action Action, matchScore MatchScore)
Add adds a new result to this result set
type ScoreQueries ¶
type ScoreQueries struct { Queries []Query Scores MatchScore }
ScoreQueries represents a buffer of queries to be scored and filtered
func (*ScoreQueries) Score ¶
func (sq *ScoreQueries) Score(scoring func(q Query) float64) bool
Score applies scoring to the current list of queries. It modifies the scoring in place.
When score < 0, considers the scores as non-matching
func (ScoreQueries) ScoreFinal ¶
func (sq ScoreQueries) ScoreFinal(scoring func(q Query) float64) (scores MatchScore, queries []Query)
func (*ScoreQueries) Use ¶
func (sq *ScoreQueries) Use(Queries []Query)