Last active
August 29, 2015 14:22
-
-
Save tlberglund/1a1130c4c6be4bdc415c to your computer and use it in GitHub Desktop.
A script to set my Hue lights from video conference and work modes quickly
This file contains 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 characters
#!/usr/bin/ruby | |
# | |
# See https://github.com/soffes/hue for deets on the API. This script requires | |
# the Gem be installed, which is documented at the same URL. | |
# | |
require 'hue' | |
# | |
# I created these maps by hand, inspecting my Hue configuration to see which | |
# light IDs were active and what their settings should be. You can change these | |
# to be whatever set of lights you want, and whatever parameters you want. The | |
# set_lights method will just iterate over the keys and set light state based | |
# on the contents of the inner map. It's like the fun never ends. | |
# | |
light_configs = { | |
"work" => { | |
1=> { brightness: 144, color_temperature: 467}, | |
4=> { brightness: 144, color_temperature: 467}, | |
5=> { brightness: 144, color_temperature: 467}, | |
}, | |
"call" => { | |
1=> { brightness: 215, color_temperature: 153}, | |
4=> { brightness: 215, color_temperature: 153}, | |
5=> { brightness: 215, color_temperature: 153}, | |
} | |
} | |
def set_lights(client, config) | |
config.each do |light_id, light_config| | |
client.lights[light_id-1].set_state(light_config) | |
end | |
end | |
# | |
# Run "autohue work" to set to work mode. "autohue call" sets lights to | |
# videoconference mode. Add other modes by expanding light_configs above. | |
# | |
client = Hue::Client.new | |
set_lights(client, light_configs[ARGV[0]]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment