From bb485967f955b82590850a53b33eeb074111ed8f Mon Sep 17 00:00:00 2001 From: Giorgio Ravera Date: Thu, 1 Oct 2020 12:29:17 +0200 Subject: [PATCH] Shorthand notation for template conditions. --- automations/doors.yaml | 6 +----- packages/alarm/guard_mode.yaml | 10 ++-------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/automations/doors.yaml b/automations/doors.yaml index a566eb09..e37a14b3 100644 --- a/automations/doors.yaml +++ b/automations/doors.yaml @@ -16,11 +16,7 @@ entity_id: binary_sensor.main_door_contact to: 'on' - condition: - - condition: numeric_state - entity_id: sun.sun - value_template: "{{ state_attr('sun.sun', 'elevation') }}" - below: -10 + condition: "{{ (state_attr('sun.sun', 'elevation') | int) < 10 }}" action: - delay: 00:00:01 diff --git a/packages/alarm/guard_mode.yaml b/packages/alarm/guard_mode.yaml index 5c425cd5..8743736b 100644 --- a/packages/alarm/guard_mode.yaml +++ b/packages/alarm/guard_mode.yaml @@ -44,10 +44,7 @@ automation: - platform: homeassistant event: start - condition: - condition: template - value_template: >- - {{ not is_state('group.residents', 'home') }} + condition: "{{ not is_state('group.residents', 'home') }}" action: - service: input_boolean.turn_on @@ -66,10 +63,7 @@ automation: - platform: homeassistant event: start - condition: - condition: template - value_template: >- - {{ is_state('group.residents', 'home') }} + condition: "{{ is_state('group.residents', 'home') }}" action: - service: input_boolean.turn_off -- 2.47.3