Presence detection is a powerful feature in Home Assistant that allows you to automate your smart home devices based on your location. By detecting whether you are home or away, you can set up automations to turn on lights, adjust the thermostat, and more. Hopefully by now you’ve setup your Home Assistant instance using some of our getting started guides, in this guide, we’ll go further and walk you through how to set up presence detection in Home Assistant.
Choose a Presence Detection Method
There are several methods you can use to detect your presence in Home Assistant. Some common methods include:
- GPS: You can use the GPS on your phone to detect your location and trigger automations based on your proximity to home (this is the most common).
- Wi-Fi: You can use the Wi-Fi network in your home to detect when your phone is connected or disconnected from the network.
- Bluetooth: You can use Bluetooth beacons or your phone’s Bluetooth signal to detect your presence.
Each method has its own advantages and disadvantages, for instance, Bluetooth requires additional hardware, but may give you a more accurate reading than Wifi, which is dependent on your internet router and can be unreliable.
The typical method is to setup more than one of these together to ensure you have consistency and failover (trust me, you don’t want your lights to turn off in the middle of dinner just because your phone decided to save some battery).
For my network I use both the GPS and the Wifi methods together to get the best outcome.
2. Set Up device tracking for presence detection
To set up presence detection in Home Assistant, you need to track your device’s location (ideally one device, multiple methods from above per person, but Home Assistant has become more intelligent with handling multiple devices over the years). This involves adding your device to Home Assistant and configuring the tracking method.
Here are the basic steps to set up device tracking:
- Add Your Device: In the Home Assistant web interface, go to Configuration > Integrations and add your device using the appropriate integration (e.g., GPS, Wi-Fi, Bluetooth).
- Configure Device Tracking: Once you have added your device, configure the device tracking method. This will vary depending on the method you are using. For example, if you are using GPS, you will need to set up a zone for your home and configure the GPS tracker to trigger when you enter or exit that zone.
- Test Device Tracking: Test your device tracking by leaving and returning to your home. Check that the device tracking is working correctly and your device is being detected as expected.
3. Setup family presence detection
Here comes the more difficult bit. Steps 1 and 2 above are easy – if you’re already a Home Assistant user you’ve probably already got this far in the process, but it’s no good to setup your automations to turn off the lights once anyone leaves your house, you need to set it up to turn off the lights once everyone has left the house.
The “old” way of doing this (which is still valid if you need this for other automations) is to setup a “group” containing all the persons in the household. This will act like a “person” or “device_tracker” group, tracking “home” and “not_home” status’s similar to tracking individuals.
The new, easier way, however is to use the “zone” state. This will track the number of people at home at any time – so you can simply use the state of this variable in your automations
4. Setup your automations
Finally, you can set this variable up in your automation settings to control your lights. I use this as both a trigger and a condition to track the status of lights
You’ll want to use a trigger to turn on lights when you get back home (in my case after Sunset) or to turn off lights when you leave. In this case setup a state change trigger when the “zone” – in my case “zone.home” goes either to or from zero
I use this alongside other triggers (such as time or sunset) to ensure I’m only turning on lights when people are at home.
In conclusion, setting up presence detection in Home Assistant can be a powerful tool for automating your smart home and improving your daily routine. By using the right device tracking method and setting up presence detection automations, you can enjoy a more convenient and comfortable living experience. Remember to fine-tune your setup as needed and consider using multiple methods to ensure the most accurate results. With the tips and techniques outlined in this guide, you’ll be able to set up presence detection in Home Assistant with ease and take full advantage of its capabilities.