Separate E's bedtime and cooling schedules

This commit is contained in:
2024-05-01 20:30:46 -04:00
parent fae9129712
commit c3239ddec7
5 changed files with 227 additions and 151 deletions

View File

@ -4989,3 +4989,35 @@
alias: Update Notification alias: Update Notification
mode: parallel mode: parallel
max: 10 max: 10
- id: '1714595577405'
alias: Emma Bedroom Cooling
description: ''
trigger:
- platform: time
at: input_datetime.emma_bedroom_cooling
alias: At the scheduled cooling time
condition:
- condition: state
entity_id: input_boolean.emma_sleeping
state: 'off'
alias: If Emma is not already asleep
- condition: state
entity_id: input_select.scheduled_climate_mode_emma_aircon
state: AC
alias: If the AC is scheduled to run
action:
- service: fan.turn_on
metadata: {}
data: {}
target:
entity_id: fan.emma_air_conditioner
alias: Turn on Emma's air conditioner
- service: script.text_notify
data:
who: parents
title: Emma Climate Schedule
message: The air conditioner in Emma's Bedroom has been activated.
type: normal
tag: emma-climate
alias: Send AC notification
mode: restart

View File

@ -44,6 +44,11 @@ input_datetime:
has_date: false has_date: false
has_time: true has_time: true
icon: mdi:fan-auto icon: mdi:fan-auto
emma_bedroom_cooling:
name: Emma Bedroom Cooling
has_date: false
has_time: true
icon: mdi:fan-auto
emma_wakeup: emma_wakeup:
name: Emma Wakeup name: Emma Wakeup
has_date: false has_date: false
@ -181,7 +186,7 @@ automation:
entity_id: input_boolean.emma_has_napped entity_id: input_boolean.emma_has_napped
state: 'off' state: 'off'
- condition: time - condition: time
after: "17:00:00" after: "17:30:00"
before: "01:00:00" before: "01:00:00"
then: then:
- service: input_datetime.set_datetime - service: input_datetime.set_datetime
@ -208,6 +213,13 @@ automation:
entity_id: input_datetime.emma_bedtime entity_id: input_datetime.emma_bedtime
data: data:
time: "{{ (state_attr('input_datetime.emma_up_from_nap','timestamp') + 14400) | timestamp_custom('%H:%M') }}" time: "{{ (state_attr('input_datetime.emma_up_from_nap','timestamp') + 14400) | timestamp_custom('%H:%M') }}"
- delay:
milliseconds: 500
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.emma_bedroom_cooling
data:
time: "{{ state_attr('input_datetime.emma_bedtime','timestamp') | int - 3600 }}"
- service: input_boolean.turn_on - service: input_boolean.turn_on
target: target:
entity_id: input_boolean.emma_has_napped entity_id: input_boolean.emma_has_napped
@ -950,145 +962,6 @@ script:
{% set interval = states('input_number.emma_cough_meds_interval') | int %} {% set interval = states('input_number.emma_cough_meds_interval') | int %}
{{ set_datetime(interval) }} {{ set_datetime(interval) }}
emma_sleep:
alias: 'Emma Sleep'
icon: mdi:lightbulb-night
mode: restart
sequence:
- if:
- condition: time
after: '04:00:00'
before: '16:00:00'
then:
- service: script.emma_bedroom_scheduling_evening
# Meds
- service: script.turn_off
target:
entity_id:
- script.emma_ibuprofen
- script.emma_tylenol
- script.emma_cough_meds
# Lighting
- 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
- delay:
seconds: 1
- service: input_select.select_option
target:
entity_id:
- input_select.emma_bedroom_scenes
data:
option: Adaptive
- service: adaptive_lighting.set_manual_control
data:
manual_control: false
entity_id: switch.adaptive_lighting_emma_bedroom
- conditions:
- condition: state
entity_id: binary_sensor.early_night_mode
state: 'off'
sequence:
- service: light.turn_on
target:
entity_id: light.emma_bedroom_light
- delay:
seconds: 1
- service: input_select.select_option
target:
entity_id: input_select.emma_bedroom_scenes
data:
option: Adaptive
- service: adaptive_lighting.set_manual_control
data:
manual_control: false
entity_id: switch.adaptive_lighting_emma_bedroom
# Climate
- choose:
- conditions:
- condition: or
conditions:
- condition: state
entity_id: input_boolean.emma_has_napped
state: 'on'
- condition: time
after: "23:00:00"
before: "04:00:00"
sequence:
- 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."
type: normal
tag: emma-climate
- 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."
type: normal
tag: emma-climate
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."
type: normal
tag: emma-climate
- conditions:
- condition: and
conditions:
- condition: state
entity_id: input_boolean.emma_has_napped
state: 'off'
- condition: time
before: "23:00:00"
after: "04:00:00"
sequence:
- choose:
- conditions:
- condition: state
entity_id: input_select.naptime_climate_mode_emma_aircon
state: AC
sequence:
- service: fan.turn_on
target:
entity_id: fan.emma_air_conditioner
- conditions:
- condition: state
entity_id: input_select.naptime_climate_mode_emma_aircon
state: White Noise
sequence:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.white_noise_emma_bedroom
emma_wakeup: emma_wakeup:
alias: 'Emma Wakeup' alias: 'Emma Wakeup'
icon: mdi:weather-sunset-up icon: mdi:weather-sunset-up

