diff --git a/source/_components/automation.markdown b/source/_components/automation.markdown index 42ecbb4ea45..0c841d24b6f 100644 --- a/source/_components/automation.markdown +++ b/source/_components/automation.markdown @@ -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 %} diff --git a/source/_components/sensor.arest.markdown b/source/_components/sensor.arest.markdown index 2b95d576628..89326f3db32 100644 --- a/source/_components/sensor.arest.markdown +++ b/source/_components/sensor.arest.markdown @@ -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.