A lot of automations you run in a Smart Home is based on presence of the people living there. For example, it would be nice to turn off most things, when nobody is in the house anyway. In my House I turn off lights, Sonos Players and the pump that distributes hot water in the house, when nobody is home.
There are many ways in Home Assistant to track if someone is home, and just using the App on your phone might tell you. The issue with most of these, is that they might not be very fast or accurate, and as a consequence of that, your light might not turn on fast enough when you need it.
By testing several options I found that the App Life 360 is the fastest and most accurate APP I have tried, and as such I decided to use this App as my prime source of Presence detection. So how do you integrate that in to Home Assistant? When writing this there is NO direct way of sending information from Life360 to Home Assistant, but Home Assistant has a built-in API that can receive messages from a HTPP POST, and there is a program that can receive messages from Life360 and send them using HTTP POST. That APP is called IFTT. So for all this to work you need:
- Life 360 APP on your phone
- IFTT APP setup and linked to Life 360
- A fully working Home Assistant system with Internet Access enabled
Start by downloading the Life 360 App to your phone from the appropriate APP Store
Create your account. For the purpose of this setup the Free Account is fine, as this will allow you to create 2 places, where one of them should be your Home Address. After installation and setup, make sure that everybody who is part of the household, are invited to the Circle and that they install the Life360 App on their phone
Now you need to edit your Home Assistant configuration and add a new sensor of the format Input_Boolean. We will use this boolean sensor to let Home Assistant know if there is someone home or not. If the Sensor is on at least one person in the Household is home, else the value of the sensor will be off.
input_boolean: someone_home: name: Is someone home initial: off icon: mdi:home-account
Save you configuration file and restart Home Assistant to load the new sensor.
With Life 360 up and running and a sensor that can be updated to state if someone is home or not, we are now ready to let IFTT talk to Life 360 whenever status changes. We do that by creating 2 Applets: One to set the value of the someone_home sensor to on and one to set value to off.
Click the New Applet button, and select Life 360 as the Service. You will be presented with a few Templates, where we will use two of them:
Select ‘First family member arrives at a specific place’ to create the Turn on action.
Now select your Home Destination in the screen below and press Create trigger:
Select Webhooks as Action Service and enter the following in the fields:
Click Save and make sure that the Applet is turned on.
To create the Applet that turns the sensor off, just create a new Applet, select the Life 360 template starting with ‘Last family member leaves a specific place’ and just remember to change turn_on to turn_off in the URL section of the Web request.
With this setup, Home Assistant will now know if there is somebody home or not, and you can now start using the input_boolean sensor someone_home to run actions based on presence. Below is a simple trigger that turns on the light in the living room, when the first person comes home after sunset.
- alias: First Person Home trigger: - platform: state entity_id: input_boolean.someone_home from: 'off' to: 'on' condition: - condition: state entity_id: sun.sun state: 'below_horizon' action: - service: light.turn_on entity_id: light.living_room_ceiling