-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgroup_accessors.go
54 lines (48 loc) · 1.81 KB
/
group_accessors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package hue
// GetName returns human readable name of the group.
// If name is not specified one is generated for you (default name is “Group”)
func (g *Group) GetName() string {
if g == nil {
return ""
}
return g.Name
}
// GetLights returns the ordered set of light ids from the lights which are in the group.
// This resource shall contain an array of at least one element with the exception of the “Room” type: The Room type may contain an empty lights array.
// Each element can appear only once. Order of lights on creation is preserved. A light id must be an existing light resource in /lights.
// If an invalid lights resource is given, error 7 shall be returned and the group is not created. There shall be no change in the lights.
// Light id can be null if a group has been automatically create by the bridge and a light source is not yet available
func (g *Group) GetLights() []string {
if g == nil {
return nil
}
return g.Lights
}
// GetType returns type of the Group. If not provided on creation a “LightGroup” is created. Supported types:
// LightGroup 1.4 Default
// Luminaire 1.4 multisource luminaire
// LightSource 1.4 multisource luminaire
// Room 1.11 Represents a room
// Entertainment 1.22 Represents an entertainment setup
// Zone 1.30 Represents a zone
func (g *Group) GetType() string {
if g == nil {
return ""
}
return g.Type
}
// IsOn returns On/Off state of the light. On=true, Off=false
func (g *Group) IsOn() bool {
if g == nil {
return false
}
return g.Action.On
}
// GetBrightness returns which is a scale from 0 (the minimum the light is capable of) to 254 (the maximum).
// Note: a brightness of 0 is not off.e.g. “brightness”: 60 will set the light to a specific brightness.
func (g *Group) GetBrightness() int {
if g == nil {
return 0
}
return g.Action.Bri
}