diff options
author | Collin Guarino <collin.guarino@gmail.com> | 2016-02-07 20:49:51 -0500 |
---|---|---|
committer | Collin Guarino <collin.guarino@gmail.com> | 2016-02-07 20:49:51 -0500 |
commit | a05574836d277a8ca3c75ab3a7b7b9a1e1081faa (patch) | |
tree | f34e7e1761c4108e2daa417acc897a06892af33f /light.go | |
parent | 7df767996b0b8d7daab32cf43585a97437261df8 (diff) |
Simplified light.On/Off and added error returns.
Diffstat (limited to 'light.go')
-rw-r--r-- | light.go | 19 |
1 files changed, 9 insertions, 10 deletions
@@ -50,23 +50,22 @@ type LightState struct { XYIncrement *[2]float32 `json:"xy_inc,omitempty"` } -// light.TurnOff will change the light state to the "Off" mode. -func (self *Light) TurnOff() { - SetLightState(self, LightState{On: false}) +// light.Off will turn the light source off +func (self *Light) Off() error { + return SetLightState(self, LightState{On: false}) } -// light.TurnOn will change the light state to the "On" mode. -func (self *Light) TurnOn() { - SetLightState(self, LightState{On: true}) +// light.Off will turn the light source on +func (self *Light) On() error { + return SetLightState(self, LightState{On: true}) } -// light.Toggle will change the light state to "On" if -// the light is off or "Off" if the light is on. +// light.Toggle will toggle the light source on and off func (self *Light) Toggle() { if self.State.On { - self.TurnOff() + self.Off() } else { - self.TurnOn() + self.On() } } |