We showed you in Part I: Knowing who is at home how you can get the essential presence data into Apilio. If you haven’t read Part one yet it’s a good idea to read that first.
Once you have completed the steps outlined in Part I it’s time to get creative and use the information for clever automations.
There are 4 typical situations that you might be looking for when automating things based on people presence:
- First person has arrived
- Last person has left
- Is anybody home?
- Is nobody home?
Going forward, we will show you how to setup an automation that should run as soon as the last person has left the house. At the end of the article we give you some tips how to adapt it to the first person has arrived.
To use the state stored in a Boolean variable, you need to create a Condition for each of them. The variable stores the information and the condition is a question we ask of this information, as in: Is Laura home? The answer will be yes or no depending on the information stored.
For our example, you would set the condition for Laura up as follows:
Note that I chose to phrase the name a bit differently from the underlying Boolean Variable to help telling them apart.
You should end up having four conditions as follows:
Setup the Logicblock
We want the Logicblock to do something as soon as everyone has left the home. Because if the last one out forgets to turn off the hallway lights, that won’t be a problem anymore as Apilio will take care of that
So create a new Logicblock, give it a name and then select all four conditions from the list:
Note some interesting details here:
- There is a bolt symbol in front of each condition. That means that the Logicblock will run as soon as any of them changes: as soon as anyone leaves or gets home.
- We need to define a complex condition because we need to connect them as “OR” (vs. “AND”).
What this Logicblock achieves
- Every time someone enters or leaves the home area, this Logicblock will run
- As long as at least one person remains at home, the Logicblock evaluation will result in the “Positive” result, so the actions configured in that section will run.
- When the last person leaves, the Logicblock evaluation will result in a “Negative” result, so the actions configured in that section will run. For example, if nobody is at home, then it’s time to turn off any lights, close the blinds, etc.
As we only want to turn the hallway light off automatically, we don’t need to specify any action for the positive case. We only need an action for the negative case! But for example, you could use the positive actions to turn on the lights automatically after sunset if anybody is at home.
My final configuration looks like this:
Variation: Automation when the first person arrives
Until now we showed how to trigger automations when the last person leaves. But of course you can also do stuff when the first one comes home, like switching the hallway light.
To achieve that, we use the “positive” actions to run something we want if the first person arrives. As you may have realised, those will run every time somebody arrives home. Based on the action, that may not be something that should happen all the time if somebody already is at home.
To avoid that, there is the section “Advanced Options” that has a checkbox for “Only fire action if result changed”. Tick it and the Logicblock will only do his work when the outcome changes from “positive” to “negative” and vice versa.
Leave them below Presence awareness is key for making smart choices about saving energy and keeping your home secure. Let us know if you’d like to get ideas for other scenarios!