View File

@ -699,16 +699,7 @@ script:
- service: input_datetime.set_datetime - service: input_datetime.set_datetime
entity_id: input_datetime.emma_bedtime entity_id: input_datetime.emma_bedtime
data: data:
time: > time: 02:00
{% set high = states('sensor.todays_high_temp') | int %}
{% set low = states('sensor.overnight_lowest_temperature') | int %}
{% if is_state('input_boolean.hot_day','on') %}
22:00
{% elif high >= 80 or low >= 60 %}
23:00
{% else %}
23:45
{% endif %}
- if: - if:
- condition: state - condition: state
entity_id: input_boolean.emma_bedroom_climate_override entity_id: input_boolean.emma_bedroom_climate_override
@ -728,6 +719,20 @@ script:
{% else %} {% else %}
White Noise White Noise
{% endif %} {% endif %}
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.emma_bedroom_cooling
data:
time: >
{% set high = states('sensor.todays_high_temp') | int %}
{% set low = states('sensor.overnight_lowest_temperature') | int %}
{% if is_state('input_boolean.hot_day','on') %}
23:00
{% elif high >= 80 or low >= 60 %}
00:00
{% else %}
01:00
{% endif %}
- service: input_boolean.turn_on - service: input_boolean.turn_on
target: target:
entity_id: input_boolean.emma_scheduling_evening_ran entity_id: input_boolean.emma_scheduling_evening_ran

View File

