If I AM home between sunset and 11 pm, then turn on lights 123

Hi I am new to apilio, can anyone indicate step by step how to create with IFTTT and apilio an action like:

If I am Home (not if i get home) between sunset and 11 pm, turn on light 123

I have created with many difficulties If I GET home at night turn on light 123

Many thanks for helping me


If you have created when you get home turn on the lights. (the saem logiblock can be used.)Then you have already solved the problem
You basically need applets from your presence sensor via IFTTT to Apilio. One needs to set boolean to “home” to true when you are home and one to set “home” false if you are not home.
you need to have a weather applet to set boolean night time to true after sunset and false after sunrise.
Then 2 time applet to set boolean value to true if after 1530 (or 15 minutes before your earliest sunset depending where you live) and set it to false after 2300. This will make sure it does not run whilst its still day light
Select all three on your logiblock with Evaluate this logicblock when any connected variable changes. selected in advance options.
With action chains positive turning on lights and action chains negative turning of the lights when result is negative.
What I have explained will even run if you arrive home after dark.

Hope this makes sense

So do to that I need a pir motion sensor, I cannot use a location applet to determinate that I am home.

Yes, if you don’t have life360 (Free great if you have more then one person at home) or samsung smartthings installed on your mobile. they offer applets in IFTTT for setting Apilio to home
Alternatively IFTTT offer location services but i found it to be unreliable

1 Like

Hi @francesco.bagnera!
quote=“francesco.bagnera, post:1, topic:951”]
I have created with many difficulties If I GET home at night turn on light 123
Awesome! To rephrase your current applet, it would say “Every time I come home and it is between sunset and 11pm, turn on the lights”. So the “I come home” is the trigger and the “between sunset and 11pm” is the condition.

So now you have to switch the logic. “Sunrise” and “11pm” become the triggers to run the Logicblock, and “I am home” becomes the condition.

How did you trigger the “I come home” in your current working example? With a geofencing app?

Yes I used for "I come home Life 360 (geofencing)"via IFTTT I still wonder If I am able to run the light on if I AM at home, Is there any way to run the light if I am home without using a presence per motion?

set this up in IFTTT

then Apilio will know you are home. You will also need to do another one for when you leave home so Apilio knows you are not home.

This will tell Apilio when its night. You will need to do one for sunrise so Apilio knows its day time
Change the times and names to suite you but this is an example of an Applet to tell Apilio that the time is before 11pm

I hope this helps

Sorry but I have tried all the different ways to set this:

If I AM Home between sunset and 11 pm turn light 1,2, 3 on.

Previously I set up “when I arrive home between sunrise and sunset” by following this link step by stepby PEBNETER (Apilio team)

And it does work. Probably I don’t understand how apilio works in accordance with IFTTT
Is there anyone (Pebneter) can publish step by step (like the previous link) the action:
If I AM Home between sunset and 11 pm turn light 1,2, 3 on.

So thankful.

Can I suggest you read these https://community.apilio.com/c/getting-started/10
Then you will gain a very good understanding. with that you will see the full power of this platform

Sure, we can help you with this.
So just to be clear: If it is dark and before 11pm (e.g. 10pm) and you ARRIVE at home, the lights should not turn on. Correct?

Thank you. Exactly should be.

between sunset and 11 pm, if I AM home (not arriving home) then turn lights on.

IS it possible to arrange the automation if I AM HOME, between sunset and 11pm?
Thank you so much for your help.

Hi @francesco.bagnera! I think you have all the right components, but to show you what this looks like step by setp, this is how you would turn the light on automatically if you are home at night:

If I’m home --> we will store this in a boolean variable. It’s true when you get home and false when you leave. So if you are home, it stays true all the time.

and it’s between sunset and 11PM --> we will store this in a boolean variable as well. It will become true at sunset and false at 11PM.

then turn the lights on --> this works exactly as what you have setup already, so there is nothing to change here

How to setup the condition to check you are home

We’ll use a boolean variable to know you are home:

  1. Create your variable in Apilio. Set it to true if you are currently at home when setting it up:

  2. Set it to true if you get home with an IFTTT applet here: https://ifttt.com/create

  3. Set it to false if you leave home with an IFTTT applet:

Finish creating a condition that checks if this variable is true:

How to setup the condition to check it’s between sunset and 11PM

We’ll use a boolean variable to know if it’s the correct time frame to turn the lights on:

  1. Create your variable in Apilio. Set it to false if it’s not the correct time yet.

  2. Set it to true at sunset for your location:

  1. Set it to false at 11PM:

Create a condition that checks if this variable is true:

How to setup the logic

Create a logicblock that uses these two conditions:

And in the advanced options check “Evaluate this logicblock when any connected variable changes”

What this does is:

  • If you are already home at sunset, then the lights are turned on
  • If you get home after sunset, then the lights are turned on for you then (and not before when you were not home)

This way you can keep both the current behaviour you have and this new one when you are at home :smiley:

To turn the lights off, it depends on what you want to do. Some options:

  • you could create a logicblock that turns them off using the second condition we used here, so you can add more conditions to consider
  • You could just create an IFTTT applet that turns the lights off at 11PM every day if you don’t need to check any additional conditions. (In this case we could also simplify the time condition used here, but I wanted to keep it flexible just in case you need it :nerd_face:)

I think that once you have these variables and conditions setup from the step-by-step, you’ll be able to play with it and build your own logic just how you want it :slight_smile:


Hi @Anna,

I just wanted to thank you for putting this awesome tutorial together. I just discovered Apilio today and have a similar situation to the OP. I have since set up most items in Apilio/IFTTT, and am looking forward to seeing if it works!

The only part which I did not quite follow was the “Auto Evaluation” under “Advanced options”. Would I want this box checked all the time, given that my motion sensor is feeding a change in variable that is linked to my logicblock? (see attached screenshot for a glance of my setup).

Thank you again!




I’m not sure how to edit my previous post, but the sun just set and short story is: yes, automatic evaluations need to be turned on for my particular scenario. Works like a charm now!

Next steps:

  1. Figure out how to shorten the latency between motion sensing and turning the lights on. Currently, there is about a 2 second delay (which I chalk up to the time it takes for IFTTT to communicate with Apilio).
  2. How to customize it even more. :grinning:



Anna thank you so much for posting step by step directions. Everything is set up and can’t wait to see how it will work later . Will let you know.
Thank you again for the support. Now I think with your explanation I better understand how apilio works


Hi @jerleong! Welcome to the community :slight_smile:

I think I need to write a detailed article on automatic evaluations, they can be a very powerful help for some scenarios! :nerd_face:

Basically the simplest case is that you would trigger a logicblock with an event from IFTTT:

if something happens (for example, it’s Monday at 10AM), then tell Apilio to evaluate a logicblock.

But it is also common that your conditions can also trigger your logicblock evaluation. For example, if you have a variable that stores if you are connected to your home wifi or not. This is another good way of checking whether you are home. By selecting the automatic evaluation when a variable changes, this means that every time the variable that stores if you are connected to your home wifi changes to true or false, Apilio will check the full conditions in the logicblock. In a nutshell, this is it:

If I connect/disconnect from my home wifi, check if it’s time to run some actions in this logicblock.

This way you can have logicblocks that are evaluated according to this information that you are already storing to decide if it’s time to run your actions or not. Very handy in many situations! :slight_smile:


Hi @francesco.bagnera, that sounds great, let us know if everything is working just how you wanted it to :smiley: Happy Apilioing!

1 Like

Anna thank you, everything works great. Thank you so much


Great news Francesco, thanks for the feedback!

Thanks Francesco, that’s great to hear! :smiley:

1 Like