aboutsummaryrefslogtreecommitdiff
path: root/light.go
diff options
context:
space:
mode:
authorCollin Guarino <collin.guarino@gmail.com>2016-02-07 17:04:51 -0500
committerCollin Guarino <collin.guarino@gmail.com>2016-02-07 17:04:51 -0500
commit3b569742f3826ff0119d2a91669933863a3a428d (patch)
treef2d39271ef9bbcfac350554867bdbd25a886c894 /light.go
parent910ec0556232d926d76a15301a7667131f936f52 (diff)
Configuring On/Off functions for lights.
Diffstat (limited to 'light.go')
-rw-r--r--light.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/light.go b/light.go
index 16fb903..2d72502 100644
--- a/light.go
+++ b/light.go
@@ -49,6 +49,14 @@ type LightState struct {
XYIncrement *[2]float32 `json:"xy_inc,omitempty"`
}
+func (self *Light) TurnOff() {
+ SetLightState(self.Index, LightState{On: false})
+}
+
+func (self *Light) TurnOn() {
+ SetLightState(self.Index, LightState{On: true})
+}
+
// SetLightState will modify light attributes such as on/off, saturation,
// brightness, and more. See `SetLightState` struct.
func SetLightState(bridge *Bridge, index int, newState LightState) error {