aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCollin Guarino <collin.guarino@gmail.com>2016-01-30 14:49:58 -0500
committerCollin Guarino <collin.guarino@gmail.com>2016-01-30 14:49:58 -0500
commit4aa25095974a5369ac9319bd613c97ec73d7f5b1 (patch)
tree5f7a9396372d21b2690ab53d6ec8984879d2661d
parentb802df3354c3ec95953d0022ba6c4132d7988cf6 (diff)
Fixed light state float types and started SetLightState func.
-rw-r--r--light.go15
1 files changed, 10 insertions, 5 deletions
diff --git a/light.go b/light.go
index 68310ee..f51a031 100644
--- a/light.go
+++ b/light.go
@@ -20,7 +20,7 @@ type Light struct {
Saturation int `json:"sat"` // Saturation value 0-254
Effect string `json:"effect"` //
XY []string `json:"xy"` // Coordinates of color in CIE color space
- CT int `json:"ct"` // Mired Color Temperature
+ CT int `json:"ct"` // Mired Color Temperature (google it)
Alert string `json:"alert"`
ColorMode string `json:"colormode"`
Reachable bool `json:"reachable"`
@@ -33,12 +33,13 @@ type Light struct {
SWVersion string `json:"swversion"`
}
-type SetLightState struct {
+// LightState used in SetLightState to ammend light attributes.
+type LightState struct {
On bool
Bri uint8
Hue uint16
Sat uint8
- XY [2]float4
+ XY [2]float32
CT uint16
Alert string
Effect string
@@ -47,9 +48,14 @@ type SetLightState struct {
SaturationIncrement int // TODO: -254 to 254
HueIncrement int // TODO: -65534 to 65534
CTIncrement int // TODO: -65534 to 65534
- XYIncrement [2]float4
+ XYIncrement [2]float32
}
+// SetLightState will modify light attributes such as on/off, saturation,
+// brightness, and more. See `SetLightState` struct.
+func SetLightState(bridge *Bridge, newState LightState) {
+
+}
//http://192.168.1.128/api/319b36233bd2328f3e40731b23479207/lights/
@@ -87,7 +93,6 @@ func GetAllLights(bridge *Bridge) []Light {
err = json.Unmarshal(body, &data)
if err != nil {
trace("", err)
- os.Exit(1)
}
lights = append(lights, data)
}