mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-19 15:26:59 +00:00
Tweak for the template (#8876)
Converting the state string to an int for comparison
This commit is contained in:
parent
b874b1f665
commit
bdbece9f3f
@ -163,7 +163,7 @@ The template condition will test if the [given template][template] renders a val
|
||||
```yaml
|
||||
condition:
|
||||
condition: template
|
||||
value_template: "{% raw %}{{ state_attr('device_tracker.iphone', 'battery') > 50 }}{% endraw %}"
|
||||
value_template: "{% raw %}{{ (state_attr('device_tracker.iphone', 'battery')|int) > 50 }}{% endraw %}"
|
||||
```
|
||||
|
||||
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