Making Home Assistant’s Presence Detection not so Binary

In the past I have used the code from @philhawthorne (Making Home Assistant’s Presence Detection not so Binary – Phil Hawthorne) to make my presence detection no be so binary

You will need at least one device_tracker (for example the one created by the HomeAssistant Companion App)
You will also need an input_select:

Navigate to Configuration > Helpers or Open your Home Assistant instance and show your helper entities.

Click on Add helper the following screen will be displayed, choose “Dropdown”

Then add a name and the following options:

Once you click create you should see your new helper in the list

You can allso add this helper using yaml in configuration.yaml

    name: Person Name
      - Home
      - Just Arrived
      - Just Left
      - Away
      - Extended Away
    initial: Home

This is my first attempt at a blueprint:
Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.
Gist URL:


Dear @cliffordwhansen this blueprint is very interesting but, for me, is not clear how to implement helper. Can you explain better ?
Thank you

Thank you @fireport, I have updated the original post with some more info, I hope this helps.


Thanks for creating this, I have been meaning to try these automations for a while.

Thanks for the Blueprint.
I added a template sensor to my setup. It translates to german and can be used to be displayed in Lovelace.

  - trigger:
      - platform: state
        entity_id: input_select.anwesenheit_tim
      - platform: homeassistant
        event: start
      - name: 'Anwesenheit Tim'
        unique_id: '141764e7-cf17-4e00-a0c0-9ea38f3fbef0'
        state: >
          {% if is_state("input_select.anwesenheit_tim","Home") %}Zuhause
          {% elif is_state("input_select.anwesenheit_tim","Just Left") %}Gerade gegangen
          {% elif is_state("input_select.anwesenheit_tim","Just Arrived") %}Gerade gekommen
          {% elif is_state("input_select.anwesenheit_tim","Away") %}Abwesend
          {% else %}Länger Abwesend
          {% endif %}
        icon: >
          {% if is_state("input_select.anwesenheit_tim","Home") %} mdi:face
          {% elif is_state("input_select.anwesenheit_tim","Just Left") %} mdi:face-outline
          {% elif is_state("input_select.anwesenheit_tim","Just Arrived") %} mdi:face-outline
          {% elif is_state("input_select.anwesenheit_tim","Away") %}mdi:account-off
          {% else %}mdi:account-off-outline
          {% endif %}
1 Like

Updated the time triggers they were in the wrong format
changed from:

  - platform: state
    entity_id: !input person_input_select
    for: 10mins

changed to:

  - platform: state
    entity_id: !input person_input_select
      minutes: 10
1 Like

Updated the devicetracker triggers to only use home state, I found that it wouldn’t trigger when I was moving from a zone to home (and reverse). (I have a zone for the park across the road from me)

I found I also needed to add a condition to check the from state and to state are different, I found my phone keeps triggering the home state even though it was home.

The only issue I have now is that my phone seems to move around alot (something to do with GPS reporting, it’s sitting next to my bed on charge)
Blue: Home
Orange: Just Left
Purple: Away

This is a really neat blueprint, a suggestion: if we could specify in the UI the time conditions after device_tracker state changes.

1 Like

I have updated the gist with three more inputs that should do what you are asking :wink:

I have limited the input to 0-60 for Just Arrived/Left and 0-168(1 week) for the Extended away, I also made sure there were default values.

Hope this helps :wink:

Awesome, thank you!

Dear @cliffordwhansen do you think that is would be possible to use person status instead of device_tracker. I monitor each member of my family using multiple devices so detection is more precise.
Thank you.

I like the idea of using the person entity instead of the device_tracker, I’m still testing some things with mine :wink:

It doesn’t look like you can choose multiple domains for the selector, but if you look on line 11 you should beable to change it from:

            domain: device_tracker


            domain: person

This is very cool, but it doesn’t seem to trigger the “Away” state. At least not for my implementation. My daughter left for school ~7am this morning and has been stuck in “Just Left” ever since:

Screen Shot 2021-09-21 at 12.27.41 PM_redacted

Not sure what could be the issue, I would check the automation trace to see if there is an issue.

for example mine from this morning:

My inputs are as follows:

Thanks, I’ll look into it. In the meantime I wrote non-blueprint versions of the scripts needed and it seems to be working, mostly.

After restarting Home Assistant all input revert to Home and dont change till tracker changes status.
Any idea how to run it on boot and get value from tracker?

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