From 0df9563fd29185a02e4fff791779d9cd28a378e5 Mon Sep 17 00:00:00 2001 From: Bart274 Date: Fri, 20 May 2016 17:19:18 +0200 Subject: [PATCH] Update scripts-conditions.markdown (#491) --- .../scripts-conditions.markdown | 51 +++++++++++++------ 1 file changed, 36 insertions(+), 15 deletions(-) diff --git a/source/getting-started/scripts-conditions.markdown b/source/getting-started/scripts-conditions.markdown index 3ee0d281bd2..10022a1c719 100644 --- a/source/getting-started/scripts-conditions.markdown +++ b/source/getting-started/scripts-conditions.markdown @@ -26,6 +26,42 @@ conditions: below: '20' ``` +#### {% linkable_title OR condition %} + +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' +``` + +#### {% linkable_title MIXED AND and OR conditions %} + +Test multiple AND and OR conditions in 1 condition statement. Passes if any embedded conditions is valid. +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: state + entity_id: sensor.weather_precip + state: 'rain' + - condition: numeric_state + entity_id: 'sensor.temperature' + below: '20' +``` + #### {% linkable_title Numeric state condition %} This type of condition attempts to parse the state of specified entity as a number and triggers if the value matches all of the above or below thresholds. @@ -43,21 +79,6 @@ below: 25 value_template: {{ float(state.state) + 2 }} ``` -#### {% linkable_title OR condition %} - -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' -``` - #### {% linkable_title State condition %} Tests if an entity is a specified state.