Adventures with using Philips Hue as a daylight wakeup lamp

This little howto shows how to use the Philips Hue plugin to gently* wake me up in the morning.

The goal was to have my Hue bedside lamps come on softly at the appointed time, and slowly get brighter over the next 20 minutes, eventually reaching the point where it woke me up (or woke the cats up, who then walk on my face to wake me up). Beyond what the venerable Wakeup Ramp plugin can do, I also wanted the Hue lamps to change colour temperature over the period, from warm to cool.

I did this work on UI7 but it should work exactly the same for UI5.

First install the Hue plugin. I had to patch the Hue plugin’s implementation file (attached here). The stock implementation file doesn’t give access to the lowest brightness levels because it compresses the brightness range 0-254 to 1-100. I also added a hack that let a preset turn the lamp on/off explicitly.

Now create your presets. You need at least two. One preset is for the initial lights-on level, dim and with a warm (red) colour temperature. One is for the final value, for me about 60% and a cooler (blue) colour temperature. The remaining presets (if any) are for intermediate settings; in my example there aren’t any intermediate settings.

The UI for setting these presets is a bit hacky, because of a longstanding bug in MCV’s handling of variables with quotation marks in their values. A process that worked well for me was:

  1. On the Colour device (not the Brightness device) press enough “Set N” buttons to create the presets you need. The actual values aren’t important, but you might want to use this opportunity to get your brightnesses and colours right.
  2. Save/Reload Luup to store these presets as variables on the Advanced tab.
  3. Open a text editor and form your preset JSON strings, using my templates below as examples.
  4. Visit the advanced tab and paste your replacement JSON strings into each of the variables marked “PresetN” (see screenshot). The old values won’t display properly (all you’ll see is a brace) but you’re going to overwrite them, which does work properly.
  5. Save again. The presets should now display properly on the device (see screenshot)

My two presets are:

{"ct":440, "bri":0, "on":true, "transitiontime":0}
{"ct":320, "bri":130, "on":true, "transitiontime":5900}

The “ct” field controls the colour temperature: 500 is reddish (2000 K), and lower numbers are progressively cooler, down to 153 (6500 K). The “bri” field is brightness, from 0 (dimmest but still on) to 254 (100%). The “transitiontime” field is how long the lamp will take to reach this final configuration in tenths of seconds: 0 is the initial instant-on preset; 5900 takes about 15 minutes to complete. The “on” field bypasses some clever (but in this case counterproductive) logic in the Hue plugin for setting the “default” brightness. You’ve got access to all of the Hue settings in the Hue API, so this can be adapted to lightstrips or bloom or Lux pretty easily.

Test this by manually pressing the preset buttons on the device, then watch and wait. Then, once you’re happy, tie each preset to a scene and stagger the scenes to happen a couple of minutes apart. I use Countdown Timers for this, but you could use PLEG or native delays too.

  • The first step’s a big one… going from Off to the lowest brightness level (0) is a bit of a jolt. It would be nicer if the dimming range was more logarithmic than linear.