Need: Detect when I get very very very close to home (50m radius) to open garage door automatically
At first, you may think about creating a 50m geofence around your house with IFTTT or Locative app. The problem is that 50m is such a small radius that the phone location might jump between being inside and outside that area while you are at home (GPS is not very accurate indoors)… a bad thing if the garage door is going to open automatically
A better solution is to use 2 geofences with radius 50 and 500 meters, so you open the door when you have crossed both zones on your way home.
So this is what you need:
Locative or IFTTT app
Create a 50m geofence around your house (Geofence A)
Create a 500m geofence around your house (Geofence B)
Apilio
Create an Apilio a numeric variable called ‘on_my_way_home’ and set value to ‘3’ (I’ll explain why in a minute)
Locative or IFTTT app
Create 2 rules within the locative of IFTTT app:
-
When entering Geofence B, set variable ‘on_my_way_home’ to ‘1’
-
When entering Geofence A, add +1 to variable ‘on_my_way_home’
Apilio
Create a condition in Apilio called ‘just_arrived_home’ which is TRUE when ‘on_my_way_home’ equals 2 (Note: Since Apilio only lets you compare variables , create a variable called ‘two’ with value ‘2’). Make it a trigger condition.
Create a logicblock callled ‘at_the_garage_door’:
Condition: just_arrived_home
Actions if TRUE:
- Open garage door (or whatever you want to do)
- Set ‘on_my_way_home’ to 3 (you can do that with one of the new webhook actions or via IFTTT)
You may wonder why I set the variable to ‘3’ when I arrive home. Reason is that if the location of the phone jumps between inside and outside geofence A, that variable will increase +1 everytime you enter Zone A, so its value will be 4, 5, 6, etc. and those do not trigger the logicblock.
Obviously for this to work you need to get at least 500 m from your house. In my case, that works perfectly, because if I take the car, I am going further than that. The closest trash container is 100 m away, so I go on foot and the garage door does not open because I leave geofence A but not B.
I hope this chart explains it better: