Getting a Routine to run after a set time only after someone is home?

I have a routine that I had running at 5.30pm only if someone is home (ie mode is set to home).

Problem with this is if we come home after 5.30pm then this routine will not run.

The routine I mention above all it does is set the Mode to “night”. I then use the mode changing to night to trigger a virtual thermostat that controls a heater in a bedroom (using a smart switch and multipurpose sensor).

So is there a way to get mode to set to “Night” any time after 5.30pm that someone is home?

Hope that makes sense?

Can you post a screenshot of the automation that you currently have set up?

Jumping in a little early, because @JDRoberts asked a good question, but I think I might be able to help. I have several routines that run at specific times, or more precisely, within certain timeframes and triggered from a variety of ways. Not making any promises, but what you are asking sounds like things I have set up for our situation.

Hi. Not sure how to give you the info in ‘a’ screen shot but here are a few:

Routine to set mode to night mode at 1730 as long as we are not away:

The Routine that runs when one of us gets home. I have since added for this not to happen if Mode is already “Night”. My thinking here was that the “I’m back” routine will run when any one of the 3 people loaded get home as far as I am aware. So if the first person is home and then then Good Night! routine runs to set the mode to night and then someone else came home it would change it back to “Home” (previously).

This is my virtual thermostat setttings:

So, I think this all works BUT only if someone comes home before 1730. Otherwise the mode doesn’t get set to “Night” and therefore the Virtual thermostat doesn’t activate.

I have a thought of using a virtual switch to turn on at 1730 but not sure how I can work that yet…

Ok, " at a certain time" means just that–at that exact time.

Instead, you want to use “restrictions” to set a range when the automation is allowed to operate. That way when someone comes home during that range, the automation will run.

You can further restrict it by using modes if needed, so that only the first person coming home will trigger it.

To set up this kind of two level automation (trigger by arrival, but only within a range of time) use the official smart lights feature instead of a routine. Use “more options” at the end of the rule to set the time restriction.

See the second example in the official knowledge base article

Once you have SmartLights set up to fire when desired, you can have it turn on a virtual Switch and have that Switch coming on be the trigger for a separate routine that does all the other stuff like set the thermostats. Just remember to have the routine turn the virtual Switch off again so it’s ready for the next day. :sunglasses:

1 Like

Is this article still current?

As far as I know, it’s current, but it’s for the new “SmartThings (Samsung Connect)” app, not the “SmartThings Classic” app. They have different rules engines (for example, there are no “routines” in the new app).

.

https://support.smartthings.com/hc/en-us/articles/360000114006-New-SmartThings-app-FAQ

that why i couldnt find it in my app

1 Like

Thanks! Much appreciated.

I’ve had a look at the Smartlights app but not sure how I can get this to work for all use cases.

Eg. I could use it to turn on a virtual switch when someone comes home between certain times and use the switch to trigger a mode (Night) that the virtual thermostat uses as it’s trigger to start controlling. Then at a time in the morning I can use a routine to turn the heater off and the virtual switch off and change the mode to Home so the virtual thermostat will stop controlling.

What about the use case that we do not leave the property during the day. Ie no one will be coming home so the virtual switch will not get triggered, the mode will not change to night and the virtual thermostat will not trigger.

I guess I am missing something. :thinking:

What I do is similar to what @JDRoberts suggested, where I have a virtual switch do a lot of the heavy lifting. Here’s my suggestion to how you fix your issue:

  1. Install this smartapp: https://github.com/MichaelStruck/SmartThings/blob/master/IFTTT-SmartApps/Switch-Changes-Mode/Switch%20Changes%20Mode.groovy
  2. Create a virtual switch.
  3. Set that virtual switch to change modes using the smartapp from step 1.
  4. Use SmartLights to write the following rules for turning that switch on/off:
    A. One to turn the switch on (thus setting the home to night) at 5:30, but only when the mode is home
    B. One to turn the switch on based on someone arriving, but only after 5:30.
    C. One to turn the switch off at some time in the morning, but only if the mode is still night (meaning
    everyone is still home).

I believe those steps will get this heater turned on/off at the appropriate times for you.

1 Like

Thanks again.

Had another play this morning and I ‘think’ I have something that will work now.

  • Virtual thermostat that requires state to be in ‘Night’ - I want ‘Night’ to be after 1730 each night
  • I have a routine that changes the mode to ‘Night’ at 1730 IF mode is ‘Home’ (someone is home)
  • I have a Smart lights automation to turn on a virtual switch between 1731-0300 IF mode is in ‘Home’ or ‘Away’ when someone comes home.
  • I then have a further routine that switches the mode to ‘Night’ when the virtual switch is turned on
  • At 6am I have the ‘Good morning’ routine turning off the heater and virtual switch and turning the mode back to home.

I think that covers it…:thinking:

1 Like

I think that looks good! One of my favorite things about SmartThings is that there are multiple ways to solve a problem.

1 Like

I have a very similar situation, my automation is to turn on the backyard lights if the time is between sunset and sunrise and the mode is set to home. The thing is if I am back home earlier than sunset (and thus the mode is set to home prior to sunset) the automation will not trigger. Looks to me like even both conditions are met at sunset time, what really triggers the event is a change in the conditions.

I made some trials and noticed that if I manually force the mode to away (when I’m actually at home) and then switch back to home between sunset and sunrise the automation will work. But will never triggers if the mode is home prior to sunset time.

My turnaround was to create another automation that triggers specifically at sunset and if mode is home. This way when I’m already at home it will trigger at sunset, and if I’m away and made it home during the specified time frame the original automation will trigger. To me this is kind of a bug but it works.

Its been a year since the original post, but may be helpful still