mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-18 14:56:53 +00:00
Update scripts-conditions.markdown (#925)
Clarification for the AND and OR examples of conditions. Some people were missing first 'condition' looking at the examples.
This commit is contained in:
parent
21e288582a
commit
14837c4833
@ -16,14 +16,15 @@ Conditions can be used within a script or automation to prevent further executio
|
|||||||
Test multiple conditions in 1 condition statement. Passes if all embedded conditions are valid.
|
Test multiple conditions in 1 condition statement. Passes if all embedded conditions are valid.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
condition: and
|
condition:
|
||||||
conditions:
|
condition: and
|
||||||
- condition: state
|
conditions:
|
||||||
entity_id: 'device_tracker.paulus'
|
- condition: state
|
||||||
state: 'home'
|
entity_id: 'device_tracker.paulus'
|
||||||
- condition: numeric_state
|
state: 'home'
|
||||||
entity_id: 'sensor.temperature'
|
- condition: numeric_state
|
||||||
below: '20'
|
entity_id: 'sensor.temperature'
|
||||||
|
below: '20'
|
||||||
```
|
```
|
||||||
|
|
||||||
### {% linkable_title OR condition %}
|
### {% linkable_title OR condition %}
|
||||||
@ -31,14 +32,15 @@ conditions:
|
|||||||
Test multiple conditions in 1 condition statement. Passes if any embedded conditions is valid.
|
Test multiple conditions in 1 condition statement. Passes if any embedded conditions is valid.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
condition: or
|
condition:
|
||||||
conditions:
|
condition: or
|
||||||
- condition: state
|
conditions:
|
||||||
entity_id: 'device_tracker.paulus'
|
- condition: state
|
||||||
state: 'home'
|
entity_id: 'device_tracker.paulus'
|
||||||
- condition: numeric_state
|
state: 'home'
|
||||||
entity_id: 'sensor.temperature'
|
- condition: numeric_state
|
||||||
below: '20'
|
entity_id: 'sensor.temperature'
|
||||||
|
below: '20'
|
||||||
```
|
```
|
||||||
|
|
||||||
### {% linkable_title MIXED AND and OR conditions %}
|
### {% linkable_title MIXED AND and OR conditions %}
|
||||||
@ -47,19 +49,20 @@ Test multiple AND and OR conditions in 1 condition statement. Passes if any embe
|
|||||||
This allows you to mix several AND and OR conditions together.
|
This allows you to mix several AND and OR conditions together.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
condition: and
|
condition:
|
||||||
conditions:
|
condition: and
|
||||||
- condition: state
|
conditions:
|
||||||
entity_id: 'device_tracker.paulus'
|
|
||||||
state: 'home'
|
|
||||||
- condition: or
|
|
||||||
conditions:
|
|
||||||
- condition: state
|
- condition: state
|
||||||
entity_id: sensor.weather_precip
|
entity_id: 'device_tracker.paulus'
|
||||||
state: 'rain'
|
state: 'home'
|
||||||
- condition: numeric_state
|
- condition: or
|
||||||
entity_id: 'sensor.temperature'
|
conditions:
|
||||||
below: '20'
|
- condition: state
|
||||||
|
entity_id: sensor.weather_precip
|
||||||
|
state: 'rain'
|
||||||
|
- condition: numeric_state
|
||||||
|
entity_id: 'sensor.temperature'
|
||||||
|
below: '20'
|
||||||
```
|
```
|
||||||
|
|
||||||
### {% linkable_title Numeric state condition %}
|
### {% linkable_title Numeric state condition %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user