Class: Milight::V6::All
- Inherits:
-
Object
- Object
- Milight::V6::All
- Defined in:
- lib/milight/v6/all.rb
Instance Method Summary collapse
-
#brightness(value) ⇒ Object
Set brightness, value: 0% to 100%.
-
#hue(value) ⇒ Object
Set the hue, value: 0 to 255 (red).
-
#initialize(command) ⇒ All
constructor
A new instance of All.
-
#night_light ⇒ Object
Enable night light mode.
-
#off ⇒ Object
Switch the lights off.
-
#on ⇒ Object
Switch the lights on.
-
#saturation(value) ⇒ Object
Set the saturation, value: 0% to 100%.
-
#temperature(value) ⇒ Object
Set color temperature, value: 0 = 2700K, 100 = 6500K.
-
#wait(seconds) ⇒ Object
Wait before continuing to next command.
-
#warm_light ⇒ Object
Set color temperature to warm light (2700K).
-
#white_light ⇒ Object
Set color temperature to white (cool) light (6500K).
Constructor Details
#initialize(command) ⇒ All
Returns a new instance of All.
6 7 8 |
# File 'lib/milight/v6/all.rb', line 6 def initialize(command) @command = command end |
Instance Method Details
#brightness(value) ⇒ Object
Set brightness, value: 0% to 100%
32 33 34 35 36 |
# File 'lib/milight/v6/all.rb', line 32 def brightness(value) @command.brightness(0, value) self end |
#hue(value) ⇒ Object
Set the hue, value: 0 to 255 (red). See Milight::V6::Color for predefined colors.
61 62 63 64 65 |
# File 'lib/milight/v6/all.rb', line 61 def hue(value) @command.hue(0, value) self end |
#night_light ⇒ Object
Enable night light mode.
25 26 27 28 29 |
# File 'lib/milight/v6/all.rb', line 25 def night_light @command.night_light(0) self end |
#off ⇒ Object
Switch the lights off.
18 19 20 21 22 |
# File 'lib/milight/v6/all.rb', line 18 def off @command.off(0) self end |
#on ⇒ Object
Switch the lights on.
11 12 13 14 15 |
# File 'lib/milight/v6/all.rb', line 11 def on @command.on(0) self end |
#saturation(value) ⇒ Object
Set the saturation, value: 0% to 100%.
68 69 70 71 72 |
# File 'lib/milight/v6/all.rb', line 68 def saturation(value) @command.saturation(0, value) self end |
#temperature(value) ⇒ Object
Set color temperature, value: 0 = 2700K, 100 = 6500K.
39 40 41 42 43 |
# File 'lib/milight/v6/all.rb', line 39 def temperature(value) @command.temperature(0, value) self end |
#wait(seconds) ⇒ Object
Wait before continuing to next command.
75 76 77 78 79 |
# File 'lib/milight/v6/all.rb', line 75 def wait(seconds) sleep(seconds) self end |
#warm_light ⇒ Object
Set color temperature to warm light (2700K).
46 47 48 49 50 |
# File 'lib/milight/v6/all.rb', line 46 def warm_light @command.temperature(0, 0) self end |
#white_light ⇒ Object
Set color temperature to white (cool) light (6500K).
53 54 55 56 57 |
# File 'lib/milight/v6/all.rb', line 53 def white_light @command.temperature(0, 100) self end |