Add better provision for interrupting wakeup lights fading in
Improve the previous
This commit is contained in:
@ -329,64 +329,76 @@ script:
|
|||||||
# Lighting
|
# Lighting
|
||||||
- variables:
|
- variables:
|
||||||
brightness: "{{ state_attr('switch.adaptive_lighting_emma_bedroom','brightness_pct') }}"
|
brightness: "{{ state_attr('switch.adaptive_lighting_emma_bedroom','brightness_pct') }}"
|
||||||
- choose:
|
|
||||||
- conditions:
|
|
||||||
- condition: state
|
|
||||||
entity_id: binary_sensor.early_night_mode
|
|
||||||
state: 'on'
|
|
||||||
sequence:
|
|
||||||
- service: switch.turn_off
|
|
||||||
target:
|
|
||||||
entity_id: switch.adaptive_lighting_emma_bedroom
|
|
||||||
- delay:
|
|
||||||
seconds: 1
|
|
||||||
- service: light.turn_on
|
|
||||||
target:
|
|
||||||
entity_id: light.emma_bedroom_light
|
|
||||||
data:
|
|
||||||
brightness_pct: "{{ brightness }}"
|
|
||||||
transition: >
|
|
||||||
{% from 'time.jinja' import timer_duration %}
|
|
||||||
{{ timer_duration('input_number.wakeup_lights_fade_night') }}
|
|
||||||
- service: light.turn_on
|
|
||||||
target:
|
|
||||||
entity_id: light.hallway_overhead
|
|
||||||
- service: input_select.select_option
|
|
||||||
target:
|
|
||||||
entity_id:
|
|
||||||
- input_select.upstairs_hallway_scenes
|
|
||||||
- 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_emma_bedroom
|
|
||||||
- delay:
|
|
||||||
seconds: 1
|
|
||||||
- service: light.turn_on
|
|
||||||
target:
|
|
||||||
entity_id: light.emma_bedroom_light
|
|
||||||
data:
|
|
||||||
brightness_pct: "{{ brightness }}"
|
|
||||||
transition: >
|
|
||||||
{% from 'time.jinja' import timer_duration %}
|
|
||||||
{{ timer_duration('input_number.wakeup_lights_fade_day') }}
|
|
||||||
# Climate/White Noise
|
|
||||||
- if:
|
- if:
|
||||||
- condition: state
|
- condition: state
|
||||||
entity_id: binary_sensor.early_night_mode
|
entity_id: binary_sensor.early_night_mode
|
||||||
state: 'off'
|
state: 'on'
|
||||||
then:
|
then:
|
||||||
- delay:
|
- service: light.turn_on
|
||||||
minutes: 5
|
target:
|
||||||
else:
|
entity_id: light.hallway_overhead
|
||||||
- delay:
|
- service: input_select.select_option
|
||||||
minutes: "{{ states('input_number.wakeup_lights_fade_night') }}"
|
target:
|
||||||
|
entity_id:
|
||||||
|
- input_select.upstairs_hallway_scenes
|
||||||
|
- input_select.master_bedroom_scenes
|
||||||
|
data:
|
||||||
|
option: Adaptive
|
||||||
|
- service: switch.turn_off
|
||||||
|
target:
|
||||||
|
entity_id: switch.adaptive_lighting_emma_bedroom
|
||||||
|
- delay:
|
||||||
|
seconds: 1
|
||||||
|
- service: light.turn_on
|
||||||
|
target:
|
||||||
|
entity_id: light.emma_bedroom_light
|
||||||
|
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.emma_bedroom_light
|
||||||
|
to: 'off'
|
||||||
|
id: lights-off
|
||||||
|
- platform: state
|
||||||
|
entity_id: input_select.emma_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 %}
|
||||||
|
5
|
||||||
|
{% endif %}
|
||||||
|
- choose:
|
||||||
|
- conditions: "{{ wait.trigger == none }}"
|
||||||
|
sequence:
|
||||||
|
- service: input_select.select_option
|
||||||
|
target:
|
||||||
|
entity_id: input_select.emma_bedroom_scenes
|
||||||
|
data:
|
||||||
|
option: Adaptive
|
||||||
|
- conditions: "{{ wait.trigger.id == 'lights-off' }}"
|
||||||
|
sequence:
|
||||||
|
- service: switch.turn_on
|
||||||
|
target:
|
||||||
|
entity_id: switch.adaptive_lighting_emma_bedroom
|
||||||
|
- service: switch.turn_off
|
||||||
|
target:
|
||||||
|
entity_id: switch.adaptive_lighting_sleep_mode_emma_bedroom
|
||||||
|
- service: input_text.set_value
|
||||||
|
target:
|
||||||
|
entity_id: input_text.emma_bedroom_selected_scene
|
||||||
|
data:
|
||||||
|
value: Adaptive
|
||||||
|
# Climate/White Noise
|
||||||
- service: input_boolean.turn_off
|
- service: input_boolean.turn_off
|
||||||
target:
|
target:
|
||||||
entity_id: input_boolean.white_noise_emma_bedroom
|
entity_id: input_boolean.white_noise_emma_bedroom
|
||||||
@ -398,11 +410,6 @@ script:
|
|||||||
- service: script.turn_on
|
- service: script.turn_on
|
||||||
target:
|
target:
|
||||||
entity_id: script.emma_aircon_shutoff
|
entity_id: script.emma_aircon_shutoff
|
||||||
- service: input_select.select_option
|
|
||||||
target:
|
|
||||||
entity_id: input_select.emma_bedroom_scenes
|
|
||||||
data:
|
|
||||||
option: Adaptive
|
|
||||||
|
|
||||||
emma_aircon_shutoff:
|
emma_aircon_shutoff:
|
||||||
alias: 'Emma Air Conditioner Shutoff'
|
alias: 'Emma Air Conditioner Shutoff'
|
||||||
|
@ -90,74 +90,63 @@ script:
|
|||||||
- service: switch.turn_off
|
- service: switch.turn_off
|
||||||
target:
|
target:
|
||||||
entity_id: switch.master_bedroom_echo_dot_do_not_disturb_switch
|
entity_id: switch.master_bedroom_echo_dot_do_not_disturb_switch
|
||||||
- service: media_player.volume_set
|
- service: script.turn_on
|
||||||
target:
|
target:
|
||||||
entity_id: media_player.master_bedroom_echo_dot
|
entity_id: script.volume_reset
|
||||||
|
- 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:
|
data:
|
||||||
volume_level: >
|
brightness_pct: "{{ brightness }}"
|
||||||
{% if is_state('input_boolean.give_me_darkness','on') %}
|
transition: >
|
||||||
{{ states('input_number.master_bedroom_echo_dot_night_volume') }}
|
{% from 'time.jinja' import timer_duration %}
|
||||||
|
{% if is_state('binary_sensor.early_night_mode','on') %}
|
||||||
|
{{ timer_duration('input_number.wakeup_lights_fade_night') }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ states('input_number.master_bedroom_echo_dot_day_volume') }}
|
{{ timer_duration('input_number.wakeup_lights_fade_day') }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
- if:
|
- wait_for_trigger:
|
||||||
- condition: template
|
- platform: state
|
||||||
value_template: >
|
entity_id: light.master_bedroom_lights
|
||||||
{% set weather = states('weather.iron_nerd_weather_station') %}
|
to: 'off'
|
||||||
{{ weather in ['cloudy','partlycloudy','rainy','snowy','hail','lightning','lightning-rainy','pouring','snowy-rainy'] }}
|
id: lights-off
|
||||||
then:
|
- platform: state
|
||||||
- choose:
|
entity_id: input_select.master_bedroom_scenes
|
||||||
- conditions:
|
to: 'Adaptive'
|
||||||
- condition: state
|
id: adaptive
|
||||||
entity_id: binary_sensor.early_night_mode
|
timeout:
|
||||||
state: 'on'
|
minutes: >
|
||||||
sequence:
|
{% if is_state('binary_sensor.early_night_mode','on') %}
|
||||||
- service: switch.turn_off
|
{{ states('input_number.wakeup_lights_fade_night') }}
|
||||||
target:
|
{% else %}
|
||||||
entity_id: switch.adaptive_lighting_master_bedroom
|
{{ states('input_number.wakeup_lights_fade_day') }}
|
||||||
- delay:
|
{% endif %}
|
||||||
seconds: 1
|
- choose:
|
||||||
- service: light.turn_on
|
- conditions: "{{ wait.trigger == none }}"
|
||||||
target:
|
sequence:
|
||||||
entity_id: light.master_bedroom_lights
|
- service: input_select.select_option
|
||||||
data:
|
target:
|
||||||
brightness_pct: "{{ brightness }}"
|
entity_id: input_select.master_bedroom_scenes
|
||||||
transition: >
|
data:
|
||||||
{% from 'time.jinja' import timer_duration %}
|
option: Adaptive
|
||||||
{{ timer_duration('input_number.wakeup_lights_fade_night') }}
|
- conditions: "{{ wait.trigger.id == 'lights-off' }}"
|
||||||
- delay:
|
sequence:
|
||||||
minutes: "{{ states('input_number.wakeup_lights_fade_night') }}"
|
- service: switch.turn_on
|
||||||
- service: input_select.select_option
|
target:
|
||||||
target:
|
entity_id: switch.adaptive_lighting_master_bedroom
|
||||||
entity_id: input_select.master_bedroom_scenes
|
- service: switch.turn_off
|
||||||
data:
|
target:
|
||||||
option: Adaptive
|
entity_id: switch.adaptive_lighting_sleep_mode_master_bedroom
|
||||||
- conditions:
|
- service: input_text.set_value
|
||||||
- condition: state
|
target:
|
||||||
entity_id: binary_sensor.early_night_mode
|
entity_id: input_text.master_bedroom_selected_scene
|
||||||
state: 'off'
|
data:
|
||||||
sequence:
|
value: Adaptive
|
||||||
- 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:
|
master_bedroom_sleep:
|
||||||
alias: 'Master Bedroom Sleep'
|
alias: 'Master Bedroom Sleep'
|
||||||
|
Reference in New Issue
Block a user