-
Notifications
You must be signed in to change notification settings - Fork 0
/
light.go
46 lines (41 loc) · 1.57 KB
/
light.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
package golightmyroom
import "image/color"
// Light holds the main controls that every Hue light has.
type Light interface {
// On turns on the light.
On()
// Off turns off the light.
Off()
// Powered returns true if the light is turned on and returns false if it's off.
Powered() bool
// Brightness returns a value from [1.0, 0.0], highest meaning brightest.
Brightness() float64
// SetBrightness set a brightness from [1.0, 0.0], highest meaning brightest.
SetBrightness(float64)
// Model shows the model name of the light, this is used for ColorControl.
Model() string
}
// TemperatureControl hold the temperature controls for Hue lights that support it.
type TemperatureControl interface {
// Temperature returns a temperature as Kelvin. (Search for "kelvin color temperature scale" for examples
// or use default values, like TemperatureDefault)
Temperature() uint16
// SetTemperature allows you to set a Kelvin color temperature for the light.
SetTemperature(uint16)
}
// ColorControl hold the color controls for Hue lights that support it.
type ColorControl interface {
// Color returns the current color.
Color() color.Color
// SetColor sets the (supported) color of the light.
// It may not be the exact color you set, since some lights have a limited color gamut.
SetColor(color.Color)
}
// NameControl holds the name controls that every Hue light has.
// Though this has been seperated if some lights should not have their name changed.
type NameControl interface {
// Name gets the light's name
Name() string
// SetName sets the light's name
SetName(string)
}