From ba42dad3c7af56c6392d14e08d81c8a8eef1277a Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sun, 28 May 2017 19:38:24 +0200 Subject: [PATCH] Add sample --- .../_docs/configuration/templating.markdown | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/source/_docs/configuration/templating.markdown b/source/_docs/configuration/templating.markdown index e7739999e0e..614eeaac45f 100644 --- a/source/_docs/configuration/templating.markdown +++ b/source/_docs/configuration/templating.markdown @@ -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: -- [Home Assistant architecture], especially states. -- [State object] - - -[Home Assistant architecture]: /developers/architecture/ -[State object]: /topics/state_object/ +- [Home Assistant architecture](/developers/architecture/), especially states. +- [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: @@ -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_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 # Incoming value: {"primes": [2, 3, 5, 7, 11, 13]}