Best Practice for presence / arrival detection

I am interested in how people detecting if someone arrives home. So far I was using NMAP and owntracks to get the status of people. This works reliable, however sometimes it triggers to early or to late. Therefore, I extended my setup with a door/window sensor, which now can signal the status of my entry door.

Nevertheless, I was wondering how people integrate such a sensor in their automation. I am struggling, since I would only want to trigger an entry automation if people are either not yet home or recently arrived, since it would otherwise also trigger if I open it from the inside.

So how do other people combine the state of the front door with other sensor? I am curious to get your opinions!

1 Like

Conditions.

One automation triggers on presence detection, the other on the door opening, with the condition that nobody is home.

For example, create a group called group.my_people that includes all the device trackers you want to track. Then you have something like:

  automation:
    trigger:
      - platform: state
        entity_id: binary_sensor.front_door
        to: 'on'
    condition:
      - platform: state
        entity_id: group.my_people
        state: 'not_home'
    action:
      ...

ok, but how to defne the state ā€˜not_homeā€™?
I trying to use the device_tracker function with nmap findeing no phones connected in wifi network at home, but it do not worksā€¦ it detect me always ā€œat_homeā€

This will indeed work in case the presence detection did not detect the people already. I want to use the front door as the only trigger, since it will reliably trigger automations at the same time someone really arrives home. Due to the radius, owntracks e.g. sometimes already triggers my entry automations if I am 5 minutes away. I am struggling to find a way to use the door signal in case people are already home. I was thinking about an arrival state for my home, which indicates people recently arrived based on the device_tracker.

Excuse me, but I do not think this will work ā€¦ you can find a way to count every time the door opens, assuming every time you enter a person. How do you determine if the door is opened to enter or exit? How do you determine how many people enter or leave each time you open the door? Impossible.
The only way is using the function device_tracker and count how many phones are connected with wifi router.
When all people leave the house after few seconds no phones will be connected to home wifiā€¦ then all people are outā€¦ and then home assistant can switch off lights and arm alarm security, etcā€¦
But at the moment Iā€™m not able to do this because device_tracker function says me I always am at homeā€¦ even if I turn off the phone

Not sure this would work, my presence detection will detect us in our yard so this means the condition would already be ā€œhomeā€ prior to the triggerā€¦

Just throwing this out there. I have presence detection not binary, home vs not_home. I followed and implemented everything in this article https://philhawthorne.com/making-home-assistants-presence-detection-not-so-binary/.

I have not done anything with it. One idea would trigger if the status was ā€œJust Arrivedā€ and then a door opening and then mark as Home.

Just an idea.

Thanks for the link. This blog post actually inspired me to implement a kind of state for the home / people. I will try to setup an arrival state in which the door will trigger my arrival automations. In this way I should be able to make sure that my arrival automations really only trigger if people recently arrived.

Since I am using owntracks, I should be able to detect the arrival state early enough.

since you are using owntracks, why not get a couple of ibeacons? Set them to use the same UUID and different Major/Minor IDs. I have 1 outside near my front door so even if the GPS is lagging behind, the iBeacon triggers perfectly when I walk or drive home.

I also have 1 inside the house, might get a 2nd to increase the coverage, but so far 2 is working well for me.