How I created automated lighting "Scenes" for Hue lights & regular switches

In my living room alone, I have about 8 different lighting “scenes” for a variety of hue & non-hue lights. I really wanted more control over which scene would run than what I was able to do achieve just using “hello home” actions and/or any one SmartApp. It took me a while to figure out a configuration that works for me, so I thought I would share.

Overview of the Setup

There are basically three components to my setup: (1) a virtual switch for each scene, (2) an app that causes the virtual switch to turn on based on any number / combination of triggering events, and (3) an app that monitors the virtual switch and that runs the lighting “scene” when the virtual switch is turned on. I like this setup because it separates the triggers from the actions, and thereby gives my home setup much more flexibility.

The Devices & Apps I use for those 3 components:

  1. I use the “On / Off Button” device type for my virtual switches.
  2. I use the default Hue Mood Lighting app to cause a virtual switches to turn on. Even though I’m not controlling a Hue light in this step, I like that smartapp because it contains complex code for multiple triggering events for each scene.
  3. I use this SC4HL (“Switch Control for Hue Lights”) app to monitor the virtual switch and then to run the selected lighting scene. This app can trigger on or off 2 separate groups of hue lights & and 2 separate groups of switches. Each group of hue lights can contain different color and level. This app also turns off the scene through monitoring no motion in 1 or more selected motion detector for the time I want.

Real-world example #1:

  1. I created a virtual switch called “LR Morning Scene.”
  2. I have the Hue Mood Lighting app trigger that “LR Morning Scene” switch through any one of the following events: at 7 am, by motion in my Living Room motion detector (only when the mode is “Morning”), by the Front Door opening (also only when the mode is “Morning”), or by my wife’s or my arrival via presences tags (also only when the mode is “morning”). **I have a “Hello Home” action turn the mode to “Morning” a little after sunrise.
  3. I use my SC4HL app to monitor the LR Morning Scene switch, and to set a nice mellow lighting scene for about half of my living room and kitchen lights. I set the app to turn the scene off when there is no motion for 30 minutes in either the Living Room or Hallway motion detectors.

Real-world example #2:

  1. I created a virtual switch called “LR Sleepy Scene.”
  2. I have the Hue Mood Lighting app trigger that “LR Sleepy Scene” switch through any one of the following events: at midnight, by motion in my Living Room or Hallway motion detectors (only when mode is “Sleepytime”), or by the Front Door opening (also only when mode is “Sleepytime”). **I have a “Hello Home” action turn the mode to “Sleepy” at midnight.
  3. I use my SC4HL app to monitor the “LR Sleepy Scene” switch, and to set just few key lights to Blue at 10%. I have the scene turn off when there is no motion for 5 minutes in either the Living Room or Hallway motion detectors.

Again, this setup may be unnecessarily complex for some, but it really allows for specific, customized automatic control of a lot of different scenes through a lot of different triggers. As an added bonus, I use an old tablet to run Alex625’s “ACTion” smartapp and include the LR scenes - this gives me (and THE WIFE) easy manual override.

5 Likes

This is how I imagined the Smartthings would just work by default when I bought all of it. Thanks for pulling this together, I’m looking forward to trying it out. I’ll probably add on some Sonos speaking the weather stuff for the morning action!

I’m wondering, since we have highly variable wake up times (sometimes the SO wakes up at 4am, sometimes 7am, etc), is there a way to make a variable wakeup time?

This is awesome. I setup a scene for movie night triggered by a hello home action. Thanks for the code.

BTW - I had to delete a } from one line of both the Scene Control and Global Trigger to install them. Not sure if that’s common, but I haven’t had to do that so far for any other apps.

Courtesy: OnSwitch app (iOS)

Triggered automatically?

Unfortunately not. It’s just a third party app which always works but may or may not screw up your hue states in ST. :frowning: but worth it for 99 cents or something like that… I use it now on daily basis and its local only unlike iConnectHue remote trigerring.

Thanks. With regard to the extra } - I haven’t checked this code in a while because I wrote what I consider to be a better set-up.

Check new set-up here.

@infofiend was there any reason to require the “And then turn off when there’s been no movement for” section of the code? I’d like to just use this to change colors on my hues (outside lights, for Christmas, etc) which already come on and off at sunset / sunrise (they’re on an insteon switch which is turned on and off by SmartThings). I used "6,000 minutes’ so they should stay on all night and hopefully not actually try to do anything 6,000 minutes in the future.

No “reason” to require it - except that I always want to turn off lights if not needed.

Your solution of using 6,000 minutes will work fine.

Ok cool, I created a forked version that doesn’t require you to define minutes after motion stops, and fixes the extra “)” on line 8.

This worked really well to set the Christmas lights last night, BTW!

Really like the Green that is produced here; i’ve been using Hue Pro and their green is yellow compared to this one! First time I actually think I’m happy with a Hue Green color!