Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 49 additions & 2 deletions source/_integrations/template.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ ha_platforms:

The `template` integration allows creating entities which derive their values from other entities. This is done by defining [templates](/docs/configuration/templating/) for each property of an entity, like the name or the state. Entities are updated automatically whenever a value that a template relies on changes.

For sensors it's also possible to derive the state from [automation triggers](#configuration-for-trigger-based-template-sensors).
For template sensors it's also possible to derive the state from [automation triggers](#configuration-for-trigger-based-template-sensors).

Available template platforms:

Expand Down Expand Up @@ -152,6 +152,8 @@ curl --header "Content-Type: application/json" \
http://homeassistant.local:8123/api/webhook/my-super-secret-webhook-id
```

<p class='note'>Configuration under the <code>template:</code> key uses a different format compared to the platform configuration.</p>

{% configuration %}
trigger:
description: The trigger configuration for this entity. [See trigger documentation](/docs/automation/trigger)
Expand All @@ -162,9 +164,54 @@ unique_id:
required: false
type: string
sensor:
description: Map of your sensors to create from the trigger data. For available keys, see [configuration variables](#configuration-variables) above.
description: List of sensors to create from the trigger data.
required: true
type: map
keys:
state:
description: Defines a template to get the state of the sensor.
required: true
type: template
name:
description: Defines a template to get the name of the sensor.
required: false
type: template
unique_id:
description: An ID that uniquely identifies this sensor. Will be combined with the unique ID of the configuration block if available.
required: false
type: string
unit_of_measurement:
description: "Defines the units of measurement of the sensor, if any. This will also influence the graphical presentation in the history visualization as a continuous value. Sensors with missing `unit_of_measurement` are showing as discrete values."
required: false
type: string
default: None
icon:
description: Defines a template for the icon of the sensor.
required: false
type: template
picture:
description: Defines a template for the entity picture of the sensor.
required: false
type: template
attributes:
description: Defines templates for attributes of the sensor.
required: false
type: map
keys:
"attribute: template":
description: The attribute and corresponding template.
required: true
type: template
availability:
description: Defines a template to get the `available` state of the component. If the template returns `true`, the device is `available`. If the template returns any other value, the device will be `unavailable`. If not configured, the component will always be `available`.
required: false
type: template
default: true
device_class:
description: Sets the class of the device, changing the device state and icon that is displayed on the UI (see below). It does not set the `unit_of_measurement`.
required: false
type: device_class
default: None
{% endconfiguration %}

<p class='note'>It's currently only possible to define trigger-based entities via the top-level configuration. These entities are not yet included when reloading template entities.</p>
Expand Down