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

130 lines
3.6 KiB
YAML

###############################
# input_datetime - So the time report automation fires can be set in the UI
###############################
input_datetime:
morning_report:
name: Morning Report
has_date: false
has_time: true
nightly_report:
name: Nightly Report
has_date: false
has_time: true
daily_report:
name: Daily Report
has_date: false
has_time: true
kallen_morning_report:
name: Kallen Dressed Announcement
has_date: false
has_time: true
kallen_nightly_briefing:
name: Kallen Bedtime Announcement
has_date: false
has_time: true
audible_notification_on:
name: Audible Notifications On
has_date: false
has_time: true
audible_notification_off:
name: Audible Notifications Off
has_date: false
has_time: true
################################
# Announcment Automation - fires at the time of the above input_datetimes
################################
automation:
- id: 81bee5ee-6820-4626-aebf-3deb8de69e4d
alias: Turn On Audible Notifications
initial_state: true
trigger:
platform: template
value_template: "{{ states('sensor.time') == (state_attr('input_datetime.audible_notification_on', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}"
action:
- service: input_boolean.turn_on
entity_id: input_boolean.audible_notifications
# Turn off audible notifications if they have't been turned off yet.
- id: e0e9c774-6abe-42aa-bdab-32108bebb0e9
alias: Turn Off Audible Notifications
initial_state: true
trigger:
- platform: template
value_template: "{{ states('sensor.time') == (state_attr('input_datetime.audible_notification_off', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}"
condition:
- condition: state
entity_id: input_boolean.audible_notifications
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.audible_notifications
- id: b8d21d04-c263-4d33-9590-9fb1e76b0de8
alias: Kallen Nightly Report
trigger:
platform: time
at: input_datetime.kallen_nightly_briefing
action:
- service: script.kallen_nightly_briefing
- id: c772b54d-6448-4d74-a0c2-32998f49b17c
alias: Kallen Scheduling
trigger:
platform: time
at: '06:05:00'
action:
- service: input_datetime.set_datetime
entity_id: input_datetime.kallen_wakeup_time
data_template:
time: >
{% if states('input_boolean.school_today', 'on') %}
07:30
{% else %}
08:00
{% endif %}
- service: input_datetime.set_datetime
entity_id: input_datetime.kallen_bedtime
data_template:
time: >
{% if states('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 states('sensor.school_tomorrow', 'on') %}
20:40
{% else %}
21:40
{% endif %}
script:
reset_annc_switches:
sequence:
- service: input_boolean.turn_off
entity_id: input_boolean.good_morning_report
morning_briefing:
sequence:
- service: button.press
target:
entity_id: button.good_morning
kallen_nightly_briefing:
sequence:
- service: script.speech_engine
data:
who: living_room
message: !include ../templates/speech/kallen_nightly_briefing.yaml
- service: script.text_notify
data:
who: "ios_parents"
message: "I just gave Kallen's nightly briefing."