Making Home Assistant’s Presence Detection not so Binary

Is it possible to change the sensor to person, or multiple devices? To have greater accuracy? I for example use nmaps, google maps and the app.

I’ve never noticed mine doing that, also not sure how you would trigger a tracker change (depends on the tracker)

Great idea, I’m sure this could be changed to person (as person already has support for multiple)

by making the input select (home-away etc.) initial value hold last value
that way upon restart it will at least have last known value instead of default (-> Home)

1 Like

Regarding your Sep 7 comment: Is it possible to make this an option in the blueprint: to choose between device or person? Alternatively it would require a separate blueprint, but that seems silly.

I have been looking into this, but seems to be a limitation of the blueprints at the moment:

This is great @cliffordwhansen, have been experimenting with the example on @philhawthorne his website myself. It works great, but I can’t get it to work with multiple people who both use several device trackers. Whenever multiple (in my case; 2) people both have several (HA App, Wifi and Bluetooth) device trackers (in group/person) they appear to change each others status.

How I read his code (below), is that if the ‘entity_id <> device_tracker.phil’ it will change the value in ‘input_select.helen_status_dropdown’. In case of (at least) two groups of device trackers, this will result imho in a non-useable solution for this case. Or am I overlooking something?

1 Like

I’ve adapted Phil Hawthorne’s code to my needs and I can say that it works pleasantly bulletproof.

The “Phil“ trigger doesn’t change the status of Helen. Actually it says

If Phil or Helen has just arrived,

select option 'just arrived': 
- If it is Phil, change Phil's input_select;
- if it is Helen, change hers.

but what if phil has multiple device trackers, like helen?

alias: 'Presence: Mark person as just arrived'
description: ''
  - platform: state
    entity_id: group.trackers_phil
    from: not_home
    to: home
  - platform: state
    entity_id: group.trackers_helen
    from: not_home
    to: home
  - service: input_select.select_option
      entity_id: |
        {% if trigger.entity_id == 'group.trackers_phil'  %}
         {% else %}
        {% endif %}
      option: Just Arrived
mode: single

The trigger.entity_id here is not the entity_id of the group, is it?

So we have (NMAP, Homekit, HA-App, Binarys and so on), all arranged in group.mr_pedoldsky an group.mrs_pedolsky). The respective group changes to 'on', if one member changes, and so group.tracker is only one entity in the end.

I think it should be. A group in Home Assistant is just another entity. So when the group state changes, it should be available as trigger.entity_id == 'group.trackers_phil'

1 Like

The differances between the code @philhawthorne wrote and this blueprint, is this blueprint is for a single user

For multiple device trackers, I would setup a group and the blueprint would need to be changed to support groups

I have multiple instances of this setup, one for each user and I’m only using the device tracker from the HA app.

1 Like

For some reason it doesn’t…
It keeps putting persistant ‘|’ lines in my (well, your) code:

And it adds to mark my wife as away…

Whereas is has me as ‘Just Left’

And also here it adds the ‘|’. I can delete it, it’ll just come back:

The ‘away’ trigger.entity_id must be the input_select entity. You have set the tracker group as trigger id.

Characters like | > |- >- are ‘line breaks’ used for multi line templates (in opposite to quotes in single line templates).

Single line:

entiy_id: '{{ … your template code v… }}'

Multi line:

entiy_id: |
  {{ … your template code … }}
1 Like

I note in your automation you have mode:single

Out of curiosity, does this generally happen when both you and your wife leave?

With mode:single if group.trackers_matthijs and group.trackers_hilanah go to note_home at the same time, the first one that gets triggered will be updated, and the other input_select won’t be updated at all.

You should set that to mode: parallel so that both groups update their respective input_selects

1 Like

That has also been the case, i’ll add that and check this week.

@philhawthorne; that made all the difference in the world, thanks a lot.

@pedolsky; changed it, this seems to work - tx.

Still this morning the “Mark person as away” decided not to trigger for the wife, whereas the “Just left” worked perfectly. Running the automation manually, set her to away.

No logs, Mark away automation just wasn’t triggered. Would that be the platform? Could it?

Have you changed sth. in your just left automation? Plus check when the group.wife last changed.


group.wife changed:

Have you changed something in your just left automation?