I want to create a nested condition on IFTTT or otherwise (2014)

How do I set up the following:

  1. Garage lights are on from sunset to 11pm.
  2. I want lights to come pon if I come home after 11 and then turn off 5 mins later.

So I want:
IF after 11pm
AND I arrive home
THEN Turn on garage lights
THEN Turn off garage lights 5 mins later

Anyway to do this?


IFTTT doesn’t do ANDs and ORs. I think you’d need to look into building a smartapp for this.

I don’t think the smart apps can do ANDs or ORs either. at least not the ones they provide you with. Unless your AND or OR is a Mode.

Wouldn’t this all be in the mode? If you are in night mode and presence is detected, it would trigger different actions than other modes…right?

The issue here is it might be 11pm but it is not “night” or “sleep” mode… :frowning:

You can definitely write AND/ORs into SmartApps if you write them yourself. If you look at the sample code they give you, it’s pretty easy to figure out.

Check out my SmartApp named: On when open, then off Sunset/Sunrise only

It’s in the Shared SmartApps area. It does almost exactly what you want. It looks for open/close after sunset rather than coming home, but should be pretty easy to adapt.


After looking at the dashboard options a little bit, I think you can do this with the built in functions.

Select the light you want to control, then Turn on when people arrive.
Now select which people.

If you scroll down there are options for Turn off after a certain duration.

And further down there are options for times when you want this to happen. The only problem here is you can’t specific sunset… you’ll just have to pick a beginning and ending time. Otherwise I think it fits all your criteria.

An overdue thanks, Chrisb! Your suggestion worked.

Hi there,

I created a cloud application called apilio.io which extends IFTTT and allows you to create the setup you want without coding. Check it out and let me know if it helped!


You might want to try ImSmart. It has all the features you need and growing fast.


  • Works seamlessly with IFTTT and the majority of devices you own.
  • Enhanced control of rules allows you precise automation that you need.
  • Holds the values of your device or process state.
  • Ability to connect more than one IFTTT Maker key.
  • Execute several actions with a single trigger.
  • Delay execution of trigger actions for unprecedented control.

Check it at www.imsmart.tech

As others have said, there are many different ways to do this, but as of today, March 2017, most people would use core. :sunglasses:

I may be late to the party on this posting, but here is my CoRE solution. You can substitute anything for the motion sensor in my example, like location or presence.

Before you begin, turn on Advanced Mode by going into Settings->ExpertFeatures->Expert Mode

Here we are 4 years later and I’ve just discovered your application. I wish it had direct integration with SmartThings!

Many things have changed in the last 4 years including community-created code and official features. You would not need a third party app unless you were trying to communicate with a device that doesn’t have SmartThings integration. Otherwise you could do everything the OP asked with WebCore or the Rules API. See the community-FAQ: