Home / away indicator

I would like to show on a card a “House Status” which can be “Home” or “Away” - just like the device trackers does. I have currently used a “input_select” method, but that looks different aesthetically than the device trackers as it gives me the option (logically enough) to choose “Home” or “Away” from a drop down menu instead of just showing the text.

I am intending the house status to be based on two device trackers so I don’t need to be able to use the drop down.

Can that be done?

Not sure, but this is my solution. I have a Presence card showing two device trackers as Home or Away. It also contains a boolean switch called Guest, in case the babysitter is present. There is also a boolean called someone_present that is triggered when at least one of the 3 mentioned is on. I do not show this last boolean in the card, it is implicit. Only use it in automations.

That is also more or less the setup I have, I would just like to have another option with the home/away indicator. But I haven’t found a way for it, so I might just change it to a input boolean with “Away” and then on/off.

If you group the sensors, the status of the group is on if any of the group is on.

So you might just be able to look at the group status for what you want.

Similar to what @phileep says, there is already an automatically maintained group for device_tracker’s named group.all_devices, so you don’t even have to create one. It’s state will be home if one or more of the device_tracker’s are home, and not_home if all the device_tracker’s are not home. But, like all automatically created groups, by default it is hidden. You just need to use customization to un-hide it.

BTW, the actual states of device_tracker’s and group.all_devices is home and not_home, even though they display as Home and Away. And, even though device_trackers can take on other states, group.all_devices will always only be home/Home or not_home/Away.

EDIT: Actually, group.all_devices doesn’t show like a sensor, it actually shows all the individual device_trackers. I’m using it in my frontend and just reminded myself what it looks like!

So, although its state is what you want, it doesn’t display the way you want. Therefore, do like @Emphyrio mentions. I.e., create a template sensor. Actually, a Template Binary Sensor is probably best:

binary_sensor:
  - platform: template
    sensors:
      house:
        value_template: "{{ is_state('group.all_devices', 'home') }}"
        device_class: presence

With the above an entity named binary_sensor.house will be created. Just change “house” to whatever you want to call it.

Or if you really want a sensor that says Home and Away you could create a template sensor.

Here is what I’m using. It will check the device track of phone first (unifi) and if Unifi thinks I’m not home then my GPS will be checked. I didn’t like how ‘home’ was in lower case so I made another template for the front end

  keith_presence:
    friendly_name: 'Keith'
    value_template: >-
      {% if is_state("device_tracker.keiths_phone", "home") %}
         {{ states('device_tracker.keiths_phone') }}
      {% else %}
         {{ states('device_tracker.keithphonegps') }}

      {% endif %}


  keith_presencefront_end:
    friendly_name: 'Keith'
    value_template: >-
      {% if is_state("sensor.keith_presence", "home") %}
        Home
      {% else %}
        Away
      {% endif %}

Thanks for all the replies - I will work with those inputs. The reason for I cannot use the standard group.all_devices is because it is not all devices that I can use in this home / away indicator. We have an ipad etc. that is also in the group.all_devices and that one never leaves home.

Maybe this is something that you can use. An binary sensor displaying the mode.

Then just create another group that contains the devices you care about and use that in the binary_sensor template.

Group works just fine for me … I assume this is what you are after:

image

From a simple group.

Because the first item in the group is a device tracker, the status of the group is the same as a device tracker . ie home / away … but if you want to get complicated, knock yourself out!!