I have a TP-Link mesh network at home. It allows me to see who is in which room. Apparently, devices regularly disconnect, making the devices in that room unavailable.
See images.
- name: Your sensor with copied stuff
attributes:
location: >-
{% set the_source_location = state_attr('device_tracker.the_source_tracker', 'location') %}
{{ this.attributes.get('location','unknown') if the_source_location is none else the_source_location }}
this.attributes.get('location','unknown') reads the current value of the ‘location’ attribute being evaluated, defaulting to ‘unknown’ in case the value is null/none.