Made E's sleep toggle a little smarter about bedtime

This commit is contained in:
2023-02-14 19:44:19 -05:00
parent 9ae90865bf
commit 0ba4bd5e18

View File

@ -82,38 +82,51 @@ script:
entity_id: binary_sensor.early_night_mode entity_id: binary_sensor.early_night_mode
state: 'on' state: 'on'
sequence: sequence:
- if: - choose:
- condition: state - conditions:
entity_id: input_boolean.give_me_darkness - condition: and
state: 'on' conditions:
then: - condition: template
- service: light.turn_on value_template: "{{ states('sensor.time') < state_attr('input_datetime.emma_bedtime','timestamp') | timestamp_custom('%H:%M', false) }}"
target: - conition: state
entity_id: entity_id: input_boolean.give_me_darkness
- light.emma_bedroom_light state: 'on'
- delay: sequence:
seconds: 1 - service: light.turn_on
- service: input_select.select_option target:
target: entity_id:
entity_id: - light.emma_bedroom_light
- input_select.emma_bedroom_scenes - delay:
data: seconds: 1
option: Adaptive - service: input_select.select_option
else: target:
- service: light.turn_on entity_id:
target: - input_select.emma_bedroom_scenes
entity_id: data:
- light.emma_bedroom_light option: Adaptive
- light.hallway_overhead - conditions:
- delay: - condition: and
seconds: 1 conditions:
- service: input_select.select_option - condition: template
target: value_template: "{{ states('sensor.time') < state_attr('input_datetime.emma_bedtime','timestamp') | timestamp_custom('%H:%M', false) }}"
entity_id: - conition: state
- input_select.emma_bedroom_scenes entity_id: input_boolean.give_me_darkness
- input_select.upstairs_hallway_scenes state: 'off'
data: sequence:
option: Adaptive - service: light.turn_on
target:
entity_id:
- light.emma_bedroom_light
- light.hallway_overhead
- delay:
seconds: 1
- service: input_select.select_option
target:
entity_id:
- input_select.emma_bedroom_scenes
- input_select.upstairs_hallway_scenes
data:
option: Adaptive
- choose: - choose:
- conditions: - conditions:
- condition: state - condition: state
@ -123,11 +136,15 @@ script:
- service: fan.turn_on - service: fan.turn_on
target: target:
entity_id: fan.emma_air_conditioner entity_id: fan.emma_air_conditioner
- service: script.text_notify - if:
data: - condition: template
who: "parents" value_template: "{{ states('sensor.time') >= state_attr('input_datetime.emma_bedtime','timestamp') | timestamp_custom('%H:%M', false) }}"
title: "Emma Climate Schedule" then:
message: "The air conditioner in Emma's Bedroom has been activated." - service: script.text_notify
data:
who: "parents"
title: "Emma Climate Schedule"
message: "The air conditioner in Emma's Bedroom has been activated."
- conditions: - conditions:
- condition: state - condition: state
entity_id: input_select.scheduled_climate_mode_emma_aircon entity_id: input_select.scheduled_climate_mode_emma_aircon
@ -136,42 +153,50 @@ script:
- service: input_boolean.turn_on - service: input_boolean.turn_on
target: target:
entity_id: input_boolean.white_noise_emma_bedroom entity_id: input_boolean.white_noise_emma_bedroom
- if:
- condition: template
value_template: "{{ states('sensor.time') >= state_attr('input_datetime.emma_bedtime','timestamp') | timestamp_custom('%H:%M', false) }}"
then:
- service: script.text_notify
data:
who: "parents"
title: "Emma Climate Schedule"
message: "White noise has been activated in Emma's Bedroom."
default:
- if:
- condition: template
value_template: "{{ states('sensor.time') >= state_attr('input_datetime.emma_bedtime','timestamp') | timestamp_custom('%H:%M', false) }}"
then:
- service: script.text_notify - service: script.text_notify
data: data:
who: "parents" who: "parents"
title: "Emma Climate Schedule" title: "Emma Climate Schedule"
message: "White noise has been activated in Emma's Bedroom." message: "No option selected for Emma's climate mode. No devices will be activated."
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."
- conditions: - conditions:
- condition: state - condition: state
entity_id: binary_sensor.early_night_mode entity_id: binary_sensor.early_night_mode
state: 'off' state: 'off'
sequence: sequence:
- if: - service: script.emma_bedroom_scheduling_evening
- condition: template - delay:
value_template: > seconds: 2
{% if is_state('input_boolean.emma_bedroom_aircon_installed','on') %} - choose:
{% if (states('sensor.pirateweather_temperature') | int) > (states('input_number.emma_aircon_threshold') | int) %} - conditions:
true - condition: state
{% else %} entity_id: input_select.scheduled_climate_mode_emma_aircon
false state: 'AC'
{% endif %} sequence:
{% else %} - service: fan.turn_on
false target:
{% endif %} entity_id: fan.emma_air_conditioner
then: - conditions:
- service: fan.turn_on - condition: state
target: entity_id: input_select.scheduled_climate_mode_emma_aircon
entity_id: fan.emma_air_conditioner state: 'White Noise'
else: sequence:
- service: input_boolean.turn_on - service: input_boolean.turn_on
target: target:
entity_id: input_boolean.white_noise_emma_bedroom entity_id: input_boolean.white_noise_emma_bedroom
emma_wakeup: emma_wakeup:
alias: 'Emma Wakeup' alias: 'Emma Wakeup'