From b4913f61713777849b27f4dbd349cb2d563431d4 Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Sun, 5 Feb 2023 12:59:28 -0500 Subject: [PATCH] Separate file for E, and rework of sleeping automation Move E's sleep scripts to her own file --- packages/emmalynn.yaml | 140 ++++++++++++++++++++++++++++++ packages/lighting_and_scenes.yaml | 100 --------------------- 2 files changed, 140 insertions(+), 100 deletions(-) create mode 100644 packages/emmalynn.yaml diff --git a/packages/emmalynn.yaml b/packages/emmalynn.yaml new file mode 100644 index 0000000..08a93f4 --- /dev/null +++ b/packages/emmalynn.yaml @@ -0,0 +1,140 @@ +# This file is for entities/automations that are specific to Emmalynn + +input_boolean: + emma_sleeping: + name: Emma Sleeping + icon: mdi:sleep + +automation: + - id: 4f01dff7-be22-4850-a05e-1906e3151441 + alias: 'Emma Sleeping' + mode: queued + max: 10 + trigger: + - platform: state + entity_id: input_boolean.emma_sleeping + from: 'off' + to: 'on' + id: sleep-on + - platform: state + entity_id: input_boolean.emma_sleeping + from: 'on' + to: 'off' + id: sleep-off + condition: + - condition: state + entity_id: group.adults + state: 'home' + action: + - choose: + - conditions: + - condition: trigger + id: sleep-on + sequence: + - service: script.emma_naptime + - conditions: + - condition: trigger + id: sleep-off + sequence: + - service: script.emma_wakeup + +script: + 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 diff --git a/packages/lighting_and_scenes.yaml b/packages/lighting_and_scenes.yaml index 4d1896a..67eda8f 100644 --- a/packages/lighting_and_scenes.yaml +++ b/packages/lighting_and_scenes.yaml @@ -782,106 +782,6 @@ 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