mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-24 01:37:23 +00:00
Add keyword 'condition' for completeness (#1524)
Added the 'condition:' keyword to make it clear that for a basic condition definition, you will need that keyword twice.
This commit is contained in:
parent
ce79bf09b7
commit
5313bf3b96
@ -74,6 +74,7 @@ For above, the condition passes if `value >= above`. For below, the condition pa
|
|||||||
You can optionally use a `value_template` to process the value of the state before testing it.
|
You can optionally use a `value_template` to process the value of the state before testing it.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
condition:
|
||||||
condition: numeric_state
|
condition: numeric_state
|
||||||
entity_id: sensor.temperature
|
entity_id: sensor.temperature
|
||||||
above: 17
|
above: 17
|
||||||
@ -87,6 +88,7 @@ value_template: {% raw %}{{ float(state.state) + 2 }}{% endraw %}
|
|||||||
Tests if an entity is a specified state.
|
Tests if an entity is a specified state.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
condition:
|
||||||
condition: state
|
condition: state
|
||||||
entity_id: device_tracker.paulus
|
entity_id: device_tracker.paulus
|
||||||
state: not_home
|
state: not_home
|
||||||
@ -104,6 +106,7 @@ The sun condition can test if the sun has already set or risen when a trigger oc
|
|||||||
[sun_trigger]: /getting-started/automation-trigger/#sun-trigger
|
[sun_trigger]: /getting-started/automation-trigger/#sun-trigger
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
condition:
|
||||||
condition: sun
|
condition: sun
|
||||||
after: sunset
|
after: sunset
|
||||||
# Optional offset value
|
# Optional offset value
|
||||||
@ -115,6 +118,7 @@ after_offset: "-1:00:00"
|
|||||||
The template condition will test if the [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'.
|
The template condition will test if the [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
|
```yaml
|
||||||
|
condition:
|
||||||
condition: template
|
condition: template
|
||||||
value_template: '{% raw %}{{ states.device_tracker.iphone.attributes.battery > 50 }}{% endraw %}'
|
value_template: '{% raw %}{{ states.device_tracker.iphone.attributes.battery > 50 }}{% endraw %}'
|
||||||
```
|
```
|
||||||
@ -129,6 +133,7 @@ Within an automation, template conditions also have access to the `trigger` vari
|
|||||||
The time condition can test if it is after a specified time, before a specified time or if it is a certain day of the week
|
The time condition can test if it is after a specified time, before a specified time or if it is a certain day of the week
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
condition:
|
||||||
condition: time
|
condition: time
|
||||||
# At least one of the following is required.
|
# At least one of the following is required.
|
||||||
after: '15:00:00'
|
after: '15:00:00'
|
||||||
@ -147,6 +152,7 @@ Time condition windows can span across the midnight threshold. In the example ab
|
|||||||
Zone conditions test if an entity is in a certain zone. For zone automation to work, you need to have setup a device tracker platform that supports reporting GPS coordinates. Currently this is limited to the [OwnTracks platform](/components/device_tracker.owntracks/) and the [iCloud platform](/components/device_tracker.icloud/).
|
Zone conditions test if an entity is in a certain zone. For zone automation to work, you need to have setup a device tracker platform that supports reporting GPS coordinates. Currently this is limited to the [OwnTracks platform](/components/device_tracker.owntracks/) and the [iCloud platform](/components/device_tracker.icloud/).
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
condition:
|
||||||
condition: zone
|
condition: zone
|
||||||
entity_id: device_tracker.paulus
|
entity_id: device_tracker.paulus
|
||||||
zone: zone.home
|
zone: zone.home
|
||||||
|
Loading…
x
Reference in New Issue
Block a user