Created
February 6, 2016 21:09
-
-
Save davidwkeith/3c2654cd0e3bb00afec8 to your computer and use it in GitHub Desktop.
Revisions
-
davidwkeith created this gist
Feb 6, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ require 'hue' CANDLE_COLOR_RANGE = [*2000..2200] # Kelvin, 2000K is lowest Hue can do CANDLE_BRIGHTNESS_RANGE = [*20..52] bridge = Hue.application candle = Hue::Bulb.new(bridge, 1) candle.on if candle.off? loop do begin candle.color = Hue::Colors::ColorTemperature.new CANDLE_COLOR_RANGE.sample candle.brightness = CANDLE_BRIGHTNESS_RANGE.sample @delay = (rand * 0.2200) + 0.08 rescue puts 'delaying 2 seconds' @delay = 2 end sleep @delay end