diff options
author | Collin Guarino <collin.guarino@gmail.com> | 2016-02-13 11:23:33 -0500 |
---|---|---|
committer | Collin Guarino <collin.guarino@gmail.com> | 2016-02-13 11:23:33 -0500 |
commit | 0a6419db7d1db3f7521c6532b126d78526c65caa (patch) | |
tree | c6fc57e8db1ddfca3265f5f8f5b0cf94f511a647 /light.go | |
parent | 2c8d63f80f8a6b171084db9d473ae72675137758 (diff) |
Implemented Bridge.Delete and Light.Delete.
Diffstat (limited to 'light.go')
-rw-r--r-- | light.go | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -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. |