Device template functions
These template functions let you work with devicesA device is a model representing a physical or logical unit that contains entities. in Home Assistant. Look up device names, IDs, attributes, and find which entitiesAn entity represents a sensor, actor, or function in Home Assistant. Entities are used to monitor physical properties or to control other entities. An entity is usually part of a device or a service. [Learn more] belong to a device.
Home Assistant extends the Jinja2 template engine with many custom functions, filters, and tests. Each function on this page has its own page with detailed descriptions, parameters, and practical examples.
New to templates? Start with the templating documentation to learn the basics.
-
Get device attribute
device_attrReturns the value of a specific attribute from a device. -
Get entities for a device
device_entitiesReturns a list of entity IDs associated with a given device. -
Get a device ID
device_idReturns the device ID for a given entity ID or device name. -
Get a device name
device_nameReturns the name of a device from a device ID or entity ID. -
Test device attribute
is_device_attrTests if a specific attribute of a device has a given value.