mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-28 03:37:06 +00:00
Updated template condition (#6042)
Updated the template condition to use `state_attr` instead of the more error prone long form.
This commit is contained in:
parent
3d7c1a32cc
commit
3095ef25c3
@ -163,7 +163,7 @@ The template condition will test if the [given template][template] renders a val
|
|||||||
```yaml
|
```yaml
|
||||||
condition:
|
condition:
|
||||||
condition: template
|
condition: template
|
||||||
value_template: '{% raw %}{{ states.device_tracker.iphone.attributes.battery > 50 }}{% endraw %}'
|
value_template: "{% raw %}{{ state_attr('device_tracker.iphone', 'battery') > 50 }}{% endraw %}"
|
||||||
```
|
```
|
||||||
|
|
||||||
Within an automation, template conditions also have access to the `trigger` variable as [described here][automation-templating].
|
Within an automation, template conditions also have access to the `trigger` variable as [described here][automation-templating].
|
||||||
|
Loading…
x
Reference in New Issue
Block a user