Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // FuncMap for template rendering FuncMap = template.FuncMap{ "battery": func(value uint) string { switch { case value >= 90: return "battery-full?fill=limegreen" case value >= 75: return "battery-three-quarters?fill=limegreen" case value >= 50: return "battery-half?fill=darkorange" case value >= 25: return "battery-quarter?fill=darkorange" default: return "battery-empty?fill=salmon" } }, "temperature": func(value float32) string { switch { case value >= 28: return "thermometer-full?fill=salmon" case value >= 24: return "thermometer-three-quarters?fill=darkorange" case value >= 18: return "thermometer-half?fill=limegreen" case value >= 14: return "thermometer-half?fill=darkorange" case value >= 10: return "thermometer-quarter?fill=darkorange" case value >= 4: return "thermometer-empty?fill=salmon" default: return "snowflake?fill=cornflowerblue" } }, "groupName": func(groups map[string]Group, id string) string { if group, ok := groups[id]; ok { return group.Name } return "" }, } )
View Source
var ( // States available states of lights States = map[string]map[string]interface{}{ "off": { "on": false, "transitiontime": 30, }, "long_off": { "on": false, "transitiontime": 300, }, "on": { "on": true, "transitiontime": 30, "sat": 0, "bri": 255, }, "half": { "on": true, "transitiontime": 30, "sat": 0, "bri": 96, }, "dimmed": { "on": true, "transitiontime": 30, "sat": 0, "bri": 0, }, "long_on": { "on": true, "transitiontime": 3000, "sat": 0, "bri": 255, }, } )
Functions ¶
This section is empty.
Types ¶
type APIScene ¶
type APIScene struct {
Lightstates map[string]map[string]interface{} `json:"lightstates,omitempty"`
Name string `json:"name,omitempty"`
Lights []string `json:"lights,omitempty"`
Recycle bool `json:"recycle"`
}
APIScene describe scene as from Hue API
type APISchedule ¶
type APISchedule struct {
Name string `json:"name,omitempty"`
Localtime string `json:"localtime,omitempty"`
Command Action `json:"command,omitempty"`
Status string `json:"status,omitempty"`
}
APISchedule describe schedule as from Hue API
type Action ¶
type Action struct {
Address string `json:"address,omitempty"`
Body map[string]interface{} `json:"body,omitempty"`
Method string `json:"method,omitempty"`
}
Action description
type App ¶
type App struct {
// contains filtered or unexported fields
}
App stores informations and secret of API
func New ¶
func New(config Config, registerer prometheus.Registerer, renderer renderer.App) (*App, error)
New creates new App from Config
type ByScheduleID ¶ added in v1.17.3
type ByScheduleID []Schedule
ByScheduleID sort Schedule by id
func (ByScheduleID) Len ¶ added in v1.17.3
func (a ByScheduleID) Len() int
func (ByScheduleID) Less ¶ added in v1.17.3
func (a ByScheduleID) Less(i, j int) bool
func (ByScheduleID) Swap ¶ added in v1.17.3
func (a ByScheduleID) Swap(i, j int)
type BySensorID ¶ added in v1.17.3
type BySensorID []Sensor
BySensorID sort Sensor by id
func (BySensorID) Len ¶ added in v1.17.3
func (a BySensorID) Len() int
func (BySensorID) Less ¶ added in v1.17.3
func (a BySensorID) Less(i, j int) bool
func (BySensorID) Swap ¶ added in v1.17.3
func (a BySensorID) Swap(i, j int)
type Condition ¶
type Condition struct {
Address string `json:"address,omitempty"`
Operator string `json:"operator,omitempty"`
Value string `json:"value,omitempty"`
}
Condition description
type Group ¶
type Group struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Lights []string `json:"lights,omitempty"`
State groupState `json:"state,omitempty"`
Tap bool `json:"tap,omitempty"`
}
Group description
type Light ¶
type Light struct {
ID string `json:"id,omitempty"`
Type string `json:"type,omitempty"`
State lightState `json:"state,omitempty"`
}
Light description
type Rule ¶
type Rule struct {
ID string `json:"-"`
Status string `json:"status,omitempty"`
Name string `json:"name,omitempty"`
Actions []Action `json:"actions,omitempty"`
Conditions []Condition `json:"conditions,omitempty"`
}
Rule description
type Schedule ¶
type Schedule struct {
ID string `json:"id,omitempty"`
APISchedule
}
Schedule description
func (Schedule) FindStateName ¶
FindStateName finds matching state's name
func (Schedule) FormatLocalTime ¶
FormatLocalTime formats local time of schedules to human readable version
type ScheduleConfig ¶
ScheduleConfig configuration (made simple)
type Sensor ¶
type Sensor struct {
ID string `json:"-"`
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
State sensorState `json:"state,omitempty"`
Config SensorConfig `json:"config,omitempty"`
}
Sensor description
type SensorConfig ¶ added in v1.11.1
type SensorConfig struct {
Battery uint `json:"battery,omitempty"`
On bool `json:"on"`
LedIndication bool `json:"ledindication"`
}
SensorConfig description
Click to show internal directories.
Click to hide internal directories.