Class: TPLink::RGBLight

Inherits:
Device
  • Object
show all
Defined in:
lib/tp_link/rgb_light.rb

Overview

Control TP-Link LS130 / RGB lights

Instance Attribute Summary

Attributes inherited from Device

#alias, #name, #status

Instance Method Summary collapse

Methods inherited from Device

#off?, #on?, #reload, #rssi

Instance Method Details

#offObject

Turn light off



12
13
14
# File 'lib/tp_link/rgb_light.rb', line 12

def off
  transition_light_state(0, 100, 100, 100)
end

#on(b = 100, h = 100, s = 100) ⇒ Object

Turn Light on



7
8
9
# File 'lib/tp_link/rgb_light.rb', line 7

def on(b = 100, h = 100, s = 100)
  transition_light_state(1, b, h, s)
end

#toggleObject

Toggle device (turn off if on, on if off)



17
18
19
20
21
22
23
# File 'lib/tp_link/rgb_light.rb', line 17

def toggle
  if on?
    off
  else
    on
  end
end