Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var FuncMap = template.FuncMap{ "battery": func(value int64) 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 float64) 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 []v2.Group, id string) string { for _, group := range groups { if group.ID == id { return group.Name } } return "" }, }
FuncMap for template rendering
View Source
var ( // States available states of lights States = map[string]State{ "off": { On: false, Duration: time.Second * 3, }, "long_off": { On: false, Duration: time.Second * 30, }, "on": { On: true, Duration: time.Second * 3, Brightness: 100, }, "half": { On: true, Duration: time.Second * 3, Brightness: 50, }, "dimmed": { On: true, Duration: time.Second * 3, Brightness: 0, }, "long_on": { On: true, Duration: time.Minute * 5, Brightness: 100, }, } )
Functions ¶
This section is empty.
Types ¶
type APIScene ¶
type APIScene struct {
Lightstates map[string]State `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 any `json:"body,omitempty"`
Method string `json:"method,omitempty"`
}
Action description
type App ¶
type App struct {
// contains filtered or unexported fields
}
App stores information and secret of API
func (*App) TemplateFunc ¶ added in v1.12.0
TemplateFunc for rendering GUI
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) 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.