class Milight::V6::All
Commands for lamps in all zones.
Public Class Methods
new(command)
click to toggle source
# File lib/milight/v6/all.rb, line 7 def initialize(command) @command = command end
Public Instance Methods
brightness(value)
click to toggle source
Set brightness, value: 0% to 100%.
# File lib/milight/v6/all.rb, line 33 def brightness(value) raise ArgumentError, "Please supply a brightness value between 0-100." if value.negative? || value > 100 @command.execute(0, [0x31, 0x00, 0x00, 0x08, 0x03, value, 0x00, 0x00, 0x00]) self end
hue(value)
click to toggle source
Set the hue, value: 0 to 255 (red). See Milight::V6::Color
for predefined colors.
# File lib/milight/v6/all.rb, line 62 def hue(value) raise ArgumentError, "Please supply a hue value between 0-255." if value.negative? || value > 255 @command.execute(0, [0x31, 0x00, 0x00, 0x08, 0x01, value, value, value, value]) self end
night_light()
click to toggle source
Enable night light mode.
# File lib/milight/v6/all.rb, line 26 def night_light @command.execute(0, [0x31, 0x00, 0x00, 0x08, 0x04, 0x05, 0x00, 0x00, 0x00]) self end
off()
click to toggle source
Switch the lights off.
# File lib/milight/v6/all.rb, line 19 def off @command.execute(0, [0x31, 0x00, 0x00, 0x08, 0x04, 0x02, 0x00, 0x00, 0x00]) self end
on()
click to toggle source
Switch the lights on.
# File lib/milight/v6/all.rb, line 12 def on @command.execute(0, [0x31, 0x00, 0x00, 0x08, 0x04, 0x01, 0x00, 0x00, 0x00]) self end
saturation(value)
click to toggle source
Set the saturation, value: 0% to 100%.
# File lib/milight/v6/all.rb, line 71 def saturation(value) raise ArgumentError, "Please supply a saturation value between 0-100." if value.negative? || value > 100 @command.execute(0, [0x31, 0x00, 0x00, 0x08, 0x02, value, 0x00, 0x00, 0x00]) self end
temperature(value)
click to toggle source
Set color temperature, value: 0 = 2700K, 100 = 6500K.
# File lib/milight/v6/all.rb, line 42 def temperature(value) raise ArgumentError, "Please supply a temperature value between 0-100 (2700K to 6500K)." if value.negative? || value > 100 @command.execute(0, [0x31, 0x00, 0x00, 0x08, 0x05, value, 0x00, 0x00, 0x00]) self end
wait(seconds)
click to toggle source
Wait before continuing to next command.
# File lib/milight/v6/all.rb, line 80 def wait(seconds) sleep(seconds) self end
warm_light()
click to toggle source
Set color temperature to warm light (2700K).
# File lib/milight/v6/all.rb, line 51 def warm_light temperature(0) end
white_light()
click to toggle source
Set color temperature to white (cool) light (6500K).
# File lib/milight/v6/all.rb, line 56 def white_light temperature(100) end