class Milight::V6::Zone
Commands for lamps in a specific zone.
Attributes
zone_id[R]
Public Class Methods
new(command, zone_id)
click to toggle source
# File lib/milight/v6/zone.rb, line 9 def initialize(command, zone_id) @command = command @zone_id = zone_id end
Public Instance Methods
brightness(value)
click to toggle source
Set brightness, value: 0% to 100%.
# File lib/milight/v6/zone.rb, line 50 def brightness(value) raise ArgumentError, "Please supply a brightness value between 0-100." if value.negative? || value > 100 @command.execute(zone_id, [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/zone.rb, line 79 def hue(value) raise ArgumentError, "Please supply a hue value between 0-255." if value.negative? || value > 255 @command.execute(zone_id, [0x31, 0x00, 0x00, 0x08, 0x01, value, value, value, value]) self end
link()
click to toggle source
Link/sync light bulbs.
# File lib/milight/v6/zone.rb, line 15 def link @command.execute(zone_id, [0x3D, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00]) self end
night_light()
click to toggle source
Enable night light mode.
# File lib/milight/v6/zone.rb, line 43 def night_light @command.execute(zone_id, [0x31, 0x00, 0x00, 0x08, 0x04, 0x05, 0x00, 0x00, 0x00]) self end
off()
click to toggle source
Switch the lights off.
# File lib/milight/v6/zone.rb, line 36 def off @command.execute(zone_id, [0x31, 0x00, 0x00, 0x08, 0x04, 0x02, 0x00, 0x00, 0x00]) self end
on()
click to toggle source
Switch the lights on.
# File lib/milight/v6/zone.rb, line 29 def on @command.execute(zone_id, [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/zone.rb, line 88 def saturation(value) raise ArgumentError, "Please supply a saturation value between 0-100." if value.negative? || value > 100 @command.execute(zone_id, [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/zone.rb, line 59 def temperature(value) raise ArgumentError, "Please supply a temperature value between 0-100 (2700K to 6500K)." if value.negative? || value > 100 @command.execute(zone_id, [0x31, 0x00, 0x00, 0x08, 0x05, value, 0x00, 0x00, 0x00]) self end
unlink()
click to toggle source
Unlink/clear light bulbs.
# File lib/milight/v6/zone.rb, line 22 def unlink @command.execute(zone_id, [0x3E, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00]) self end
wait(seconds)
click to toggle source
Wait before continuing to next command.
# File lib/milight/v6/zone.rb, line 97 def wait(seconds) sleep(seconds) self end
warm_light()
click to toggle source
Set color temperature to warm light (2700K).
# File lib/milight/v6/zone.rb, line 68 def warm_light temperature(0) end
white_light()
click to toggle source
Set color temperature to white (cool) light (6500K).
# File lib/milight/v6/zone.rb, line 73 def white_light temperature(100) end