# 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 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 automation: - id: 09c3d481-11df-459c-9240-d002b9b2ef53 alias: 'Master Bedroom Handling' description: "For scheduled operations in the Master Bedroom" initial_state: true mode: single trigger: - platform: time at: input_datetime.master_bedroom_wakeup id: wakeup condition: - condition: state entity_id: group.adults state: home action: - choose: - conditions: - condition: trigger id: wakeup sequence: - service: input_boolean.turn_off target: entity_id: input_boolean.master_bedroom_sleeping # Currently, input_boolean.master_bedroom_sleeping is turned on by the Goodnight flow in Node-RED whenever I go to bed. # That is why there is only one trigger here at the moment. - 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: button.press target: entity_id: button.master_bedroom_day_mode - service: switch.turn_off target: entity_id: switch.master_bedroom_echo_dot_do_not_disturb_switch - service: media_player.volume_set target: entity_id: media_player.master_bedroom_echo_dot data: volume_level: > {% if is_state('input_boolean.give_me_darkness','on') %} {{ states('input_number.master_bedroom_echo_dot_night_volume') }} {% else %} {{ states('input_number.master_bedroom_echo_dot_day_volume') }} {% endif %} - if: - condition: template value_template: > {% set weather = states('weather.iron_nerd_weather_station') %} {{ weather in ['cloudy','partlycloudy','rainy','snowy','hail','lightning','lightning-rainy','pouring','snowy-rainy'] }} then: - choose: - conditions: - condition: state entity_id: binary_sensor.early_night_mode state: 'on' sequence: - service: switch.turn_off target: entity_id: switch.adaptive_lighting_master_bedroom - 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 %} {{ timer_duration('input_number.wakeup_lights_fade_night') }} - delay: minutes: "{{ states('input_number.wakeup_lights_fade_night') }}" - service: input_select.select_option target: entity_id: input_select.master_bedroom_scenes data: option: Adaptive - conditions: - condition: state entity_id: binary_sensor.early_night_mode state: 'off' sequence: - service: switch.turn_off target: entity_id: switch.adaptive_lighting_master_bedroom - 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 %} {{ timer_duration('input_number.wakeup_lights_fade_day') }} - delay: minutes: "{{ states('input_number.wakeup_lights_fade_day') }}" - service: input_select.select_option target: entity_id: input_select.master_bedroom_scenes data: option: Adaptive - service: script.volume_reset master_bedroom_sleep: alias: 'Master Bedroom Sleep' mode: restart sequence: - if: - condition: state entity_id: climate.master_bedroom_aircon state: 'cool' then: - service: climate.set_preset_mode target: entity_id: climate.master_bedroom_aircon data: preset_mode: 'none' - wait_template: "{{ is_state('light.master_bedroom_lights','off') }}" timeout: minutes: 30 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