Migrate person groups to UI

The new UI feature for groups is very welcome and I’ve already moved my YAML light groups across. I think the next step is to add additional group types in the UI, especially for person entities.

In my setup, my house has different behaviours depending on whether anyone is home or not. These automations are dependent on a group of person entities, which saves me from updating every automation every time I add or remove guests or frequent visitors.

Currently, these person groups must still be contained in YAML, but I hope that soon it’ll be possible from the UI too.

Second the request. It is strange that one was not included. But your main use case: seeing if any one is home, can now better be served by the zone.home state I believe? It now counts the number of people in the zone. Unless you have persons that report home even when they aren’t.

1 Like

I don’t rely on zone HA app geolocation it isn’t very reliable and doesn’t update very frequently. I roll up my people, occupancy sensors and windows and door sensors (rolled up with an automation where if one is triggered they create a 30min occupancy event) into one home occupancy group where any of them will keep the home occupied.

Not every member of the home has a tracked device so if the parents go out and there is a sitter I still want the home to be occupied…

Unless there is something I am missing with zones where I could tie the occupancy sensors to them?

Regardless the UI group function should support all entity types, just like the old groups.

2 Likes

Given the groups that support a group of people are considered “old groups” and are not recommended I think it will be great to add a new supported/recommended way of creating them through the UI. Unless there’s already a way to setup the same behavior

From my understanding, the “zone” approach is not the same

5 Likes

New user here, and would love to see a way to easily add the Persons in my house to a group, so that I can more easily setup automations that check the condition if anyone home.

Would you mind sharing your yaml code for this person group? I also need this kind of setup, and HA coding is not easy for me.

Thanks.

@simongis @HA_n00b You can add this to groups.yaml.

group_name:
  name: Group name
  icon: mdi:human-male-female
  entities:
    - device_tracker.x
    - device_tracker.xx
2 Likes

+1 for this feature request, but those following this topic may be interested in how I managed to stop using legacy groups for this “is anyone home” binary sensor.

Previous I used legacy groups (the only groups that support person entity) i.e.

groups.yaml

# Manual groups
# https://github.com/home-assistant/architecture/issues/177
all_persons:
  name: All Persons
  entities:
    - person.alec
    - person.sally

template_entities.yaml

- binary_sensor:
    - name: "Home Presence"
      unique_id: home_presence
      device_class: presence
      state: "{{ is_state('group.all_persons', 'home') }}"

However, the same end result (binary_sensor.home_presence) can be achieved without using groups at all with some templating:

template_entities.yaml

- binary_sensor:
    - name: "Home Presence"
      unique_id: home_presence
      device_class: presence
      state: >-
        {% set persons = states.person %}
        {% set home_persons = persons|selectattr('state', 'eq', 'home')|list %}
        {{ home_persons|length > 0 }}

This has allowed me to stop using legacy groups.

You technically do not need a group/template_entity if you want to track all, zone.home state provides a count of people at home.

You do need a group when you want to track only certain people out of all. Only mark the home as unoccupied if adults are out (kids may not carry their devices always)

Edit: came up with a binary (template) sensor, if anyone has a similar use case

binary_sensor:
  - name: "Home Presence"
    unique_id: home_presence
    device_class: presence
    state: >- 
      {% set persons_home = state_attr("zone.home", "persons")  %}
      {% if 
      (persons_home  | contains("person.adam")) 
      or 
      (persons_home  | contains("person.eve")) 
      %}
      true
      {% else %}
      false
      {% endif %}
1 Like

I want this too!

Any updates on this?
Would be a great feature thing to make group-based notifications more easy.

1 Like

we’re still interested in this.