mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-19 07:17:14 +00:00
Add sample
This commit is contained in:
parent
f3cebc2526
commit
ba42dad3c7
@ -12,12 +12,8 @@ redirect_from: /topics/templating/
|
|||||||
|
|
||||||
This is an advanced feature of Home Assistant. You'll need a basic understanding of the following things:
|
This is an advanced feature of Home Assistant. You'll need a basic understanding of the following things:
|
||||||
|
|
||||||
- [Home Assistant architecture], especially states.
|
- [Home Assistant architecture](/developers/architecture/), especially states.
|
||||||
- [State object]
|
- [State object](/topics/state_object/)
|
||||||
|
|
||||||
|
|
||||||
[Home Assistant architecture]: /developers/architecture/
|
|
||||||
[State object]: /topics/state_object/
|
|
||||||
|
|
||||||
Templating is a powerful feature in Home Assistant that allows the user control over information that is going into and out of the system. It is used for:
|
Templating is a powerful feature in Home Assistant that allows the user control over information that is going into and out of the system. It is used for:
|
||||||
|
|
||||||
@ -195,6 +191,23 @@ It depends per component or platform, but it is common to be able to define a te
|
|||||||
| `value` | The incoming value. |
|
| `value` | The incoming value. |
|
||||||
| `value_json` | The incoming value parsed as JSON. |
|
| `value_json` | The incoming value parsed as JSON. |
|
||||||
|
|
||||||
|
This means that if the incoming values looks like the sample below:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"on": "true",
|
||||||
|
"temp": 21
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The template for `on` would be:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
'{% raw %}{{value_json.on}}{% endraw %}'
|
||||||
|
```
|
||||||
|
|
||||||
|
The following overview contains a couple of options to get the needed values:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
# Incoming value:
|
# Incoming value:
|
||||||
{"primes": [2, 3, 5, 7, 11, 13]}
|
{"primes": [2, 3, 5, 7, 11, 13]}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user