@ -3137,3 +3137,169 @@ rabbit_hutch_cleaning:
tag: rabbit-hutch-cleaning tag: rabbit-hutch-cleaning
mode: restart mode: restart
icon: mdi:rabbit icon: mdi:rabbit
emma_sleep:
alias: Emma Sleep
sequence:
- if:
- condition: time
after: 04:00:00
before: '17:00:00'
then:
- service: script.emma_bedroom_scheduling_evening
data: {}
alias: Run scheduling if it hasn't already been run
- service: script.turn_off
target:
entity_id:
- script.emma_ibuprofen
- script.emma_tylenol
- script.emma_cough_meds
data: {}
alias: Reset med trackers
- service: light.turn_on
target:
entity_id:
- light.emma_bedroom_light
data: {}
alias: Turn on light
- delay:
seconds: 1
- service: input_select.select_option
target:
entity_id:
- input_select.emma_bedroom_scenes
data:
option: Adaptive
alias: Set lights to adaptive
- alias: Climate Controls
choose:
- conditions:
- alias: If Emma has napped or it is clearly bedtime
condition: or
conditions:
- condition: state
entity_id: input_boolean.emma_has_napped
state: 'on'
alias: Emma has napped
- condition: time
after: '23:00:00'
before: 04:00:00
alias: It is definitely bedtime
sequence:
- alias: Select climate mode
choose:
- conditions:
- alias: AC
condition: and
conditions:
- condition: state
entity_id: input_select.scheduled_climate_mode_emma_aircon
state: AC
alias: Scheduled mode is AC
- condition: state
entity_id: fan.emma_air_conditioner
state: 'off'
alias: Air conditioner is not already on
sequence:
- service: fan.turn_on
target:
entity_id: fan.emma_air_conditioner
data: {}
alias: Turn on air conditioner
- service: script.text_notify
data:
who: parents
title: Emma Climate Schedule
message: The air conditioner in Emma's Bedroom has been activated.
type: normal
tag: emma-climate
alias: Send AC notification
- conditions:
- alias: White Noise
condition: and
conditions:
- condition: state
entity_id: input_select.scheduled_climate_mode_emma_aircon
state: White Noise
alias: Scheduled mode is White Noise
- condition: state
entity_id: input_boolean.white_noise_emma_bedroom
state: 'off'
alias: White Noise is not already on
sequence:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.white_noise_emma_bedroom
data: {}
alias: Turn on white noise
- service: script.text_notify
data:
who: parents
title: Emma Climate Schedule
message: White noise has been activated in Emma's Bedroom.
type: normal
tag: emma-climate
alias: Send white noise notification
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.
type: normal
tag: emma-climate
alias: Send notification that no climate mode is selected
- conditions:
- alias: If Emma has NOT napped and the time is appropriate
condition: and
conditions:
- condition: state
entity_id: input_boolean.emma_has_napped
state: 'off'
alias: Emma has not napped
- condition: time
before: '23:00:00'
after: 04:00:00
alias: It is not bedtime
sequence:
- alias: Select naptime climate mode
choose:
- conditions:
- alias: AC
condition: and
conditions:
- condition: state
entity_id: input_select.naptime_climate_mode_emma_aircon
state: AC
alias: Scheduled naptime mode is AC
- condition: state
entity_id: fan.emma_air_conditioner
state: 'off'
alias: Air conditioner is not already on
sequence:
- service: fan.turn_on
target:
entity_id: fan.emma_air_conditioner
data: {}
alias: Turn on AC
- conditions:
- alias: White Noise
condition: and
conditions:
- condition: state
entity_id: input_select.naptime_climate_mode_emma_aircon
state: White Noise
alias: Scheduled naptime mode is White Noise
- condition: state
entity_id: input_boolean.white_noise_emma_bedroom
state: 'off'
alias: White Noise is not already on
sequence:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.white_noise_emma_bedroom
data: {}
alias: Turn on white noise
icon: mdi:lightbulb-night
mode: restart

View File

@ -73,7 +73,7 @@
{% endif %} {% endif %}
{% if states('input_select.scheduled_climate_mode_emma_aircon') != 'N/A' %} {% if states('input_select.scheduled_climate_mode_emma_aircon') != 'N/A' %}
{% if is_state('input_select.scheduled_climate_mode_emma_aircon','AC') and is_state('fan.emma_air_conditioner','off') %} {% if is_state('input_select.scheduled_climate_mode_emma_aircon','AC') and is_state('fan.emma_air_conditioner','off') %}
"Emma's air conditioner will be activated at {{ input_datetime_read('input_datetime.emma_bedtime') }}. " "Emma's air conditioner will be activated at {{ input_datetime_read('input_datetime.emma_bedroom_cooling') }}. "
{% elif is_state('input_select.scheduled_climate_mode_emma_aircon','White Noise') and is_state('input_boolean.white_noise_emma_bedroom','off') %} {% elif is_state('input_select.scheduled_climate_mode_emma_aircon','White Noise') and is_state('input_boolean.white_noise_emma_bedroom','off') %}
"Emma's white noise generator will activate at {{ input_datetime_read('input_datetime.emma_bedtime') }}. " "Emma's white noise generator will activate at {{ input_datetime_read('input_datetime.emma_bedtime') }}. "
{% endif %} {% endif %}