Presence detection not working as expected

Hi there,

My wife and I each have assigned three presence tracking devices (iPhone through companion app, iPhone through Unifi detection and finally iPhone through Owntracks app) for home/away detection.

I’ve grouped the three devices for each of us so there’s a group “trackersa” and “trackersb”.
In each group “all:” is set to false so I don’t rely on all three trackers to change state.
This is working fine and as expected:

(from the groups.yaml file:)

  name: Trackergroup-A
    - device_tracker.iphone_a
    - device_tracker.iphone_a_app
    - device_tracker.iphone_a_owntracks
  all: false

  name: Trackergroup-B
    - device_tracker.iphone_b
    - device_tracker.iphone_b_app
    - device_tracker.iphone_b_owntracks
  all: false

  name: A-und-B
    - group.trackersa
    - group.trackersb
  all: true

Then I wanted to create another group “family” for both of us containing the two above tracker-groups but this time with “all:” set to “true” so the state of the group should only change when both trackergroups have changed their state.

This however does not work and the group state of family has changed to not_home if one of the two groups have changed to not_home.

What did I do wrong? How to achieve the result?

That is not how the all option works.

It changes the logic from OR to AND.

Without all set to true, the group will be ‘home’ if any of the members are home. It will only change to not_home if both members are not home.

With all set to true, the group will only be home if both members are home. It will change to not_home if any of the members are not home.

@tom_l Thanks for your reply. That was my understanding, too, but this is exactly what puzzles me:

Each tracker-group (1 group for my wife with 3 devices, 1 group for me with also three devices).
Those groups have set all to false, so it’s a logical OR.
That’s working fine and each group is reflecting the status as expected.

But for the family group the AND is intended so therefore I have set all to true for the that group.
My expexctation was that it will only change to not_home if also both tracker-groups have changed to not_home. However this does not work: The family group gets set to not_home when one of the two sub-groups change to not_home (and the other one still shows home)

That is not how and logic works. Home = 1, away = 0

0 and 0 = 0
0 and 1 = 0
1 and 1 = 1

Thanks again. I wasn’t aware that home==1 and away==0 but instead thought the state-change itself would be the boolean consulted for the logic which now I know it is not.

So I will leave it to true in the definition but will add a condition in the automation and check wether both groups are set to not_home before calling the action.

If the away state is more important to you set all to false. This means your family group will be home if anyone is home but not_home only if everyone is way.

What do you want the states to be?

away and away = away
home and home = home
away and home = ?

away and away = away
home and home = home
away and home = home

I just want to be able to check if either at least one person is home or if all persons are away.
That should work with group all set to false then, thank you :+1: