mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-19 07:17:14 +00:00
Update docs for trigger-based template sensors. (#17243)
This commit is contained in:
parent
8ed686c19a
commit
4ed78dab24
@ -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.
|
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:
|
Available template platforms:
|
||||||
|
|
||||||
@ -152,6 +152,8 @@ curl --header "Content-Type: application/json" \
|
|||||||
http://homeassistant.local:8123/api/webhook/my-super-secret-webhook-id
|
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 %}
|
{% configuration %}
|
||||||
trigger:
|
trigger:
|
||||||
description: The trigger configuration for this entity. [See trigger documentation](/docs/automation/trigger)
|
description: The trigger configuration for this entity. [See trigger documentation](/docs/automation/trigger)
|
||||||
@ -162,9 +164,54 @@ unique_id:
|
|||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
sensor:
|
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
|
required: true
|
||||||
type: map
|
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 %}
|
{% 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>
|
<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>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user