My special thanks to Phil Hawthorne for letting me use the title of his post here.

In early 2018 I found Phil’s excellent blog post “Making Home Assistant’s Presence Detection not so Binary” and began using the setup suggested by him almost immediately.

A few months later I started migrating my automations to Node-RED and posted the initial results in the comments section of Phil’s post.

This works great, but the caveat is that you have to have one sequence for each device tracked.

I started looking for a way to have only one sequence for all the tracked devices, after some time (with some hits and many, many misses) this is what I came out with.

The JSON code of this sequence is available here.





Now all I needed was to set up an input_select with the same name of a device_tracker in Home Assistant.

In known_devices.yaml :

homer : hide_if_away : false icon : mac : 00:00:00:00:00:00 name : Homer picture : /local/homer.png track : true





In configuration.yaml :

input_select : homer : options : - Home - Just Arrived - Just Left - Away - Extended Away





And in Node-RED an events: state node that should be connected to the change node in the beginning of the sequence.









This must be repeated for each person being tracked, just replacing the names where needed.

For example:

marge : hide_if_away : false icon : mac : 11:11:11:11:11:11 name : Marge picture : /local/marge.png track : true





input_select : marge : options : - Home - Just Arrived - Just Left - Away - Extended Away









The final result should be something like this:













If you use node-red-contrib-home-assistant-websocket (default in Node-RED Community Hass.io Add-on), the sequence can be even smaller.

Since its version 0.3.0:

Call Service and Fire Event nodes are now able to render mustache templates in the data property.

This means that we can remove almost all of the template nodes used in the original sequence and move their content to the call service nodes right after them.

The JSON code of this sequence is available here.





Here’s the most recent version of the sequence. Now I’m using the person integration to track people. If you’re using device_tracker , remember to change the first and third nodes according to your needs.

The JSON code of this sequence is available here.





A reader made me aware of an issue in the sequence when using the zone integration in Home Assistant. The tracked person’s state would change to “Just Left” again when entering or exiting a zone.

Here’s the sequence with a fix for this issue.

The JSON code of this sequence is available here.

Thank you, CamelY0, for finding, reporting, and helping to fix the issue.





This sequence went through a diet. Now we no longer need the “rbe” and “template” nodes in it, nor do we need to use the “change” nodes to reset the timers.

The JSON code of this sequence is available here.





Always the zones ! 🤦🏼‍♂️

The issue mentioned on May 01, 2020 (see above) found its way in again. Here’s the sequence with the fix.

The JSON code of this sequence is available here.

My thanks to Kermit Jason Zachow for the JSONata tips.