Skip to content

Commit 14837c4

Browse files
danichispaballoob
authored andcommitted
Update scripts-conditions.markdown (home-assistant#925)
Clarification for the AND and OR examples of conditions. Some people were missing first 'condition' looking at the examples.
1 parent 21e2885 commit 14837c4

File tree

1 file changed

+31
-28
lines changed

1 file changed

+31
-28
lines changed

source/getting-started/scripts-conditions.markdown

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,31 @@ Conditions can be used within a script or automation to prevent further executio
1616
Test multiple conditions in 1 condition statement. Passes if all embedded conditions are valid.
1717

1818
```yaml
19-
condition: and
20-
conditions:
21-
- condition: state
22-
entity_id: 'device_tracker.paulus'
23-
state: 'home'
24-
- condition: numeric_state
25-
entity_id: 'sensor.temperature'
26-
below: '20'
19+
condition:
20+
condition: and
21+
conditions:
22+
- condition: state
23+
entity_id: 'device_tracker.paulus'
24+
state: 'home'
25+
- condition: numeric_state
26+
entity_id: 'sensor.temperature'
27+
below: '20'
2728
```
2829
2930
### {% linkable_title OR condition %}
3031
3132
Test multiple conditions in 1 condition statement. Passes if any embedded conditions is valid.
3233
3334
```yaml
34-
condition: or
35-
conditions:
36-
- condition: state
37-
entity_id: 'device_tracker.paulus'
38-
state: 'home'
39-
- condition: numeric_state
40-
entity_id: 'sensor.temperature'
41-
below: '20'
35+
condition:
36+
condition: or
37+
conditions:
38+
- condition: state
39+
entity_id: 'device_tracker.paulus'
40+
state: 'home'
41+
- condition: numeric_state
42+
entity_id: 'sensor.temperature'
43+
below: '20'
4244
```
4345
4446
### {% 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
4749
This allows you to mix several AND and OR conditions together.
4850
4951
```yaml
50-
condition: and
51-
conditions:
52-
- condition: state
53-
entity_id: 'device_tracker.paulus'
54-
state: 'home'
55-
- condition: or
56-
conditions:
52+
condition:
53+
condition: and
54+
conditions:
5755
- condition: state
58-
entity_id: sensor.weather_precip
59-
state: 'rain'
60-
- condition: numeric_state
61-
entity_id: 'sensor.temperature'
62-
below: '20'
56+
entity_id: 'device_tracker.paulus'
57+
state: 'home'
58+
- condition: or
59+
conditions:
60+
- condition: state
61+
entity_id: sensor.weather_precip
62+
state: 'rain'
63+
- condition: numeric_state
64+
entity_id: 'sensor.temperature'
65+
below: '20'
6366
```
6467
6568
### {% linkable_title Numeric state condition %}

0 commit comments

Comments
 (0)