Understanding presence & group.All_devices better

In my household I have three phones. Two Androids, one Iphone. For all phones I use Uquity Unifi , for the android phones owntracks and for the Iphone icloud. Please see below the relevant yamls.

I’m still not 100% sure I understand the logic that is used behind group.all_devices. How does this evaluate it’s state?

Does Group.all_devices = home mean that:
Any of the two trackers per device reports home on any device? So what ever tracker per device is first sets the home state?

And ‘not home’: Is this based on at least one of the trackers of all three devices reports ‘not home’ ?

Is there an easy way to change this behaviour? If above is indeed the behavior I would rather set ‘not home’ when all trackers for all devices report away.

Part of my known devices:

owntracks_owntracks:
  name: Gxxx
  mac: xxxxxxxx
  picture: /local/g.jpg
  track: yes
  hide_if_away: no

annie_annie:
  name: Annie
  mac: xxxxxxxxxxxx
  picture: /local/annie.jpeg
  track: yes
  hide_if_away: no

iphone6svangit:
  name: Git
  mac: 
  picture: /local/git.jpeg
  track: yes
  hide_if_away: no

iphone6svangit_2:
  name: iPhone6svanGit
  mac: xxxxxxxxxx
  picture: 
  track: yes
  hide_if_away: no

My device trackers:

  - platform: owntracks
    max_gps_accuracy: 200
    consider_home: 240
    interval_seconds: 30

  - platform: unifi
    track_new_devices: false
    host: 192.168.1.40
    port: 8443
    username: xxxx
    password: xxxxx
    consider_home: 240
    interval_seconds: 30
 
  - platform: icloud
    username: xxxxx
    password: xxxxxx

Example of occupancy automation:

  - alias: "Away"
    trigger:
      - platform: state
        entity_id: group.all_devices
        from: "home"
        to: "not_home"
    action:
      - service: notify.mypushover
        data:
          title: "Presence"
          message: "All Away"
          target: ""
      - service: input_select.select_option
        data:
          entity_id: input_select.Occupancy
          option: "Away"
      - service: input_select.select_option
        data:
          entity_id: input_select.alarm
          option: "Away"
      - service: scene.turn_on
        data:
          entity_id: scene.all_away
      - service: climate.set_temperature
        data:
          entity_id: climate.family_room
          temperature: '14'
1 Like

home means any device is home. not_home means no devices are present. This behavior is hardwired into the device_tracker platform.

If any of your device trackers in the group all devices is not_home, then the state of group all devices will be not home.

Edit: Incorrect, please read @Tyfoon’s post as well as my follow up. Sorry!

@rpitera Don’t think that is correct: I’m assuming your are either meaning: If any of your device trackers in the group all devices is home, then the state of group all devices will be home.

It’s very often that one of three devices that are tracked are not home and then group.all_devices is still “home”

Or you mean:
If any of your device trackers of that device is not_home, then the state of that device will be not_home.

If you mean the lather I guess there is no way to change that behavior; I rather would like to see:
If all of your device trackers of that device is not_home, then the state of that device will be not_home.

and for not_home:
If any of your device trackers of that device is home, then the state of that device will be home.

1 Like

I need to take more time to think when typing, this is correct. I won’t change it retroactively as it will make your comment not make sense anymore.

I started looking for definitive documentation on how this works and while I can’t seem to find anything at the moment, what I have been reading from other sources seems to bear out what you are saying here:

I am sorry for any confusion I caused by not checking my answer more carefully.

Edit: The above assumes that in known_devices, you have set the devices in question to be tracked - but I will also double check that when I get back.

The above thread is thoroughly confusing and I’ll make it worse so that we can get a comprehensive answer that everyone agrees with.

  1. ‘At home’ registered by any tracker over-rides all other indications?
  2. ‘Not Home’ needs all trackers to agree on ‘not home’

This is quite ridiculous. It got worse when I looked at another thread where someone wanted to track status withon a room/zone, where the presence in a zone said the device was no longer home despite the zone (probably) being in the home?

If there is to be any logic on trackers it should be a majority vote about where a device is. In the case of a split verdict the status is clearly ‘unknown’ or ‘undetermined’.

If it isn’t possible to make zones sub-sections within homes or elsewhere then we need an improvement?