"X or Y" away

How would I go about creating a device_tracker which is considered “Away” when either device_tracker.x or device_tracker.y is “Away”, and when they are both “Home” then the tracker is considered “Home”?

I can’t use a group as that does the opposite of what I want - if either device is “Home” then the whole group is “Home”.

Create a template sensor

sensor:
  - platform: template
    sensors:
      custom_group_tracker:
        friendly_name: "Custom Group Tracker"
        value_template: >
          {% if states.device_tracker.x.state == 'home' and states.device_tracker.y.state == 'home' %}
            home
          {% else %}
            away
          {% endif %}

You can use a group, and reverse the standard behaviour by adding the all: key and setting it to true.

I’m guessing here, but if what you’re trying to do is combine 2 device trackers to improve accuracy, use this component.

It’s not really to increase accuracy, I have 2 devices which I take out of the house with me, usually only one at a time. I’d like to so that if I leave one of the devices in the house but take one out, it still marks me as being “Away”.