Streamlined Whole-House Scene Controls

I currently have 9 modes. 4 modes are “automatic”, and are run based on either (1) time of day or (2) sunset/sunrise (ex: Sleepytime, Morning, Day, and Night). The other 5 modes are used when I invoke them manually (Dinner, BabySitting, Late, Movies, Vacation). As I discuss below, I don’t set up Home/Away modes - instead rely on virtual switches to check if certain combinations of family members are present.

I use the following three Apps (the code for all three Apps can be found here for setting up and controlling different scenes for every room, for different times, for difference family members, and for all 9 of my Modes:


Whole House Scene Creation and Control App - sets up Color, Levels, and/or On/Off for any Mode you have. Most of the code of this App comes from the wonderful “Dim & Dimmer” App by @geko. Use my “Motion and Contact Trigger” App to set up accompanying motion and contact trigger events for use with 1 or more Modes/Scenes.

  1. Select the Hues, Dimmers, and/or Switches that you want.
  2. For each Mode, just enter the desired Scene Lighting parameters. These will be used whenever the Mode is invoked.

Motion and Contact Trigger App - sets up motion & contact triggers that invoke the parameters from my “*Whole House Scene Creation and Control App”. Turns off lights if no motion after “X” minutes.

  • I use virtual switches to identify whether certain combinations of family members are present (and thus whether motion/contact should trigger), but you could easily change that to run based on one or more Presence sensors.

Individual Scene Selection App - can be used in conjuction with above 2 Apps or used completely alone. You can select Color, Level, and On/Off, and can select motion & contact sensors to trigger.

  • Because I use virtual switches to identify whether certain family members are present, I can set up multiple lighting Scenes for each mode - each of which will run only if a virtual “presence” switch is ON. Again, you could easily change this to run based on one or more Presence sensors.

Please let me know if you like/dislike, identify any bugs, or have any suggestions. Thanks!!!

-Tony

6 Likes

I get an error when setting up “Whole House Scene Creation & Control via Modes”

[quote]startup failed: script1420813312717141831876.groovy: 41: unexpected token: ) @ line 41, column 1. ) ^ 1 error
[/quote]

The reason I am trying this, is because I am hoping to setup different modes for different times of day. So if I come home in the evening it will switch to Evening mode after a certain time or after Sunset. If I come home in the afternoon then it will switch to that mode.

Right now I have 4 Automatic modes. Night, Morning, Afternoon and Evening. SmartThings is currently not smart enough to switch to these when arriving home at different times of day.

Korbin-

Thanks. There was a random parenthesis in the original version on github - I updated it and tested that this version works.

Try creating a virtual “presence” switch (create a new device using the “On/Off Button Tile” Device Type) and then set up two (or more) Hello Home actions that turn that switch on or off based on you (and maybe other people’s) arrival and departure.

Under my setup, your home will always be in the correct mode, regardless of presence. The triggering events will only occur if the selected virtual presence switch is on. And you can then customize when any of your selected virtual presence switches turns on/off.

Hope this helps.

Tony

Thanks for the idea. When I get a bit I’ll give it a try. I just wish smartthings was smarter. :wink:

No problem. ST is really quite smart. Its just a little obtuse sometimes. :sunglasses:

Tony, I set up virtual presence switches for each family member and can select them in the Motion and Contact app but they do not show up in the individual scene control app. Are these switch selections different?
The switches were set up using on/off tiles
Thanks
Jay

Jay-

Sorry about that. In order to reduce the switches that were showing up, I filtered the switches by looking for those with “capability.button” – and I had added that capability to the stock On/Off Tile device code.

I updated the “Individual Scene Selection” app on Github (link) so that all of your switches will show up.

Alternatively, you can fix the version you have - just change “capability.button” to “capability.switch” on line 53.

Please let me know if that works for you.

Tony

Tony thanks that worked just fine. One more thing, is it possible to make a code change that would allow for more than one selection of virtual switch under the motion contact and trigger app.
There are some instances such as our master closet where my wife and I would both want the light to come on. It would prevent me from having to set two different apps for each of us. Thanks!
Jay

Tony, figured out the code change necessary.

Thanks

Tony, thank you for this contribution. After having SmartThings for several weeks, I’m realizing the idea of using a virtual presence switch make more sense for my use cases than the default home/away modes.

I’ve been able to use your motion/contact trigger app to successfully build the Red Hue nightlight I’ve been struggling to put together since I’ve gotten the gear.

Can you expand on how you leverage the “Whole House Scene Creation and Control App”? I’m not fully grokking how I can switch the house to specific lighting based on presence, or how this app can be combined with the other two.

One tangible example of how these apps are combined may make it click in my head.

Let me share some code with you. I am using simulated presence sensors + SmartApps to do this. Its more work initially but opens up more capability for other apps that understand Presence rather than a Switch

I set up a different mode for each of the lighting “Scenes” that I use. I have 5 modes that are automatically triggered in a 24-hour period: “Morning” - triggered when motion in hallway after sunrise; “Day” - triggered at 11 am; “Night” - triggered at sunset; “Late” - triggered at 11 pm; and “Sleepytime” - triggered at 2 am. The Whole House app sets the color and level of any hue lights and/or the level of any dimmer lights for each of those modes – BUT none of those lights turn on when those modes are triggered. The Motion & contact App causes the lights to turn on /off. If I don’t want a particular light to turn on in any particular mode, I just set the level of that light to Zero in the appropriate setting in the “Whole House” app.

