Want to track (and automate events) when the house is "away" (e.g. all occupants have left, or one person returns)

Is anyone familiar with a good good pattern for firing automations when more than two people have left the house or at least one of them return? I’m basically trying to track when the house is “away” or not.

I’ve set up moderately complex node-red flows with some boolean inputs to track state and fire events, but it seems overly complicated. I’m now trying to expand that to have events when we’re “out of town” e.g. “far” away from the house.

The proximity integration seems to provide similar events when we cross zone/distance boundaries but doesn’t allow me to combine two people’s locations into one “home” state without the same fairly compliex node red flows.

Any ideas appreciated! Thanks!

Put all your people/trackers in a group. Use the state of the group as a trigger.

1 Like

Got it - nice. Fiddled with that a bit.

What happens when we’re both in a zone that is not “home” ?

The device trackers will have state of that zone, but will the group also? Or will it be ‘not_home’ ?

I’m guessing ‘not_home’. Not 100% cetain.

In other words, need to know more details about this:

does device_tracker have more than one ‘on’ states?

You can test by setting the states of your trackers in Developer tools / States and watching the group state.

Ah - didn’t know that either. Seems it’s a no though :confused:

You only wanted to know the home / away state for the whole house though so this should still fit your original question.

Either or both trackers home → group home
Both trackers away → group away

Ah, yes, I agree this group think simplifies the simple case of home/not_home – but:

I’m now trying to expand that to have events when we’re “out of town” e.g. “far” away from the house.

I was thinking w/ device_tracker/group could add some “in town” zone w/ a 10 mile radius – and then “not_home” becomes my out-of-town automation

For that you would need a template sensor to check that both your trackers are not in the 10 mile zone, or home zone, or any other zones you have inside the 10mile radius.

1 Like

Maybe a proximity sensor to track the nearest person to home would work for you.

This gives me the nearest person to home in miles using a list of (android app) device trackers.

proximity:
  home_family:
    zone: home
    devices:
      - device_tracker.1
      - device_tracker.2
    tolerance: 200
    unit_of_measurement: mi

Sorry to revive this, but it’s exactly my question. From what I see, people can only be grouped by YAML, and the documentation shows this as an “Old Group” and is not recommended. Is this what you are referring to set up? Something like…

group:
  household_occupancy:
    name: "Household Occupancy"
    entities:
      - device_tracker.person1
      - device_tracker.person2

I guess I’m wondering if this can only be setup the “old fashioned” way?

Thanks,
Steven

Yes that is correct.

1 Like

So there is no “Person Group” and there is no “new” way of doing this?

It feels like such a common problem to deal with:

“do x when all persons have left the house”
“do y when a person has entered the house”

The State of a Zone will tell you how many people (of those being tracked) are present. So when “zone.home” changes to zero, all persons have left, and when it changes to >0, someone has arrived.

However, it is not a trivial problem to consistently and accurately determine the zone values - for example if your presence is determined by your cell phone and you leave without out it… the system will probably not realize you’ve left.

2 Likes

I know, presence detection is hard. But I am happy enough with “when all cell phones have left the building” :wink: