From 14837c483344e519c76e7cc8622d2bbe22bb7368 Mon Sep 17 00:00:00 2001 From: Dani Date: Mon, 12 Sep 2016 08:42:13 +0200 Subject: [PATCH] Update scripts-conditions.markdown (#925) Clarification for the AND and OR examples of conditions. Some people were missing first 'condition' looking at the examples. --- .../scripts-conditions.markdown | 59 ++++++++++--------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/source/getting-started/scripts-conditions.markdown b/source/getting-started/scripts-conditions.markdown index 17256f028b4..68c2511001f 100644 --- a/source/getting-started/scripts-conditions.markdown +++ b/source/getting-started/scripts-conditions.markdown @@ -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. ```yaml -condition: and -conditions: - - condition: state - entity_id: 'device_tracker.paulus' - state: 'home' - - condition: numeric_state - entity_id: 'sensor.temperature' - below: '20' +condition: + condition: and + conditions: + - condition: state + entity_id: 'device_tracker.paulus' + state: 'home' + - condition: numeric_state + entity_id: 'sensor.temperature' + below: '20' ``` ### {% linkable_title OR condition %} @@ -31,14 +32,15 @@ conditions: Test multiple conditions in 1 condition statement. Passes if any embedded conditions is valid. ```yaml -condition: or -conditions: - - condition: state - entity_id: 'device_tracker.paulus' - state: 'home' - - condition: numeric_state - entity_id: 'sensor.temperature' - below: '20' +condition: + condition: or + conditions: + - condition: state + entity_id: 'device_tracker.paulus' + state: 'home' + - condition: numeric_state + entity_id: 'sensor.temperature' + below: '20' ``` ### {% 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. ```yaml -condition: and -conditions: - - condition: state - entity_id: 'device_tracker.paulus' - state: 'home' - - condition: or - conditions: +condition: + condition: and + conditions: - condition: state - entity_id: sensor.weather_precip - state: 'rain' - - condition: numeric_state - entity_id: 'sensor.temperature' - below: '20' + entity_id: 'device_tracker.paulus' + state: 'home' + - condition: or + conditions: + - condition: state + entity_id: sensor.weather_precip + state: 'rain' + - condition: numeric_state + entity_id: 'sensor.temperature' + below: '20' ``` ### {% linkable_title Numeric state condition %}