aboutsummaryrefslogtreecommitdiff
path: root/light.go
diff options
context:
space:
mode:
authorCollin Guarino <collin.guarino@gmail.com>2016-02-13 11:23:33 -0500
committerCollin Guarino <collin.guarino@gmail.com>2016-02-13 11:23:33 -0500
commit0a6419db7d1db3f7521c6532b126d78526c65caa (patch)
treec6fc57e8db1ddfca3265f5f8f5b0cf94f511a647 /light.go
parent2c8d63f80f8a6b171084db9d473ae72675137758 (diff)
Implemented Bridge.Delete and Light.Delete.
Diffstat (limited to 'light.go')
-rw-r--r--light.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/light.go b/light.go
index e2c7522..3d3b68c 100644
--- a/light.go
+++ b/light.go
@@ -83,15 +83,23 @@ func (self *Light) On() error {
// Light.Toggle will toggle the light source on and off
func (self *Light) Toggle() error {
if self.State.On {
- fmt.Println("toggling off")
return self.Off()
} else {
- fmt.Println("toggling on")
return self.On()
}
return nil
}
+func (self *Light) Delete() error {
+ uri := fmt.Sprintf("/api/%s/lights/%d", self.Bridge.Username, self.Index)
+ err := self.Bridge.Delete(uri)
+ if err != nil {
+ return err
+ }
+ return nil
+}
+
+
// Light.Blink will turn the light off and on repeatedly for a given seconds
// interval and return the light back to its off or on state afterwards.
// Note: time will vary based on connection speed and algorithm speed.