Geofences with very small radius but without false positives

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 :roll_eyes:

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:

  1. When entering Geofence B, set variable ‘on_my_way_home’ to ‘1’

  2. 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 :man_shrugging:, 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:

3 Likes

Great post thank you! In a nutshell you explain exactly why standard automation doesn’t work for the automation purist… :bowing_man:

2 Likes

Another idea: Since you are on iOS and you might have CarPlay (I upgrade mine with an aftermarket wireless CarPlay unit) you can setup triggers with Shortcuts when connecting / disconnecting from it!
The “disconnect” event is very reliable, not so sure about the “connect” event.

2 Likes

Not a bad idea but you would need to combine disconnect event with location. Otherwise the garage gate would open when you park your car in any place.

2 Likes

Yes, of course. I would see it more as a possible enhancement for your setup in the article.

1 Like

In my case, I use wireless CarPlay with this little device cplay2air I bought some months ago, so disconnecting CarPlay when I get to the garage is not as easy as pulling out the cable.

1 Like