Made E's sleep toggle a little smarter about bedtime
This commit is contained in:
@ -82,11 +82,16 @@ 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:
|
||||||
|
- condition: and
|
||||||
|
conditions:
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ states('sensor.time') < state_attr('input_datetime.emma_bedtime','timestamp') | timestamp_custom('%H:%M', false) }}"
|
||||||
|
- conition: state
|
||||||
entity_id: input_boolean.give_me_darkness
|
entity_id: input_boolean.give_me_darkness
|
||||||
state: 'on'
|
state: 'on'
|
||||||
then:
|
sequence:
|
||||||
- service: light.turn_on
|
- service: light.turn_on
|
||||||
target:
|
target:
|
||||||
entity_id:
|
entity_id:
|
||||||
@ -99,7 +104,15 @@ script:
|
|||||||
- input_select.emma_bedroom_scenes
|
- input_select.emma_bedroom_scenes
|
||||||
data:
|
data:
|
||||||
option: Adaptive
|
option: Adaptive
|
||||||
else:
|
- conditions:
|
||||||
|
- condition: and
|
||||||
|
conditions:
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ states('sensor.time') < state_attr('input_datetime.emma_bedtime','timestamp') | timestamp_custom('%H:%M', false) }}"
|
||||||
|
- conition: state
|
||||||
|
entity_id: input_boolean.give_me_darkness
|
||||||
|
state: 'off'
|
||||||
|
sequence:
|
||||||
- service: light.turn_on
|
- service: light.turn_on
|
||||||
target:
|
target:
|
||||||
entity_id:
|
entity_id:
|
||||||
@ -123,6 +136,10 @@ script:
|
|||||||
- service: fan.turn_on
|
- service: fan.turn_on
|
||||||
target:
|
target:
|
||||||
entity_id: fan.emma_air_conditioner
|
entity_id: fan.emma_air_conditioner
|
||||||
|
- 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"
|
||||||
@ -136,12 +153,20 @@ 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
|
- 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: "White noise has been activated in Emma's Bedroom."
|
||||||
default:
|
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"
|
||||||
@ -152,23 +177,23 @@ script:
|
|||||||
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 %}
|
|
||||||
false
|
|
||||||
{% endif %}
|
|
||||||
then:
|
|
||||||
- service: fan.turn_on
|
- service: fan.turn_on
|
||||||
target:
|
target:
|
||||||
entity_id: fan.emma_air_conditioner
|
entity_id: fan.emma_air_conditioner
|
||||||
else:
|
- conditions:
|
||||||
|
- condition: state
|
||||||
|
entity_id: input_select.scheduled_climate_mode_emma_aircon
|
||||||
|
state: 'White Noise'
|
||||||
|
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
|
||||||
|
Reference in New Issue
Block a user