Scheduling now uses scripts for more modularity, preparing for #38

This commit is contained in:
2022-09-14 09:13:29 -04:00
parent 898e1c0fc8
commit 392240adf5

View File

@ -61,6 +61,78 @@ automation:
- condition: trigger
id: kallen-morning
then:
- service: script.kallen_scheduling_morning
- if:
- condition: trigger
id: kallen-evening
then:
- service: script.kallen_scheduling_evening
- id: 1c9f7e4b-2d5a-4b95-bd80-d9aa2244a6db
alias: House Scheduling
trigger:
- platform: time
at: '05:00:00'
id: house-morning
- platform: time
at: '16:05:00'
id: house-evening
action:
- if:
- condition: trigger
id: house-morning
then:
- service: script.house_scheduling_morning
- if:
- condition: trigger
id: house-evening
then:
- service: script.house_scheduling_evening
- id: 89470712-f94d-4c01-8215-ed15b3bc799a
alias: Master Bedroom Scheduling
trigger:
- platform: time
at: '06:07:00'
id: mrbedroom-morning
- platform: time
at: '16:30:00'
id: mrbedroom-evening
action:
- if:
- condition: trigger
id: mrbedroom-morning
then:
- service: script.master_bedroom_scheduling_morning
- if:
- condition: trigger
id: mrbedroom-evening
then:
- service: script.master_bedroom_scheduling_evening
- id: a69d3d36-09d6-4ef3-a245-c564c7cb577c
alias: Nursery Scheduling
trigger:
- platform: time
at: '06:06:00'
action:
- service: input_datetime.set_datetime
entity_id: input_datetime.nursery_cooling
data_template:
time: >
{% set high = state_attr('sensor.current_forecast','high_temp') | float %}
{% set low = state_attr('sensor.current_forecast','overnight_low') | float %}
{% if high >= 85 %}
20:30
{% elif high >= 80 or low >= 60 %}
21:30
{% else %}
22:30
{% endif %}
script:
kallen_scheduling_morning:
sequence:
- service: input_datetime.set_datetime
entity_id: input_datetime.kallen_wakeup_time
data_template:
@ -89,10 +161,9 @@ automation:
{% else %}
Common Areas
{% endif %}
- if:
- condition: trigger
id: kallen-evening
then:
kallen_scheduling_evening:
sequence:
- service: input_datetime.set_datetime
entity_id: input_datetime.kallen_bedtime
data_template:
@ -112,20 +183,8 @@ automation:
21:40
{% endif %}
- id: 1c9f7e4b-2d5a-4b95-bd80-d9aa2244a6db
alias: House Scheduling
trigger:
- platform: time
at: '05:00:00'
id: house-morning
- platform: time
at: '16:05:00'
id: house-evening
action:
- if:
- condition: trigger
id: house-morning
then:
house_scheduling_morning:
sequence:
- service: input_datetime.set_datetime
entity_id: input_datetime.audible_notification_on
data_template:
@ -202,10 +261,8 @@ automation:
12:00
{% endif %}
- if:
- condition: trigger
id: house-evening
then:
house_scheduling_evening:
sequence:
- service: input_datetime.set_datetime
entity_id: input_datetime.audible_notification_off
data_template:
@ -216,20 +273,8 @@ automation:
23:00
{% endif %}
- id: 89470712-f94d-4c01-8215-ed15b3bc799a
alias: Master Bedroom Scheduling
trigger:
- platform: time
at: '06:07:00'
id: mrbedroom-morning
- platform: time
at: '16:30:00'
id: mrbedroom-evening
action:
- if:
- condition: trigger
id: mrbedroom-morning
then:
master_bedroom_scheduling_morning:
sequence:
- service: input_datetime.set_datetime
entity_id: input_datetime.master_bedroom_wakeup
data_template:
@ -239,10 +284,9 @@ automation:
{% else %}
13:00
{% endif %}
- if:
- condition: trigger
id: mrbedroom-evening
then:
master_bedroom_scheduling_evening:
sequence:
- service: input_datetime.set_datetime
entity_id: input_datetime.master_bedroom_cooling
data_template:
@ -270,23 +314,3 @@ automation:
{% else %}
00:00
{% endif %}
- id: a69d3d36-09d6-4ef3-a245-c564c7cb577c
alias: Nursery Scheduling
trigger:
- platform: time
at: '06:06:00'
action:
- service: input_datetime.set_datetime
entity_id: input_datetime.nursery_cooling
data_template:
time: >
{% set high = state_attr('sensor.current_forecast','high_temp') | float %}
{% set low = state_attr('sensor.current_forecast','overnight_low') | float %}
{% if high >= 85 %}
20:30
{% elif high >= 80 or low >= 60 %}
21:30
{% else %}
22:30
{% endif %}