Connecting to Philips Hue Lights

This example shows a decentralized way of directly interacting with the Philips Hue lighting system without relying on a cloud based service. (For comparison, see how you can hook things up using IFTTT here). It also serves as a basic example showing how you can use simple command line tools to do some neat things in Linux, with the help of additional sensing hardware attached to the Raspberry Pi!

Prerequisites 

Make sure the command line examples are working before proceeding. You should have at least one bulb connected to your Hue system, and a functioning network where the Hue app can find the bridge, and see/control the lights connected to it. Also, since this is a networked example, we assume that you’re using a Raspberry Pi with built in or external ethernet/wifi!

Connect a single analog sensor to your PiShield. (See this page for detailed setup instructions)

IMG_1943

Setting Up

From here, you will need to acquire the IP address and an API key from the Hue bridge. Official instructions from Hue can be found here. Save these values into two text files, called ip.txt and api.txt

For example, this is what the contents could look like:

ip.txt:
192.168.1.150

api.txt:
b12342dddde43ca3bdc4d2e18678263

make sure it is a plain text file and contains nothing except the above!

Get Scripts and Run!

Next, download the bash script suite from this git repo, which can be done via the following in a terminal on the Raspberry Pi:

git clone https://github.com/johnty/HueControllerBash

and place the api.txt and ip.txt files into the directory.

Now you should be able to run the various scripts in the folder. Go into the directory, and launch the example:

cd HueControllerBash/pi
./HueAnalog.sh

Assuming you have at least one light in your system, you should now see the first light’s brightness fluctuate as the sensor value on the first channel of the PiShield is changed.

hue

 

1 thought on “Connecting to Philips Hue Lights

  1. Pingback: Interactive Lighting Demo – Infusion Systems

Leave a Reply