0.01
No commit activity in last 3 years
No release in over 3 years
A library to control and query Philips Hue lights
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0.10.0
>= 1.6
 Project Readme

Lights App

This is a library for accessing and controlling your Philips Hue lights using Ruby.

TL;DR:

Install with gem install philips_hue. Check out the bin/ directory for examples of how to use this project and what kind of things you can do.

Registering with the Bridge

You need two things to connect with your Hue, a name for your app and the IP address of the white Hue bridge.

  • The IP address can be found on the Hue Community site. Login, go here, click "Show me more," and find the IP under "Internal IP address." Example: "192.168.1.14"
  • The app name can be anything you like. You must register your app with the Hue by running PhilipsHue#register and pressing the button on the bridge. You must do this again for every new app name you create. Example: "my light app"
  • Skip this step by running the bin/register.rb script.

For example:

  PhilipsHue::Bridge.register("my light app", "192.168.1.14")

Getting the State of a Light

There are many available status options in the Light class.

  hue = PhilipsHue::Bridge.new("my light app", "192.168.1.14")
  light1, light2, light3 = hue.lights
  puts light1.state
  puts light1.colormode
  puts light2.brightness
  puts light3
  # => "Front right is on and reachable"

Changing the Color of a Light

To change the state of a light, simply modify the value of one of the state parameters. For example:

  light1.xy  = [0.6446, 0.3289]
  light1.ct  = 200
  light1.hue = 25000
  # etc.

Helper Methods

Some helper methods, including default color options, are provided. For example:

  light1.blue
  light2.red
  light3.green
  light1.blip  # blink once
  light2.blink # blink repeatedly
  light3.flash([0.6446, 0.3289]) # flash red

See Also