Revamp how morning/night works in E's bedroom

This commit is contained in:
2023-01-03 16:23:32 -05:00
parent 414cbe30f7
commit 1c3e2f189e
2 changed files with 101 additions and 75 deletions

View File

@ -179,47 +179,115 @@ input_number:
automation:
- id: '1655415573165'
alias: Emma Bedroom Cooling
description: For keeping the babys room at a safe temperature
alias: Emma Bedroom Handling
description: "For scheduled operations in Emma's bedroom"
trigger:
- platform: time
at: input_datetime.emma_wakeup
id: emma-wakeup
- platform: time
at: input_datetime.emma_bedtime
id: emma-bedtime
condition:
- condition: state
entity_id: input_boolean.vacation_mode
state: 'off'
action:
- choose:
- conditions:
- if:
- condition: trigger
id: emma-wakeup
then:
- service: script.emma_wakeup
- if:
- condition: trigger
id: emma-bedtime
then:
- choose:
- conditions:
- condition: state
entity_id: input_select.scheduled_climate_mode_emma_aircon
state: AC
sequence:
- service: fan.turn_on
target:
entity_id: fan.emma_air_conditioner
- service: script.text_notify
data:
who: "parents"
title: "Emma Climate Schedule"
message: "The air conditioner in Emma's Bedroom has been activated."
- conditions:
- condition: state
entity_id: input_select.scheduled_climate_mode_emma_aircon
state: White Noise
sequence:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.white_noise_emma_bedroom
- service: script.text_notify
data:
who: "parents"
title: "Emma Climate Schedule"
message: "White noise has been activated in Emma's Bedroom."
default:
- service: script.text_notify
data:
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:
- if:
- condition: state
entity_id: input_select.scheduled_climate_mode_emma_aircon
state: AC
sequence:
- service: fan.turn_on
entity_id: input_boolean.early_night_mode
state: 'on'
then:
- 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
else:
- 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
- service: script.text_notify
data:
who: "parents"
title: "Emma Climate Schedule"
message: "The air conditioner in Emma's Bedroom has been activated."
- conditions:
- condition: state
entity_id: input_select.scheduled_climate_mode_emma_aircon
state: White Noise
sequence:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.white_noise_emma_bedroom
- service: script.text_notify
data:
who: "parents"
title: "Emma Climate Schedule"
message: "White noise has been activated in Emma's Bedroom."
default:
- service: script.text_notify
data:
who: "parents"
title: "Emma Climate Schedule"
message: "No option selected for Emma's climate mode. No devices will be activated."
mode: restart

View File

@ -561,48 +561,6 @@ automation:
seconds: 2
# The delay is to prevent the boolean from re-running the automation if the lights were turned on manually
script:
emma_wakeup:
alias: "Emma Wakeup"
mode: restart
sequence:
- if:
- condition: state
entity_id: input_boolean.early_night_mode
state: 'on'
then:
- 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
else:
- 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
scene:
- name: Adaptive in Living Room
icon: mdi:palette