Label template functions
These template functions let you work with labelsLabels in Home Assistant allow grouping elements irrespective of their physical location or type. Labels can be assigned to areas, devices, entities, automations, scenes, scripts, and helpers. Labels can be used in automations and scripts as a target for actions. Labels can also be used to filter data. [Learn more] in Home Assistant. Labels are tags you can assign to 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], devicesA device is a model representing a physical or logical unit that contains entities., and areasAn area in Home Assistant is a logical grouping of devices and entities that are meant to match areas (or rooms) in the physical world: your home. For example, the living room area groups devices and entities in your living room. [Learn more] to organize them. Use these functions to look up labels, find items with specific labels, and build automationsAutomations in Home Assistant allow you to automatically respond to things that happen in and around your home. [Learn more] that act on labeled groups of items.
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 areas with a label
label_areasReturns a list of area IDs that have a specific label assigned. -
Get label description
label_descriptionReturns the description of a label from its ID. -
Get devices with a label
label_devicesReturns a list of device IDs that have a specific label assigned. -
Get entities with a label
label_entitiesReturns a list of entity IDs that have a specific label assigned. -
Get label ID
label_idReturns the label ID for a given label name. -
Get label name
label_nameReturns the friendly name of a label from its ID. -
Get all
labelsReturns a list of all label IDs, or the labels assigned to a specific entity, device, or area.