From 0a6419db7d1db3f7521c6532b126d78526c65caa Mon Sep 17 00:00:00 2001 From: Collin Guarino Date: Sat, 13 Feb 2016 11:23:33 -0500 Subject: Implemented Bridge.Delete and Light.Delete. --- light.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'light.go') 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. -- cgit v1.2.3