mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-06-26 03:56:50 +00:00
885 B
885 B
Using templates
For incoming data, a value template translates incoming JSON or raw data to a valid payload.
Incoming payloads are rendered with possible JSON values, so when rendering, the value_json
can be used to access the attributes in a JSON based payload, otherwise the value
variable can be used for non-json based data.
Additional, the this
can be used as variables in the template. The this
attribute refers to the current entity state of the entity.
Further information about this
variable can be found in the template documentation
{% note %}
Example value template with json:
With given payload:
{ "state": "ON", "temperature": 21.902 }
Template {% raw %}{{ value_json.temperature | round(1) }}
{% endraw %} renders to 21.9
.
{% endnote %}