Class: TPLink::Light
Overview
Control TPLink Dimmable lights
Instance Attribute Summary
Attributes inherited from Device
Instance Method Summary collapse
-
#off ⇒ Object
Turn light off.
-
#on(b = 100) ⇒ Object
Turn light on.
-
#toggle ⇒ Object
Toggle device (turn off if on, on if off).
Methods inherited from Device
Instance Method Details
#off ⇒ Object
Turn light off
21 22 23 |
# File 'lib/tp_link/light.rb', line 21 def off transition_light_state(0, 100) end |
#on(b = 100) ⇒ Object
Turn light on
15 16 17 18 |
# File 'lib/tp_link/light.rb', line 15 def on(b = 100) transition_light_state(1, b) if self.off? transition_light_state(1, b) end |
#toggle ⇒ Object
Toggle device (turn off if on, on if off)
26 27 28 29 30 31 32 |
# File 'lib/tp_link/light.rb', line 26 def toggle if on? off else on end end |