Smart Home Geofencing: Automate Everything Based on Your Location
This article may contain affiliate links. If you make a purchase through these links, we may earn a small commission at no extra cost to you. This helps us keep creating free content.
Geofencing changed my smart home from something I interact with to something that anticipates me. The concept is simple: draw a virtual boundary around your house, and trigger automations when your phone crosses that boundary. When I leave, the house arms the security system, locks every door, turns off all lights, and drops the thermostat. When I arrive home, the porch light turns on, the door unlocks, the thermostat adjusts to my preferred temperature, and the living room lights set to a warm scene. I do not press a single button. The house just knows.
Setting this up reliably, however, requires understanding how geofencing works across different platforms, the common failure modes, and the tricks to make it consistently dependable. I have been running geofence automations for three years across multiple platforms, and I will share what actually works.
How Geofencing Works Under the Hood
Geofencing uses your smartphone's GPS, WiFi triangulation, and cellular tower data to determine your location relative to a defined boundary. When your phone detects that it has crossed from inside to outside the boundary (or vice versa), it sends a signal to your smart home platform to trigger the associated automation. Most platforms let you set the geofence radius between 100 meters and 1 kilometer.
The key thing to understand is that geofencing accuracy depends on your phone's location services, not your smart home platform. If your phone's GPS is inaccurate or battery optimization kills the location service, your automation will not trigger. This is the number one cause of geofencing failures, and it is why the setup process involves more phone configuration than smart home configuration.
Platform Setup Guides
Aqara Motion Sensor P1 (Zigbee)
5-year battery life, configurable detection timeout, light sensor built-in, the cleanest motion sensor for Hue/HomeKit/HA.
See on Amazon βHome Assistant
Home Assistant offers the most flexible geofencing through its companion app. Install the Home Assistant app on your phone, enable location tracking, and create a zone in Settings > Areas & Zones. The companion app reports your device's location to Home Assistant, and you can build automations triggered by entering or leaving any zone. I recommend also enabling the high-accuracy mode in the companion app settings, which uses WiFi scanning for better indoor/outdoor detection. The trade-off is slightly higher battery usage, roughly 2-5% per day in my testing. If you are already running Home Assistant automations, adding geofence triggers is straightforward.
Apple HomeKit
HomeKit geofencing is the simplest to set up and, in my experience, the most reliable on iPhones. Open the Home app, create an automation, select "When People Arrive" or "When People Leave," and choose your home location. HomeKit uses a combination of GPS, WiFi, and the Apple device ecosystem (iPhones, Apple Watches) for presence detection. The one limitation is that HomeKit geofencing only works with the home location you have defined. You cannot create arbitrary zones like you can with Home Assistant.
SmartThings and Google Home
SmartThings uses the SmartThings app's location service for geofencing. The setup is straightforward: define your location in the app and create automations based on member arrival or departure. Google Home has improved its geofencing significantly in recent updates and now supports per-member presence detection. Both platforms work well on Android devices but can be unreliable if your phone aggressively kills background apps to save battery.
Making Geofencing Reliable
Here are the critical settings to configure on your phone, regardless of which smart home platform you use.
1. Set your smart home app to 'Always Allow' location access (not 'While Using')
2. Disable battery optimization for your smart home app
3. Enable WiFi scanning even when WiFi is off (Android)
4. Keep Bluetooth enabled for better indoor detection
5. Ensure high-accuracy/precise location is enabled in phone settings
Android phones are particularly aggressive about killing background apps. On Samsung devices, go to Settings > Battery > Background usage limits and add your smart home app to the "Never sleeping" list. On Xiaomi, OPPO, and other Chinese Android phones, you may need to lock the app in the recent apps tray and disable MIUI/ColorOS battery optimization. This is the single most common reason geofencing fails on Android, and it is entirely a phone settings issue, not a smart home platform issue.
Multi-Person Geofencing
If you live with others, geofencing gets more interesting. You probably want the lights and thermostat to respond to the last person leaving and the first person arriving, not trigger for every individual departure. This is called occupancy-based logic, and it requires your smart home platform to track multiple phones.
Home Assistant handles this elegantly with its person entity. Create a person for each household member, assign their phone tracker, and build automations that check if zero people are home (everyone left) or at least one person is home (someone arrived). The automation template looks something like this: trigger on any person state change, condition checks the home zone occupancy count, and the action runs the appropriate routine.
My Actual Geofence Automations
Here is what runs on my system every day, proven reliable over three years of daily use.
Departure routine: When the last person leaves home, wait 2 minutes (prevents false triggers from taking out the trash), then lock all doors, arm the security system to Away mode, turn off all interior lights, set thermostat to eco mode, and send a confirmation notification to my phone.
Arrival routine: When the first person enters the geofence, turn on the porch light (only after sunset), unlock the front door, disarm the security system, set thermostat to comfort mode, and if it is evening, set living room lights to a warm scene.
The two-minute delay on departure was a lesson learned after my system locked me out twice while I was getting packages from the porch. Small refinements like these make geofencing feel magical instead of frustrating. Combined with other time-saving automations, geofencing forms the backbone of a truly automated home.
β‘Disclaimer: This article is for informational purposes only. Smart home installations may involve electrical wiring and must comply with local building codes. Electrical work should only be performed by a licensed electrician.
About the Team
The SmartHome Automate Team
We make smart home technology simple. Our editorial team covers everything from voice assistants and DIY networks to protocol comparisons and automation tips.
Explore more
All articles on SmartHome Automate β
Smart Home Tips, Delivered
New guides, device reviews, and automation ideas β every week in your inbox.
π Free bonus: Smart Home Starter Checklist (PDF)
You might also like
10 Home Assistant Automations Every Beginner Should Set Up
You installed Home Assistant. Now what? These 10 automations take minutes to set up and immediately make your home smarter.
Home Assistant vs SmartThings: Which Hub Is Right for You?
Two smart home hubs, two very different philosophies. One is open-source and endlessly customizable; the other prioritizes simplicity and polish. Hereβs how they compare in daily use.
Smart Home Security Cameras: Privacy-First Buying Guide
Not every security camera phones home to a cloud server. This guide ranks indoor and outdoor cameras by local storage, encryption, and data privacy for 2026.