Files
Home-Assistant-Configs/packages/scheduling.yaml

363 lines
12 KiB
YAML

input_datetime:
good_morning:
name: Good Morning
has_date: false
has_time: true
icon: mdi:weather-sunset-up
good_night_routine:
name: Good Night Routine
has_date: false
has_time: true
icon: mdi:weather-night
kallen_bedtime:
name: Kallen Bedtime
has_date: false
has_time: true
icon: mdi:weather-night
kallen_wakeup_time:
name: Kallen Wake-up Time
has_date: false
has_time: true
icon: mdi:bell-alert
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
nursery_cooling:
name: Nursery Cooling
has_date: false
has_time: true
icon: mdi:fan-auto
nursery_wakeup:
name: Nursery Wakeup
has_date: false
has_time: true
icon: mdi:fan-off
automation:
- id: c772b54d-6448-4d74-a0c2-32998f49b17c
alias: Kallen Scheduling
trigger:
- platform: time
at: '05:00:00'
id: kallen-morning
- platform: time
at: '16:00:00'
id: kallen-evening
action:
- if:
- 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:05: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: script.nursery_scheduling
script:
kallen_scheduling_morning:
sequence:
- service: input_datetime.set_datetime
entity_id: input_datetime.kallen_wakeup_time
data_template:
time: >
{% if is_state('input_boolean.school_today', 'on') %}
{% if is_state('input_boolean.kallen_two_hour_delay','on') %}
09:30
{% else %}
07:30
{% endif %}
{% else %}
10:00
{% endif %}
- service: input_datetime.set_datetime
entity_id: input_datetime.school_day_start
data_template:
time: >
{% if is_state('input_boolean.kallen_two_hour_delay','on') %}
11:00
{% else %}
09:00
{% endif %}
- service: input_select.select_option
target:
entity_id: input_select.kallen_morning_briefing_location
data_template:
option: >
{% if is_state('input_boolean.school_today','on') %}
{% if is_state('input_boolean.kallen_two_hour_delay','on') %}
Common Areas
{% else %}
Kallen Bedroom
{% endif %}
{% else %}
Common Areas
{% endif %}
- service: input_datetime.set_datetime
entity_id: input_datetime.kallen_morning_briefing
data_template:
time: >
{% if is_state('input_boolean.school_today', 'on') %}
{% if is_state('input_boolean.kallen_two_hour_delay','on') %}
09:40
{% else %}
07:40
{% endif %}
{% else %}
10:00
{% endif %}
- service: input_datetime.set_datetime
entity_id: input_datetime.school_day_start_reminder
data_template:
time: >
{% if is_state('input_boolean.kallen_two_hour_delay','on') %}
10:00
{% else %}
08:00
{% endif %}
- service: input_datetime.set_datetime
entity_id: input_datetime.school_day_end_reminder
data_template:
time: >
{% if is_state('input_boolean.school_early_release','on') %}
13:30
{% else %}
14:00
{% endif %}
kallen_scheduling_evening:
sequence:
- service: input_datetime.set_datetime
entity_id: input_datetime.kallen_bedtime
data_template:
time: >
{% if is_state('sensor.school_tomorrow', 'on') %}
21:00
{% else %}
22:00
{% endif %}
- service: input_datetime.set_datetime
entity_id: input_datetime.kallen_nightly_briefing
data_template:
time: >
{% if is_state('sensor.school_tomorrow', 'on') %}
20:40
{% else %}
21:40
{% endif %}
house_scheduling_morning:
sequence:
- service: input_datetime.set_datetime
entity_id: input_datetime.audible_notification_on
data_template:
time: >
{% if is_state('input_boolean.school_today','on') %}
{{ (state_attr('input_datetime.school_day_start','timestamp') - 5400) | timestamp_custom('%H:%M', false) }}
{% else %}
08:15
{% endif %}
- service: input_datetime.set_datetime
entity_id: input_datetime.morning_report
data_template:
time: >
{% if is_state('input_boolean.school_today','on') %}
{% if is_state('input_boolean.kallen_two_hour_delay','on') %}
10:20
{% else %}
08:20
{% endif %}
{% elif is_state('input_boolean.work_today','on') and is_state('input_boolean.school_today','off') %}
{% if (state_attr('input_datetime.tina_workday_start','timestamp')) > 43200 %}
12:00
{% elif (state_attr('input_datetime.tina_workday_start','timestamp') - 1800 ) > (state_attr('input_datetime.audible_notification_on','timestamp')) %}
{{ (state_attr('input_datetime.tina_workday_start', 'timestamp') - 1800) | timestamp_custom('%H:%M', false) }}
{% else %}
10:00
{% endif %}
{% else %}
12:00
{% endif %}
- service: input_datetime.set_datetime
entity_id: input_datetime.daily_report
data_template:
time: >
{% if is_state('input_boolean.school_today','on') %}
14:15
{% elif is_state('input_boolean.school_today','off') and is_state('input_boolean.work_today','off') %}
15:00
{% else %}
{% if (state_attr('input_datetime.tina_workday_end','timestamp')) > 61200 %}
16:00
{% else %}
{{ (state_attr('input_datetime.tina_workday_end', 'timestamp') + 3600) | timestamp_custom('%H:%M', false) }}
{% endif %}
{% endif %}
- service: input_datetime.set_datetime
entity_id: input_datetime.morning_alarm_disarm
data_template:
time: >
{% if is_state('input_boolean.work_today','on') and is_state('input_boolean.school_today','on') %}
{% if state_attr('input_datetime.tina_workday_start','timestamp') < (state_attr('input_datetime.school_day_start','timestamp')) %}
{{ (state_attr('input_datetime.tina_workday_start','timestamp') - 1800) | timestamp_custom('%H:%M', false) }}
{% else %}
{{ (state_attr('input_datetime.school_day_start','timestamp') - 2700) | timestamp_custom('%H:%M', false) }}
{% endif %}
{% elif is_state('input_boolean.work_today','on') and is_state('input_boolean.school_today','off') %}
{{ (state_attr('input_datetime.tina_workday_start', 'timestamp') - 1800) | timestamp_custom('%H:%M', false) }}
{% elif is_state('input_boolean.school_today','on') %}
{{ (state_attr('input_datetime.school_day_start','timestamp') - 2700) | timestamp_custom('%H:%M', false) }}
{% else %}
11:00
{% endif %}
- service: input_datetime.set_datetime
entity_id: input_datetime.morning_alarm_rearm
data_template:
time: >
{% if is_state('input_boolean.work_today','on') and is_state('input_boolean.school_today','off') %}
{{ (state_attr('input_datetime.tina_workday_start','timestamp') + 900) | timestamp_custom('%H:%M', false) }}
{% elif is_state('input_boolean.school_today','on') and is_state('input_boolean.work_today','off') %}
{{ (state_attr('input_datetime.school_day_start','timestamp') + 3600) | timestamp_custom('%H:%M', false) }}
{% elif is_state('input_boolean.work_today','on') and is_state('input_boolean.school_today','on') %}
{% if state_attr('input_datetime.tina_workday_start','timestamp') < state_attr('input_datetime.school_day_start','timestamp') %}
{{ (state_attr('input_datetime.school_day_start','timestamp') + 1800) | timestamp_custom('%H:%M', false) }}
{% else %}
{{ (state_attr('input_datetime.tina_workday_start','timestamp') + 900) | timestamp_custom('%H:%M', false) }}
{% endif %}
{% else %}
12:00
{% endif %}
house_scheduling_evening:
sequence:
- service: input_datetime.set_datetime
entity_id: input_datetime.audible_notification_off
data_template:
time: >
{% if is_state('sensor.school_tomorrow','on') %}
22:00
{% else %}
23:00
{% endif %}
master_bedroom_scheduling_morning:
sequence:
- service: input_datetime.set_datetime
entity_id: input_datetime.master_bedroom_wakeup
data_template:
time: >
{% if is_state('input_boolean.school_today','on') %}
13:45
{% else %}
13:00
{% endif %}
master_bedroom_scheduling_evening:
sequence:
- service: input_datetime.set_datetime
entity_id: input_datetime.master_bedroom_cooling
data_template:
time: >
{% set low = state_attr('sensor.current_forecast','overnight_low') | float %}
{% set high = state_attr('sensor.current_forecast','high_temp') | float %}
{% if high >= 85 and is_state('sensor.school_tomorrow','on') %}
20:00
{% elif high >= 85 and is_state('sensor.school_tomorrow','off') %}
21:00
{% elif low >= 56 and low <= 60 %}
22:30
{% elif low > 60 %}
21:30
{% else %}
00:00
{% endif %}
- service: input_datetime.set_datetime
entity_id: input_datetime.master_bedroom_fan
data_template:
time: >
{% set low = state_attr('sensor.current_forecast','overnight_low') | float %}
{% if low > 60 %}
22:30
{% else %}
00:00
{% endif %}
nursery_scheduling:
sequence:
- 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 %}