I have a number of other modes that are not automatically triggered – ex: “Movies” or “Dinnertime”. I trigger those through the ST app – or, more often, through tablets running “ACTion” (absolutely amazing app).

I use a couple of different “Motion and Contact” apps for each room / area in my house. I do this because I like to have different “no motion” off times for different modes. For instance, for most modes, my living room has a “no motion” period of 45 minutes. But for my “Late” and “Sleepytime” modes, I set a “no motion” period of 5 minutes.

I hope this helps your grokking.

-Tony

Jay-

Glad you figured it out. I just didn’t have any time in the last week or so to get back to you. Let me know if I can help in future.

-Tony

Brilliant! This statement made it sink in: “The Whole House app sets the color and level of any hue lights and/or the level of any dimmer lights for each of those modes – BUT none of those lights turn on when those modes are triggered.”

Brain was wrapped around a mode change triggering actual lighting changes, not just setting the scenes to be triggered by the motion/contact apps.

Version 1.1 of “Whole House Scene Creation and Control App” now on Github.

Major changes include:

  1. App now allows for monitoring of selected lights for physical switch overrides. This addresses the problem of lights losing scene settings if someone turns physical light switch off / on. Hue lights normally default to 100% level and white light. Under this version, the maximum light level for any light is forced to 98 (the difference between 100 and 98 is not noticeable). If App detects a monitored light to have a 100% level, it re-sets all the lights to the current scene settings.

  2. App now only update lighting settings if mode changes, if user presses App, or if detects 100% level of monitored light (previous version sent unnecessary updates to lights in correct states).

  3. Added small delay in lighting settings to minimize chance of rate limiting by Hue Hub.

Please let me know your comments / thoughts!

Tony

2 Likes

Hi Tony! I really like the work you’ve done so far here! I got super fired up reading this thread as – if my understanding turns out to be correct – this kind of approach will make my current setup a lot better – and my wife happier. :smile:

Here’s one thing I don’t quite understand, though. You said:

The Whole House app sets the color and level of any hue lights and/or the level of any dimmer lights for each of those modes – BUT none of those lights turn on when those modes are triggered.

That sounds perfect, but what I am observing is that the levels established in the Whole House Scene Creation and Control App actually do turn on lights when the modes change.

So if, for example, I thought to myself “If/when something triggers my bathroom light to turn on at night, I’d like its level to be 5%”. But the transition into “Night” mode is actually turning that light on at that level, permanently.

I believe this is because – at least for me – issuing a setLevel command to a dimmer causes the dimmer to immediately turn on and go to that level. Which is sort of the opposite behavior to the quote above.

Unless my understanding of setLevel is wrong (or my dimmers are weird?), I’m thinking that this must be what’s happening for you as well. And, in that case, I’m wondering if maybe I misunderstood how you are making this work for your situation.

Thanks for helping me understand!

Reed-

Thanks for your kind words!

What kind of dimmers are you using? I am using Hue lights for the most part.

-Tony

What kind of dimmers are you using? I am using Hue lights for the most part.

I have some Hue bulbs as well, but the bulk of my lighting is on Evolve LRM-AS dimmers (aka Linear), and a couple of GE/Jasco 12724 ones. I hate the GE/Jasco ones as they have proven unreliable and peculiar, and I hope to replace them ASAP.

Anyway – the basic problem with dimmers like both of these, when coupled with the approach you’ve described here, is that at a hardware level the dimmers can’t set a level without actually switching to that dimmer level (and turning on in the process). A few threads about this limitation are here and here.

I’ve been mulling it over and I really do like the methodology you’ve proposed here. And so does my wife. :smile: So, I’m working on some modifications to your Scene Creation app that make use of the approach (and optionally the custom device type) @bravenel describes in the second link above. The idea leverages your pollMonitored() → resetLevel() approach… but I’m going to adapt that to also allow changing these annoying dimmers “gently” vs “immediately” for each device, as follows:

  • Immediate devices: Upon mode change, go directly to the level in question. As in, just call setLevel() and be done with it. (I’ll use this for stuff like “just go ahead and shut off the downstairs lights when Sleepytime mode becomes active”.)

  • Gentle devices: Upon mode change, if device is off, use the “setLevel() then immediately turn off” approach to simulate a “silent” level change as best we can. If device is not off, wait for a switch-off event then immediately apply the “setLevel() then immediately turn off” trick.

It’s similar to what you are doing for physical switch-on events for Hue bulbs… but in this case I’m watching for the non-presettable dimmers to enter a state where they can be “poked” as unobtrusively as possible (i.e. I’m waiting for them to switch off, when necessary.)

If you’re interested, I can post the diffs or put them up on github…

This is exactly what my app does that uses the modified device type. If the device is on at mode change, I just set a state flag to reset its dimLevel when it is turned off. We discovered that dimming lights that are already on at a mode change was unsettling to people.

EDITED TO ADD

Most of my lights are turned on by motion sensors, so for those there is no need to change the physical dimmer level at a mode change, because motion just causes a setLevel() to put it at the right level instantly (Cree bulbs have a very short lag caused dim change). My app updates internally the desired dimLevel at each mode change, without touching the lights.

So I only bother resetting physical dimLevels for lights NOT turned on by motion, where they will usually be turned on by the wall switch. That’s where you don’t want the bathroom light coming on full bright for a second – in the middle of the night – before it resets to 5%.

@schmedlock & @bravenel -

Can you guys each post a link to the revised code (when you’ve finished, of course)?

I would like to take a look, and others might find your versions helpful as well.

Thanks!