Is anyone there?
A very common quest among smart home owners is to automate events based on the presence of any family member: Turn lights on/off, reduce/increase heating or cooling, arm/disarm video cameras and so on.
Therefore it’s a common need for your home automation system to know if someone is at home or not. There are multiple approaches to solve it:
- there are some specialised apps that can track all family members,
- presence detection is built into Apple HomeKit and Google Home,
- another idea is to check if someone is connected to your home WiFi to know if they are home (here’s an article on how to do this),
- and many others!
In this article, we’d like to demonstrate how you can get the needed information in Apilio by using a specialised smartphone app for geofencing. This is quite easy to setup and doesn’t give you the feeling like you were spying on your family members
Setting this up, step by step:
Variables: store who is at home
Let’s imagine a family of four: Laura, Pete, Jessica, Max.
Apilio uses Boolean variables to store simple yes / no information (or in this specific case: “Home” / “Not Home”).
So let’s start by creating Boolean Variables for each person:
Being privacy-conscious and knowing if your family is at home
So far we have prepared a place to store the state for everyone - great! But how can we update those automatically?
In this example we will use a smartphone app to achieve this. You can use any app that does geofencing and can call a web URL (often referred to as “webhook”) on entering or exiting an area.
It’s great to know that this approach is privacy aware: You are not tracking your family member’s exact position nor is Apilio. The only information the app provides to Apilio is that there was an entry/exit event for some geofence somewhere on Earth. A geofence is only there to tell “In” or “Out” - and nothing more.
There are multiple apps available in the app stores. We have tested and liked Locative on iOS (free). We also looked for good apps on Android, but actually didn’t find one we can fully recommend. Let us know in the comments if you know one!
Sidenote: On iOS, there is also Apples Shortcuts app which looks like it could do the job through “Automations”, but unfortunately it doesn’t, as it needs you to tap an icon to confirm whether you are at home (check the list of automations that cannot be run automatically: https://support.apple.com/en-gb/guide/shortcuts/apd602971e63/ios), so it won’t serve our purposes.
Linking in your family
Kindly ask your family to install the geofencing app of your choice and you are set to start your Smart Home revolution!
In the meantime, go to each Boolean Variable created, copy the URLs for “Set true” / “Set false” to a message and send them to the right person (they contain a long, impossible-to-memorise string, so dictating is not an option).
Full documentation: How to use webhooks to update variables and trigger logicblocks in Apilio
Then each one shall create a geofence in the app and configure the individual “Set True / Set False” webhook URLs provided by you. One URL will be triggered when they exit the geofence (set to false) and the other one (set to true) when they enter it.
And that’s it! Now Apilio will store the information “Home” / “Not Home” in a Boolean Variable for each family member. Send everyone off for a walk out of the geofence (assuming you are not under Covid lockdown ) and check the Apilio event log on your dashboard (here’s some details regarding this log) to review if everyone’s status was updated correctly.
How to use those states in automation: part II
Now that you have a nice switch that tells you wether each family member is at home right now, we’ll see in the next article how to setup the conditions and logic you need to automate things based on who is at home: