Presence detection, multiple devices

Hi all,

First post from me. I’ve been using HA for a couple of weeks, and hit some major walls (and solved them). But I finally hit a wall that I can’t break…

I’ve set up presence detection using Owntracks, and it’s working flawlessly. I’m using iBeacons to locate the room in the house, and unfortunately this breaks the ‘home’ vs ‘not home’ in group.all_devices since a device can be in the living room for example. Obviously HA will think that’s not home.

My question: how can I set a value to group.all_devices where ‘home’ is considered ‘home’, ‘living’ or ‘hall’.

Hope the question is clear.


Instead of using group.all_devices you could use a template sensor and have logic to set it how you want it based on beacons and owntracks, then use your sensor in automations.

1 Like

I was going to suggest the same thing as I can’t see how you would do this easily with a group setup.

Here’s a link to template sensor info, you can do some amazing things with them!

I’ve been looking at templates, but I can’t phantom the concept…

When is a template “called”? I would like to have a template evaluate whenever a device changes mode (home -> not home or not home -> living), but I don’t know how to configure this…

Home Assistant takes care of that for you - just assume it will be updated automatically whenever anything changes that would affect it.

And then you just call the name of the sensor template instead of the sensor itself.

For example, I am using NMap to track some computers, printers and devices in my office. But it doesn’t make sense to read a computer is "home’ or "not_home’ - WTH? where did it go? - so I modify the output to something that makes sense to me. Then instead of showing the device sensor, I show the template sensor in my group and I get the output I want.

# Sensor Value Templating
-  platform: template
       value_template: "{% if is_state('device_tracker.epson3e7694fiosrouterhome', 'home') %}on{% else %}off{% endif %}"
       value_template: "{% if is_state('device_tracker.19216819', 'home') %}on{% else %}off{% endif %}"
       value_template: "{% if is_state('device_tracker.satorifiosrouterhome', 'home') %}system up{% else %}down{% endif %}"
       value_template: "{% if is_state('device_tracker.1921681195', 'home') %}system up{% else %}down{% endif %}"
       value_template: "{% if is_state('device_tracker.zenfiosrouterhome', 'home') %}system up{% else %}down{% endif %}"
       value_template: "{% if is_state('device_tracker.1921681163', 'home') %}transmitting{% else %}down{% endif %}"
       value_template: "{% if is_state('device_tracker.ex3700fiosrouterhome', 'home') %}TX/RX Up{% else %}down{% endif %}"

Output now looks like this:


Thanks guys, I was able to solve it with template sensors!

1 Like

I have this:

 - platform: template
        value_template: "{% if (is_state('group.all_devices', 'home') or is_state('group.occupancy', 'on'))  %}on{% else %}off{% endif %}"

which somehow is not working

group.all_devices is ‘home’ and group.occupancy is ‘on’ however my sensor remains off.

Any ideas?

Ok. so if I use sensor instead of binary_sensor its working. An the value is “on” now the question is how I get it ruinnin with a binary_sensor

I figured it out:

 - platform: template
        value_template: '{{ (is_state("group.all_devices", "home") or is_state("group.occupancy", "on")) }}'

is working as expected

1 Like

I have the following configuration for my Epson printer-


  name: Epson Printer
  mac: xx:xx:xx:xx:xx:xx
  track: yes
  hide_if_away: no


-  platform: template
       value_template: "{% if is_state('device_tracker.epsone759f1', 'home') %}online{% else %}offline{% endif %}"

For this one device I have now 2 icons in the home page, one for the device tracker with the friendly name I defined for it and the second one for the sensor with the sensor name only.

What additional configuration am I missing that is causing the duplication as well as the sensor not using the friendly name?

Thanks in advance for the help.

You can do this in the customizing section:

Hide the device_tracker.epsone759f1 and assign the friendly name to the sensor.epsonprinter.

That did it. Thanks!