SmartThings Community

Trouble changing mode when door opens/closes in time range

(Jeff B.) #1

Hi All,

As a newbie to SmartThings I’ve had a lot of luck with the system so far, and any difficulties I’ve had have generally been setting up SmartApps incorrectly. However, what I’m trying to accomplish now I haven’t found a way and my forum searches don’t seem to return a solution for the specific goal. Am I trying to use more precedence constraints than what SmartThings can currently handle? Here’s what I’m trying to do:

When the master bedroom door closes AND the time is between 9:30 PM and 4:00 AM -> change the mode to Night.
When the master bedroom door opens AND the time is after 5:45 AM AND the mode is Night -> change the mode to Morning.

Now I can easily change the mode when the door opens/closes through the routines, that’s pretty straight forward. Even having the mode restriction is simple, but I can’t seem to find a way to add the time constraints.

A solution that I have come up with is to use a larger number of modes in place of time constraints, the flow would be something like:

At 9:45 PM automatically change mode to Evening (which does nothing but represent a time frame).
When the master bedroom door closes AND the mode is Evening -> change mode to Night.
At 5:45 AM automatically change mode to Early Morning (again only representing a time frame).
When the master bedroom door opens AND the mode is Early Morning -> change mode to Morning.

This way if my girlfriend or myself has to get up in the middle of the night it won’t trigger all my Morning lights, and instead can trigger a nighttime lighting scenario that won’t blind us.

What I’m trying to accomplish is to have modes control lighting conditions (that’s about all I have set up right now), instead of relying on multiple Smart Lighting solutions which I’m concerned will eventually start to interfere with one another. Any thoughts or recommendations would be greatly appreciated.

(sidjohn1) #2

If you are on iOS check out @obycode smartrules(http://smartrulesapp.com), android or windows phone there is @JoeC simplerulebuilder (https://www.simplerulebuilder.com)

(Tim Slagle) #3

Check out our routines. This can accomplish the same things you want :smile:

1 Like
(Jeff B.) #4

I’ve been through the routines and unfortunately haven’t found a straightforward way. I know that some settings can be done for time frames, such as motion sensors, but the door sensor option has no further configurations for time frames. I suppose I can leverage the sunset with a time window of several additional hours, but that means the time frame will begin too early, and all my lights will go off before I’m actually ready for bed. Am I missing something simple?

(Tracy) #5

Does this help?

1 Like
(Jeff B.) #6

Thanks @Carinda, I’ll have to check it out at home tonight.

Guess it’s also time to start playing around in the IDE!

(Jeff B.) #7

The custom SmartApp worked like a charm, and was also a nice introduction to the IDE. I haven’t written any non-database code in roughly a decade, maybe it’s time to start playing around and see what I can do.

1 Like
(Tracy) #8

Glad to hear it! :smile:

I’m actually kinda glad to hear I’m not the only person to want that use-case.

Have fun playing around!