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:
-
Create your variable in Apilio. Set it to true if you are currently at home when setting it up:
-
Set it to true if you get home with an IFTTT applet here: https://ifttt.com/create
-
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:
-
Create your variable in Apilio. Set it to false if it’s not the correct time yet.
-
Set it to true at sunset for your location:
- 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
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 )
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