Tweak template documentation

This commit is contained in:
Philip Lundrigan 2015-12-21 12:50:54 -07:00
parent 1a4599572f
commit 76cd19a506
2 changed files with 7 additions and 3 deletions

View File

@ -149,7 +149,7 @@ automation:
#### {% linkable_title Template trigger %}
Template triggers work by evaluating a [template] on each state change. The trigger will fire if the state change caused the template to render 'true'.
Template triggers work by evaluating a [template] on each state change. The trigger will fire if the state change caused the template to render 'true'. This is achieved by having the template result in a true boolean expression (`{% raw %}{{ is_state('device_tracker.paulus', 'home') }}{% endraw %}`) or by having the template render 'true' (example below).
```yaml
automation:
@ -244,14 +244,16 @@ automation:
#### {% linkable_title Template condition %}
The template condition will test if [given template][template] renders a value equal to true.
The template condition will test if [given template][template] renders a value equal to true. This is achieved by having the template result in a true boolean expression or by having the template render 'true'.
```yaml
automation:
condition:
platform: template
value_template: '{% raw %}{{ state.attributes.battery }}{% endraw %}'
value_template: '{% raw %}{{ state.attributes.battery > 50 }}{% endraw %}'
# Or value_template could be:
# {% raw %}{% if state.attributes.battery > 50 %}true{% else %}false{% endif %}{% endraw %}
```
#### {% linkable_title Time condition %}

View File

@ -25,6 +25,7 @@ sensor:
monitored_variables:
- name: temperature
unit_of_measurement: '°C'
value_template: '{% raw %}{{ value | round(1) }}{% endraw %}'
- name: humidity
unit_of_measurement: '%'
pins:
@ -43,6 +44,7 @@ Configuration variables:
- **monitored_variables** array (*Optional*): List of exposed variables.
- **name** (*Required*): The name of the variable you wish to monitor.
- **unit** (*Optional*): Defines the units of measurement of the sensor, if any.
- **value_template** (*Optional*): Defines a [template](/getting-started/templating/) to extract a value from the payload.
- **pins** array (*Optional*): List of pins to monitor. Analog pins need a leading **A** for the pin number.
- **name** (*Optional*): The name of the variable you wish to monitor.
- **unit_of_measurement** (*Optional*): Defines the unit of measurement of the sensor, if any.