one person isn´t using the app/gps. it´s only a device_tracker checking if the person is connected to the wlan. so i guess zone.home won´t be working.
triggering isn´t the problem, it works great using the group.
i´m trying to find a good way to get a notification for the last person leaving (if i´m not home and i´m not the last person leaving).
If you tie the non-gps device tracker to the person it should still work for zone.home despite gps coordinates being unknown.
The last person leaving I would try by triggering on all persons individually leaving home, in the conditions check if zone.home is 0. Then the entity triggering it is the entity that made zone.home go to 0. You can do that with one state trigger listing all persons, because trigger.entity_id should then be able to tell you which entity it was.
Do note that gps trackers may have different response times than e.g. wifi based trackers, so when two people leave together, the one with the slowest responding location tracking will be in the notification.
that´s the way i have it now. trigger is every single person, condition is group.home is 0 as action it selects the person that left and sends the notification.
was hoping i can use the group.home as trigger and use a jinja-template that shows the person that triggered group.home to 0
You might be able to iterate members and check which one last updated, but it would be quite difficult. So unless you have a very fast growing family, I’d leave it as it is
Your orignal post alluded that the group was composed of a number of person entities… if that is the case you can use the template I posted earlier.
If, instead, it is actually a mixture of person and device_tracker entities you can use the group
trigger:
- platform: state
entity_id: group.home
to: not_home
from: home
variables:
last: |
{{ expand( trigger.to_state.attributes.entity_id )
| sort(attribute='last_changed', reverse=1)
| map(attribute='attributes.friendly_name') | first }}
condition:
- alias: mase is not last
condition: template
value_template: "{{ last != 'Mase' }}"
action:
- service: notify.YOUR_NOTIFIER
data:
message: "{{ last }} was the last to leave"