Merge branch 'announcements'
This commit is contained in:
@ -63,16 +63,6 @@ automation:
|
||||
- service: input_boolean.turn_off
|
||||
entity_id: input_boolean.audible_notifications
|
||||
|
||||
- id: 754da2e2-af95-43b0-bb4e-9df553c305fd
|
||||
alias: Kallen Nightly Briefing
|
||||
trigger:
|
||||
platform: time
|
||||
at: input_datetime.kallen_nightly_report
|
||||
action:
|
||||
- service: script.turn_on
|
||||
entity_id: script.kallen_nightly_briefing
|
||||
|
||||
|
||||
script:
|
||||
reset_annc_switches:
|
||||
sequence:
|
||||
@ -84,14 +74,3 @@ script:
|
||||
- service: button.press
|
||||
target:
|
||||
entity_id: button.good_morning
|
||||
|
||||
kallen_nightly_briefing:
|
||||
sequence:
|
||||
- service: script.text_notify
|
||||
data_template:
|
||||
who: "all_ios"
|
||||
message: "Time for Kallen to get ready for bed."
|
||||
- service: notify.alexa_media
|
||||
data:
|
||||
target: Basement Echo Dot
|
||||
message: !include ../templates/speech/kallen_nightly_briefing.yaml
|
||||
|
@ -1,131 +0,0 @@
|
||||
input_boolean:
|
||||
school_in_session:
|
||||
name: School In Session
|
||||
icon: mdi:bus-school
|
||||
school_today:
|
||||
name: School Today
|
||||
icon: mdi:bus-school
|
||||
school_early_release:
|
||||
name: School Early Release
|
||||
icon: mdi:bus-school
|
||||
|
||||
input_datetime:
|
||||
school_first_day:
|
||||
name: First Day of School
|
||||
has_date: true
|
||||
has_time: false
|
||||
school_last_day:
|
||||
name: Last Day of School
|
||||
has_date: true
|
||||
has_time: false
|
||||
school_day_start:
|
||||
name: School Day Start
|
||||
has_date: false
|
||||
has_time: true
|
||||
school_day_end:
|
||||
name: School Day End
|
||||
has_date: false
|
||||
has_time: true
|
||||
thanksgiving_break_start:
|
||||
name: Thanksgiving Break
|
||||
has_date: true
|
||||
has_time: false
|
||||
christmas_break_start:
|
||||
name: Christmas Break
|
||||
has_date: true
|
||||
has_time: false
|
||||
spring_break_start:
|
||||
name: Spring Break
|
||||
has_date: true
|
||||
has_time: false
|
||||
school_day_start_reminder:
|
||||
name: School Day Start Reminder
|
||||
has_date: false
|
||||
has_time: true
|
||||
school_day_end_reminder:
|
||||
name: School Day End Reminder
|
||||
has_date: false
|
||||
has_time: true
|
||||
|
||||
sensor:
|
||||
- platform: template
|
||||
sensors:
|
||||
school_start_days2go:
|
||||
value_template: "{{ ((state_attr('input_datetime.school_first_day', 'timestamp')-as_timestamp(now())) | int /60/1440) | round(0) }}"
|
||||
unit_of_measurement: 'Days'
|
||||
school_end_days2go:
|
||||
value_template: "{{ ((state_attr('input_datetime.school_last_day', 'timestamp')-as_timestamp(now())) | int /60/1440) | round(0) }}"
|
||||
unit_of_measurement: 'Days'
|
||||
vacation_days2go:
|
||||
value_template: "{{ ((as_timestamp(strptime(state_attr('calendar.vacation', 'start_time'), '%Y-%m-%d'))-as_timestamp(now())) | int /60/1440) | round(0) }}"
|
||||
unit_of_measurement: 'Days'
|
||||
- platform: rest
|
||||
resource: https://raw.githubusercontent.com/tm24fan8/Home-Assistant-Configs/master/packages/json_data/school.json
|
||||
name: School Event
|
||||
scan_interval: 14400
|
||||
value_template: >
|
||||
{% set today = now().month ~ '/' ~ now().day %}
|
||||
{% set event = value_json.EVENTS.static[ today ] %}
|
||||
{%- if event %}
|
||||
{{ event }}
|
||||
{% else %}
|
||||
Nothing
|
||||
{%- endif %}
|
||||
|
||||
automation:
|
||||
- id: e1cb2d02-0423-11eb-adc1-0242ac120002
|
||||
alias: School today
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: time
|
||||
at: '06:00:00'
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: >
|
||||
{%- if as_timestamp(strptime(state_attr('calendar.kallen_school', 'start_time'), '%Y-%m-%d %H:%M:%S')) | timestamp_custom("%Y-%m-%d") == now().strftime("%Y-%m-%d") %}
|
||||
true
|
||||
{%- endif -%}
|
||||
action:
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: >
|
||||
{{ 'Early Release' in states('sensor.school_event') }}
|
||||
sequence:
|
||||
- service: input_boolean.turn_on
|
||||
entity_id: input_boolen.school_early_release
|
||||
- service: input_datetime.set_datetime
|
||||
target:
|
||||
entity_id: input_datetime.school_day_end
|
||||
data:
|
||||
time: "14:45:00"
|
||||
default:
|
||||
- service: input_datetime.set_datetime
|
||||
target:
|
||||
entity_id: input_datetime.school_day_end
|
||||
data:
|
||||
time: "15:19:00"
|
||||
- service: input_boolean.turn_on
|
||||
entity_id: input_boolean.school_today
|
||||
- service: script.turn_on
|
||||
entity_id: script.school_in_session
|
||||
|
||||
script:
|
||||
school_in_session:
|
||||
sequence:
|
||||
- condition: state
|
||||
entity_id: input_boolean.school_in_session
|
||||
state: 'off'
|
||||
- service: input_boolean.turn_on
|
||||
entity_id: input_boolen.school_in_session
|
||||
|
||||
school_year_over:
|
||||
sequence:
|
||||
- condition: state
|
||||
entity_id: input_boolean.school_in_session
|
||||
state: 'on'
|
||||
- condition: template
|
||||
value_template: >
|
||||
{{ states('input_datetime.school_last_day') == now().strftime("%Y-%m-%d") }}
|
||||
- service: input_boolean.turn_off
|
||||
entity_id: input_boolen.school_in_session
|
@ -1,9 +0,0 @@
|
||||
{
|
||||
"EVENTS": {
|
||||
"static": {
|
||||
"1/25": "Digital Learning Day",
|
||||
"3/3": "Early Release"
|
||||
|
||||
}
|
||||
}
|
||||
}
|
11
sensor.yaml
11
sensor.yaml
@ -90,13 +90,4 @@
|
||||
value_template: "{{ ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'][now().weekday()] }}"
|
||||
month_is:
|
||||
friendly_name: 'Month is'
|
||||
value_template: "{{ ['January','February','March','April','May','June','August','September','October','November','December'][now().month-1] }}"
|
||||
school_tomorrow:
|
||||
friendly_name: 'School Tomorrow'
|
||||
value_template: >-
|
||||
{%- set test=(as_timestamp(now())+ (86400)) | timestamp_custom("%Y-%m-%d",true) %}
|
||||
{% if states.calendar.kallen_school.attributes.start_time == test + " 07:35:00" %}
|
||||
on
|
||||
{% else %}
|
||||
off
|
||||
{% endif %}
|
||||
value_template: "{{ ['January','February','March','April','May','June','August','September','October','November','December'][now().month-1] }}"
|
@ -1,82 +0,0 @@
|
||||
>
|
||||
{# Kallen Nightly Report #}
|
||||
{%- macro getReport() -%}
|
||||
<p>
|
||||
Good Evening, Kallen,
|
||||
{{ [ 'It is time to get in the bath. ',
|
||||
'It is almost bedtime. That means it is time to start preparing for bed. if you are taking a bath tonight, you need to head that way.',
|
||||
'I cannot communicate with the bathtub. Or I would have started the water for you already. So you will have to start the bath, yourself',
|
||||
'My sensors are detecting a strange smell. I am running diagnostics. But in the mean time, you should start a bath.',
|
||||
'I hate to say it but, the day is coming to an end. Time to finish up your tasks, pick up any toys you have out, and get ready for bed.',
|
||||
'We have reached that time in every day when we must switch gears and start preparing for bed. If you would like to have story time you better get a move on.',
|
||||
'Did you ever hear the one about the kid who never took a bath? Yeah, me either. So we should keep it that way. It is time to get ready for bed.',
|
||||
] | random }}
|
||||
{% if is_state('sensor.school_tomorrow', 'on') %}
|
||||
{{ [ 'Because you have school tomorrow. ',
|
||||
'Because you have to get up early tomorrow for school.',
|
||||
'Because you want to be ready for school tomorrow.'
|
||||
] | random }}
|
||||
{% else %}
|
||||
{% set month=states("sensor.date").split('-')[1] | int %}
|
||||
{%- if is_state('input_boolean.school_in_session', 'off') -%}
|
||||
{{ [ 'Looks like tomorrow is another day of summer vacation. ',
|
||||
'You are still on summer break tomorrow. ',
|
||||
'Summer vacation does not last forever, but it is not over yet. '
|
||||
] | random }}
|
||||
{% else %}
|
||||
Oh, and it appears you do not have school tomorrow
|
||||
{% endif %}
|
||||
{{ [ 'so you can sleep in late. ',
|
||||
'so let us sleep a little later. ',
|
||||
'so there is not a reason to get up early. ',
|
||||
'so we can sleep in. '
|
||||
] | random }}
|
||||
{% endif %}
|
||||
{% if states.sensor.school_start_days2go.state | int < 10 and states.sensor.school_start_days2go.state | int > 1 -%}
|
||||
{{ [ 'I hate to say it, but ',
|
||||
'Unfortunately,',
|
||||
'All good things must come to an end.'
|
||||
] | random }}
|
||||
There are only {{ states.sensor.school_start_days2go.state }} days
|
||||
{{ [ 'left of summer vacation. ',
|
||||
' left of summer break.',
|
||||
'Until School starts again.'
|
||||
] | random }}
|
||||
{% elif states.sensor.school_start_days2go.state | int == 1 -%}
|
||||
Tomorrow is the first day of school. Are you ready?
|
||||
{%- endif %}
|
||||
{% if states.sensor.school_end_days2go.state | int < 15 and states.sensor.school_end_days2go.state | int > 0 -%}
|
||||
{{ [ 'School is almost over for the year.',
|
||||
'You have made it to the end of the school year.',
|
||||
'You are almost done with school.'
|
||||
] | random }}
|
||||
There are only {{ states.sensor.school_end_days2go.state }} days
|
||||
{{ [ 'left in the school year ',
|
||||
' left of school.',
|
||||
'Until the last day of school.'
|
||||
] | random }}
|
||||
{% elif states.sensor.school_end_days2go.state | int == 0 -%}
|
||||
Tomorrow is the first day of summer. Are you ready?
|
||||
{%- endif %}
|
||||
{{ [ 'I have prepared your room as you like it. ',
|
||||
'I have adjusted the lighting in your room.',
|
||||
'I have turned on your bedroom lights, and adjusted the lighting under your bed.',
|
||||
'I have executed the Pre bed routine for your room.'
|
||||
] | random }}
|
||||
</p>
|
||||
{%- endmacro -%}
|
||||
|
||||
|
||||
{# a macro that removes all newline characters, empty spaces, and returns formatted text #}
|
||||
{%- macro cleanup(data) -%}
|
||||
{%- for item in data.split("\n") if item | trim != "" -%}
|
||||
{{ item | trim }} {% endfor -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
{# a macro to call all macros :) #}
|
||||
{%- macro mother_of_all_macros() -%}
|
||||
{{ getReport() }}
|
||||
{%- endmacro -%}
|
||||
|
||||
{# Call the macro #}
|
||||
{{- cleanup(mother_of_all_macros()) -}}
|
Reference in New Issue
Block a user