Have question regarding person and group,
by using person i get better presence accurancy as
i can father couple of device_tracking for each person ,
Then I want to collect persons under group
so in my automation i be able to check if group is home for example .
person.yaml
#person:
- name: karin
id: 321
device_trackers:
- device_tracker.life360_karin
- device_tracker.karin
- device_tracker.mi_9t_pro
- name: avi
id: 123
device_trackers:
- device_tracker.life360_avi
- device_tracker.avi
- device_tracker.vtr_l29_2
```
group.yaml
```
family:
name: family
entities:
- person.avi
- person.karin
```
Then , in automation i want to check if group is home/not home,
and avoid AND condition which i have .
i.e:
```
condition:
condition: and
conditions:
- condition: state
entity_id: device_tracker.avi
state: 'not_home'
for:
minutes: 4
- condition: state
entity_id: device_tracker.karin
state: 'not_home'
for:
minutes: 4
I might be wrong but this could be set only if using some sensor ,
as group would be change to home only if all the entities belong to the group are in home ,right?
if not , would be great if u or some1 can share something similar.
I found something strange ,
In persons.yaml - as mention in first post i create 2 persons
but HA see them in other name meaning person.avi and person.avi_2
why is that?
You can see from the screenshots that the last adult to leave home today left at 8.50, but the house isn’t marked unoccupied until 10.06 because one of the kids was still at home until then. After which they mirror each other as adults come in and go out again. The last update to both is because I remotely updated homeassistant and it restarted so the states updated.
As for avi_2, no idea. Have you set one up in the gui and a second one in yaml?
I found solution- dont like though …
i fix it in .storage/core.entity_registry file
the problem , in next upgrade i need to remember to do it othetwise all related automation will not work.
Maybe there’s other elegant way to customize the person name?
I wonder if this a bug in HA that name for person not coming from the yaml ,
So I just googled this thinking the same as the OP.
I want to maybe create an automation to turn all lights off when nobody is home and I am using the new Persons element (really like it actually).
Then as I was reading this, I think we are all trying to reinvent the wheel while rolling down the road.
The logic for a person is already sound, multiple trackers tied to one person to determine if they are home or not.
Then we want to group all the persons together so that we can combine that logic into a larger group.
So…
Rather than group your individual persons together, why not just create a new person and assign them all the same trackers that are assigned to your individual users? I just did this so I do not have data yet but I think it should work perfectly.
You could then use these groups in automations like this
- alias: all lights off when nobody is home
initial_state: 'true'
trigger:
- platform: state
entity_id: group.persons_and_dog
to: 'not_home'
for:
seconds: 60
action:
- service: light.turn_off
entity_id: all
But you could also simply do it without any group by creating an automation with a template. Example below:
- alias: send notification to phone
initial_state: 'true'
trigger:
- platform: state
entity_id: binary_sensor.motion_hallway
to: 'on'
action:
- service_template: >
{% if (is_state('person.jimmy', 'not_home')) and (is_state('person.stephanie', 'not_home')) %}
notify.all_devices
{% elif (is_state('person.jimmy', 'home')) and (is_state('person.stephanie', 'not_home')) %}
notify.me
{% else %}
notify.wife
{% endif %}
data:
title: "Motion"
message: Motion detected in the hallway!
The last examples templates can also be used elsewhere (e.g. conditions).
Hi ,
I have one question for the group.yaml thing.
If the group state is not_home , so all person state inside this group change to away ?
Because I don’t have this behaviour
My group of persons seems to behave like a person with multiple trackers. Eg, I leave home but my gf is at home, it will change the group to be not_home as that was the most recent update
I know what you are taling about
I preferred to use file based configurations on my previous system (openhab) for years as well.
But as a rookie on HA it’s safer to use the GUI - not as flexible though.
Anyway - I will try your approach and will see…
Thank you for your help!
EDIT:
This is not accepted:
and in accordance the the actual documentation this does not work either:
# For family member presence
person:
- platform: group
entities:
- person.donald
- person.trump
Error:
Invalid config for [person]: [platform] is an invalid option for [person]. Check: person->person->0->platform. (See /config/configuration.yaml, line 42).