This integration creates a composite device_tracker
entity from one or more other entities. It will update whenever one of the watched entities updates, taking the "last seen" (and possibly GPS and other) data from the changing entity. The result can be a more accurate and up-to-date device tracker if the "input" entities update irregularly.
It will also create a sensor
entity that indicates the speed of the device.
Currently any entity that has "GPS" attributes (gps_accuracy
or acc
, and either latitude
& longitude
or lat
& lon
), or any device_tracker
entity with a source_type
attribute of bluetooth
, bluetooth_le
, gps
or router
, or any binary_sensor
entity, can be used as an input entity.
After it has been downloaded you will need to restart Home Assistant.
This custom integration supports HomeAssistant versions 2023.7 or newer.
Composite entities can be created via the UI on the Integrations page or by YAML entries.
To create a Composite entity via the UI you can use this My Button:
Alternatively, go to Settings -> Devices & services and click the + ADD INTEGRATION
button.
Find or search for "Composite", click on it, then follow the prompts.
The remainder of this section describes YAML configuration. Here is an example YAML configuration:
composite:
trackers:
- name: Me
entity_id:
- entity: device_tracker.platform1_me
use_picture: true
- device_tracker.platform2_me
- binary_sensor.i_am_home
default_options (Optional): Defines default values for corresponding options under trackers.
false
.trackers: The list of composite trackers to create. For each entry see Tracker entries.
name
variable. For example, My Name
would result in a tracker entity ID of device_tracker.my_name
. The speed sensor's object ID will be the same as for the device tracker, but with a suffix of "_speed
" added (e.g., sensor.my_name_speed
.)true
or false
. If true
, will skip update from a GPS-based tracker if it has not moved. Specifically, if circle defined by new GPS coordinates and accuracy overlaps circle defined by previous GPS coordinates and accuracy then update will be ignored.driving
.<config_path>/www
(which is typically /config/www
.) You can specify file names with or without the "/local" prefix. If this option is used, then use_picture
cannot be used.true
or false
. Default is false
. If true
, use all states of the entity. If false
, only use the "Home" state. NOTE: This option is ignored for entities whose source_type
is gps
for which all states are always used.true
or false
. Default is false
. If true
, use the entity's picture for the composite. Can only be true
for at most one of the entities. If entity_picture
is used, then this option cannot be used.For watched non-GPS-based devices, which states are used and whether any GPS data (if present) is used depends on several factors. E.g., if GPS-based devices are in use then the 'not_home'/'off' state of non-GPS-based devices will be ignored (unless all_states
was specified as true
for that entity.) If only non-GPS-based devices are in use, then the composite device will be 'home' if any of the watched devices are 'home'/'on', and will be 'not_home' only when all the watched devices are 'not_home'/'off'.
If a watched device has a "last seen" attribute (i.e. last_seen
or last_timestamp
), that will be used in the composite device. If not, then last_updated
from the entity's state object will be used instead.
The "last seen" attribute can be in any one of these formats:
Python type | description |
---|---|
aware datetime |
In any time zone |
naive datetime |
Assumed to be in the system's time zone (Settings -> System -> General) |
float , int , str |
A POSIX timestamp (anything accepted by homeassistant.util.dt.utc_from_timestamp(float(x)) |
str |
A date & time, aware or naive (anything accepted by homeassistant.util.dt.parse_datetime ) |
Integrations known to provide a supported "last seen" attribute:
last_seen
, built-in or enhanced custom)last_seen
)last_timestamp
)If a watched device has a battery_level
or battery
attribute, that will be used to update the composite device's battery_level
attribute. If it has a battery_charging
or charging
attribute, that will be used to udpate the composite device's battery_charging
attribute.
device_tracker
AttributesAttribute | Description |
---|---|
battery_level | Battery level (in percent, if available.) |
battery_charging | Battery charging status (True/False, if available.) |
entities | IDs of entities that have contributed to the state of the composite device. |
entity_picture | Picture to use for composite (if configured and available.) |
gps_accuracy | GPS accuracy radius (in meters, if available.) |
last_entity_id | ID of the last entity to update the composite device. |
last_seen | Date and time when current location information was last updated. |
latitude | Latitude of current location (if available.) |
longitude | Longitude of current location (if available.) |
source_type | Source of current location information: binary_sensor , bluetooth , bluetooth_le , gps or router . |
sensor
AttributesAttribute | Description |
---|---|
angle | Angle of movement direction (in degrees, if moving.) |
direction | Compass heading of movement direction (if moving.) |
composite:
default_options:
require_movement: true
driving_speed: 15
trackers:
- name: Me
driving_speed: 20
entity_id:
- entity: device_tracker.platform1_me
use_picture: true
- device_tracker.platform2_me
- device_tracker.router_my_device
- entity: binary_sensor.i_am_home
all_states: true
- name: Better Half
id: wife
require_movement: false
entity_picture: /local/wife.jpg
entity_id: device_tracker.platform_wife