From e3595c0b109c88c15b3464cff37564c076fe58d9 Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Thu, 2 Feb 2023 12:38:24 -0500 Subject: [PATCH] Rework E's bedroom scenes --- packages/climate.yaml | 67 +---------------- packages/lighting_and_scenes.yaml | 115 ++++++++++++++++++++++++++---- 2 files changed, 102 insertions(+), 80 deletions(-) diff --git a/packages/climate.yaml b/packages/climate.yaml index 703b491..13a0cff 100644 --- a/packages/climate.yaml +++ b/packages/climate.yaml @@ -262,69 +262,4 @@ automation: who: "parents" title: "Emma Climate Schedule" message: "No option selected for Emma's climate mode. No devices will be activated." - mode: restart - -script: - emma_wakeup: - alias: "Emma Wakeup" - mode: restart - sequence: - - choose: - - conditions: - - condition: state - entity_id: binary_sensor.early_night_mode - state: 'on' - sequence: - - service: input_select.select_option - target: - entity_id: input_select.emma_bedroom_scenes - data: - option: Nightlight - - service: light.turn_on - target: - entity_id: light.hallway_overhead - - delay: - seconds: 2 - - service: input_select.select_option - target: - entity_id: - - input_select.upstairs_hallway_scenes - - input_select.master_bedroom_scenes - data: - option: Adaptive - - conditions: - - condition: or - conditions: - - condition: state - entity_id: binary_sensor.morning - state: 'on' - - condition: state - entity_id: binary_sensor.late_morning - state: 'on' - sequence: - - service: light.turn_on - target: - entity_id: light.emma_bedroom_light - - service: input_select.select_option - target: - entity_id: input_select.emma_bedroom_scenes - data: - option: Adaptive - - delay: - minutes: 5 - - service: input_boolean.turn_off - target: - entity_id: input_boolean.white_noise_emma_bedroom - - if: - - condition: template - value_template: >- - {% set ct = ((now().hour * 60 + now().minute) * 60 ) %} - {% if is_state('input_boolean.hot_day','off') and ct < state_attr('input_datetime.emma_bedtime','timestamp') and ct >= state_attr('input_datetime.emma_wakeup','timestamp') %} - true - {% else %} - false - {% endif %} - then: - - service: fan.turn_off - target: - entity_id: fan.emma_air_conditioner + mode: restart \ No newline at end of file diff --git a/packages/lighting_and_scenes.yaml b/packages/lighting_and_scenes.yaml index fdd2247..4d1896a 100644 --- a/packages/lighting_and_scenes.yaml +++ b/packages/lighting_and_scenes.yaml @@ -782,6 +782,106 @@ script: data: value: Adaptive + emma_naptime: + alias: 'Emma Naptime' + icon: mdi:lightbulb-night + mode: restart + sequence: + - choose: + - conditions: + - condition: state + entity_id: binary_sensor.early_night_mode + state: 'on' + sequence: + - service: light.turn_on + target: + entity_id: + - light.emma_bedroom_light + - light.hallway_overhead + - service: input_boolean.turn_on + target: + entity_id: input_boolean.white_noise_emma_bedroom + - service: input_select.select_option + target: + entity_id: + - input_select.emma_bedroom_scenes + - input_select.upstairs_hallway_scenes + data: + option: Adaptive + - conditions: + - condition: state + entity_id: binary_sensor.early_night_mode + state: 'off' + sequence: + - service: input_boolean.turn_on + target: + entity_id: input_boolean.white_noise_emma_bedroom + + emma_wakeup: + alias: 'Emma Wakeup' + icon: mdi:weather-sunset-up + mode: restart + sequence: + - choose: + - conditions: + - condition: state + entity_id: binary_sensor.early_night_mode + state: 'on' + sequence: + - service: input_select.select_option + target: + entity_id: input_select.emma_bedroom_scenes + data: + option: Nightlight + - service: light.turn_on + target: + entity_id: light.hallway_overhead + - delay: + seconds: 2 + - service: input_select.select_option + target: + entity_id: + - input_select.upstairs_hallway_scenes + - input_select.master_bedroom_scenes + data: + option: Adaptive + - conditions: + - condition: or + conditions: + - condition: state + entity_id: binary_sensor.morning + state: 'on' + - condition: state + entity_id: binary_sensor.late_morning + state: 'on' + sequence: + - service: light.turn_on + target: + entity_id: light.emma_bedroom_light + - service: input_select.select_option + target: + entity_id: input_select.emma_bedroom_scenes + data: + option: Adaptive + - delay: + minutes: 5 + - service: input_boolean.turn_off + target: + entity_id: input_boolean.white_noise_emma_bedroom + - if: + - condition: template + value_template: >- + {% set ct = ((now().hour * 60 + now().minute) * 60 ) %} + {% if is_state('input_boolean.hot_day','off') and ct < state_attr('input_datetime.emma_bedtime','timestamp') and ct >= state_attr('input_datetime.emma_wakeup','timestamp') %} + true + {% else %} + false + {% endif %} + then: + - service: fan.turn_off + target: + entity_id: fan.emma_air_conditioner + scene: - name: Adaptive in Living Room icon: mdi:palette @@ -1191,17 +1291,4 @@ scene: input_select.upstairs_hallway_scenes: state: "Nightlight" input_select.upstairs_bathroom_scenes: - state: "Nightlight" - - name: Emma Naptime - icon: mdi:palette - entities: - light.emma_bedroom_light: - state: "on" - input_select.emma_bedroom_scenes: - state: "Adaptive" - light.hallway_overhead: - state: "on" - input_select.upstairs_hallway_scenes: - state: "Adaptive" - input_boolean.white_noise_emma_bedroom: - state: "on" \ No newline at end of file + state: "Nightlight" \ No newline at end of file