Changing the Hue bulbs into Christmas colors

by mdelfs on November 20, 2012

Here’s a simple Applescript to change the Hue bulbs from red to green, for the holidays. This assumes you have 2 bulbs next to each other, but, by taking out one of the lines below, it will work with 1 bulb. Save it as an application and just let it run!

property startColor : ""
property beginTransisiton : ""

--turn the bulb on

set turnOn to the quoted form of "{\"on\": true,\"bri\": 254}"
do shell script "curl --request PUT --data " & turnOn & " http://yourHueIP/api/yourToken/lights/3/state/"
do shell script "curl --request PUT --data " & turnOn & " http://yourHueIP/api/yourToken/lights/4/state/"
on idle
set startColor to "1400"
set beginTransition to "{\"hue\": " & startColor & ", \"sat\": 254,\"bri\": 254}"
set beginTransisiton to the quoted form of beginTransition
delay 1
do shell script "curl --request PUT --data " & beginTransisiton & " http://yourHueIP/api/yourToken/lights/3/state/"
do shell script "curl --request PUT --data " & beginTransisiton & " http://yourHueIP/api/yourToken/lights/4/state/"
delay 5
set endColor to "25000"
set beginTransition to "{\"hue\": " & endColor & ", \"sat\": 254,\"bri\": 254}"
set beginTransisiton to the quoted form of beginTransition
delay 1
do shell script "curl --request PUT --data " & beginTransisiton & " http://yourHueIP/api/yourToken/lights/3/state/"
do shell script "curl --request PUT --data " & beginTransisiton & " http://yourHueIP/api/yourToken/lights/4/state/"
return 3
end idle

{ 0 comments }

Video: Changing the Hue Lights With Custom PHP Interface

November 16, 2012

In my last video, I showed controlling the lights with Applescript. This time, I use some custom PHP to control the lights and bypass the Philips Hue software.

Read the full article →

Using PHP to access the Hue bulbs from the Internet

November 16, 2012

I have found that using PHP to access the Philips Hue bulbs is a bit easier when you are not behind your firewall. First off, the Hue wifi station uses port 80, so you will need to open this port on your router and direct this external traffic to the internal IP address of your [...]

Read the full article →

Getting the Hue bulb’s status with Applescript

November 16, 2012

Often, I like to poll the bulb to see if it’s off or on with Applescript. Here’s a quick few lines of code to tell you whether the bulb is on or off. Note the API token is being used here, as well as the number of the bulb. In this example, I am polling [...]

Read the full article →

How To Get The Hue’s API Token

November 16, 2012

Before you do any scripting of the Philips Hue bulbs, you will need a token from the Hue base station. Here’s how to do it with AppleScript’s script editor: set getToken to the quoted form of “{\”username\”: \”YourHash\”, \”devicetype\”: \”YourAppName\”}” set theFinalToken to do shell script “curl –data ” & getToken & ” http://yourhueip/api/” After [...]

Read the full article →

Fading the Hue with Applescript

November 16, 2012

Here’s a video of my bedroom light, being faded from red to purple, using an Applescript.

Read the full article →