class Milight::V6::Bridge

Commands for the bridge lamp (iBox model 1).

Public Class Methods

new(command) click to toggle source
# File lib/milight/v6/bridge.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/bridge.rb, line 26
def brightness(value)
  raise ArgumentError, "Please supply a brightness value between 0-100." if value.negative? || value > 100

  @command.execute(1, [0x31, 0x00, 0x00, 0x00, 0x02, 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/bridge.rb, line 43
def hue(value)
  raise ArgumentError, "Please supply a hue value between 0-255." if value.negative? || value > 255

  @command.execute(1, [0x31, 0x00, 0x00, 0x00, 0x01, value, value, value, value])

  self
end
off() click to toggle source

Switch the light off.

# File lib/milight/v6/bridge.rb, line 19
def off
  @command.execute(1, [0x31, 0x00, 0x00, 0x00, 0x03, 0x04, 0x00, 0x00, 0x00])

  self
end
on() click to toggle source

Switch the light on.

# File lib/milight/v6/bridge.rb, line 12
def on
  @command.execute(1, [0x31, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00])

  self
end
wait(seconds) click to toggle source

Wait before continuing to next command.

# File lib/milight/v6/bridge.rb, line 52
def wait(seconds)
  sleep(seconds)

  self
end
white_light() click to toggle source

Set color to white light.

# File lib/milight/v6/bridge.rb, line 35
def white_light
  @command.execute(1, [0x31, 0x00, 0x00, 0x00, 0x03, 0x05, 0x00, 0x00, 0x00])

  self
end