From 3b162d07677184e8147088a6428b58f207cd5bee Mon Sep 17 00:00:00 2001 From: Przemek Grondek Date: Tue, 17 May 2022 19:05:26 +0200 Subject: [PATCH] Simplify sleep mode automations --- configuration/automations/modes.yaml | 11 +++++++++++ templates/lights.yaml.j2 | 12 ++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/configuration/automations/modes.yaml b/configuration/automations/modes.yaml index 84b1eb8..ca11974 100644 --- a/configuration/automations/modes.yaml +++ b/configuration/automations/modes.yaml @@ -3,6 +3,17 @@ trigger: - platform: time at: input_datetime.sleep_mode + - platform: state + entity_id: + - group.guests + to: not_home + condition: + - condition: state + entity_id: group.guests + state: not_home + - condition: time + before: input_datetime.day_mode + after: input_datetime.sleep_mode action: - service: input_boolean.turn_on entity_id: input_boolean.sleep_mode diff --git a/templates/lights.yaml.j2 b/templates/lights.yaml.j2 index 388d3b5..9ba7cc4 100644 --- a/templates/lights.yaml.j2 +++ b/templates/lights.yaml.j2 @@ -3,22 +3,14 @@ - id: sleep_on_{{ light.entityId }} alias: '[Sleep-On] {{ light.name }}' trigger: - - platform: time - at: input_datetime.sleep_mode - platform: state entity_id: - - group.guests - to: not_home + - input_boolean.sleep_mode + to: 'on' condition: - condition: state entity_id: {{ light.entityId }} state: 'on' - - condition: state - entity_id: group.guests - state: not_home - - condition: time - before: input_datetime.day_mode - after: input_datetime.sleep_mode action: - service: light.turn_on data: