# This file is here because I didn't want to crowd up my own YAML file... input_boolean: master_bedroom_sleeping: name: Master Bedroom Sleeping icon: mdi:sleep master_bedroom_alarm_clock: name: Master Bedroom Alarm Clock icon: mdi:alarm input_datetime: master_bedroom_cooling: name: Master Bedroom Cooling has_date: false has_time: true icon: mdi:fan-auto master_bedroom_fan: name: Master Bedroom Fan has_date: false has_time: true icon: mdi:fan-auto master_bedroom_wakeup: name: Master Bedroom Wakeup has_date: false has_time: true icon: mdi:fan-off master_bedroom_alarm_clock: name: Master Bedroom Alarm Clock has_date: false has_time: true icon: mdi:alarm automation: - id: 7889ccf2-1fee-4819-8e59-5ad4e5879b0a alias: 'Master Bedroom Sleeping' description: 'Handles the response to the Master Bedroom Sleeping toggle' initial_state: true mode: restart trigger: - platform: state entity_id: input_boolean.master_bedroom_sleeping from: 'off' to: 'on' id: sleep-on - platform: state entity_id: input_boolean.master_bedroom_sleeping from: 'on' to: 'off' id: sleep-off action: - choose: - conditions: - condition: trigger id: sleep-off sequence: - service: script.master_bedroom_wakeup - conditions: - condition: trigger id: sleep-on sequence: - service: script.master_bedroom_sleep script: master_bedroom_wakeup: alias: 'Master Bedroom Wakeup' mode: restart sequence: - variables: brightness: "{{ state_attr('switch.adaptive_lighting_master_bedroom','brightness_pct') }}" - service: switch.turn_off target: entity_id: switch.master_bedroom_echo_dot_do_not_disturb_switch - service: script.turn_on target: entity_id: script.volume_reset - service: switch.turn_off target: entity_id: switch.adaptive_lighting_master_bedroom - if: - condition: template value_template: "{{ is_state('input_boolean.give_me_darkness','on') and is_state('input_boolean.goodnight','off') }}" then: - service: script.turn_on target: entity_id: script.evening_on_second_floor - delay: seconds: 1 - service: light.turn_on target: entity_id: light.master_bedroom_lights data: brightness_pct: "{{ brightness }}" transition: > {% from 'time.jinja' import timer_duration %} {% if is_state('binary_sensor.early_night_mode','on') %} {{ timer_duration('input_number.wakeup_lights_fade_night') }} {% else %} {{ timer_duration('input_number.wakeup_lights_fade_day') }} {% endif %} - wait_for_trigger: - platform: state entity_id: light.master_bedroom_lights to: 'off' id: lights-off - platform: state entity_id: input_select.master_bedroom_scenes to: 'Adaptive' id: adaptive timeout: minutes: > {% if is_state('binary_sensor.early_night_mode','on') %} {{ states('input_number.wakeup_lights_fade_night') }} {% else %} {{ states('input_number.wakeup_lights_fade_day') }} {% endif %} - choose: - conditions: - condition: template value_template: "{{ wait.trigger == 'none' or wait.trigger.idx is undefined }}" sequence: - service: input_select.select_option target: entity_id: input_select.master_bedroom_scenes data: option: Adaptive - conditions: - condition: template value_template: "{{ wait.trigger.id == 'lights-off' }}" sequence: - service: switch.turn_on target: entity_id: switch.adaptive_lighting_master_bedroom - service: switch.turn_off target: entity_id: switch.adaptive_lighting_sleep_mode_master_bedroom - service: input_text.set_value target: entity_id: input_text.master_bedroom_selected_scene data: value: Adaptive - service: adaptive_lighting.set_manual_control data: manual_control: false entity_id: switch.adaptive_lighting_master_bedroom master_bedroom_sleep: alias: 'Master Bedroom Sleep' mode: restart sequence: - if: - condition: template value_template: "{{ is_state('input_boolean.give_me_darkness','on') and is_state('input_boolean.goodnight','off') }}" then: - service: light.turn_off target: entity_id: light.master_bedroom_lights - wait_template: "{{ is_state('light.master_bedroom_lights','off') }}" timeout: minutes: 60 continue_on_timeout: true - service: switch.turn_on target: entity_id: switch.adaptive_lighting_master_bedroom - service: switch.turn_off target: entity_id: switch.adaptive_lighting_sleep_mode_master_bedroom - service: input_text.set_value target: entity_id: input_text.master_bedroom_selected_scene data: value: Adaptive # TODO: Figure out which actions to move here, and which ones to keep in Node-RED master_bedroom_wakeup_briefing: alias: Master Bedroom Wakeup Briefing mode: single sequence: - service: script.speech_engine data: who: "{{ who|default('master_bedroom') }}" message: !include ../templates/speech/master_bedroom_wakeup.yaml