diff --git a/packages/events.yaml b/packages/events.yaml index 0b76614..da57c65 100644 --- a/packages/events.yaml +++ b/packages/events.yaml @@ -11,6 +11,9 @@ input_boolean: work_today: name: Work Today icon: mdi:briefcase + school_today_extended: + name: School Today Extended + icon: mdi:bus-school input_datetime: school_first_day: @@ -182,7 +185,9 @@ automation: data: time: "15:19:00" - service: input_boolean.turn_on - entity_id: input_boolean.school_today + entity_id: input_boolean.school_today + - service: input_boolean.turn_on + entity_id: input_boolean.school_today_extended - service: script.turn_on entity_id: script.school_in_session @@ -221,9 +226,23 @@ automation: trigger: - platform: time at: input_datetime.school_day_end + id: day_end + - platform: time + at: 00:00 + id: midnight action: - - service: input_boolean.turn_off - entity_id: input_boolean.school_today + - if: + - condition: trigger + id: day_end + then: + - service: input_boolean.turn_off + entity_id: input_boolean.school_today + - if: + - condition: trigger + id: midnight + then: + - service: input_boolean.turn_off + entity_id: input_boolean.school_today_extended - id: a6eeb075-d21b-436c-983f-39188ee9b016 alias: Work Reset diff --git a/templates/speech/welcome_home.yaml b/templates/speech/welcome_home.yaml index c6ed9c7..a589267 100644 --- a/templates/speech/welcome_home.yaml +++ b/templates/speech/welcome_home.yaml @@ -21,6 +21,15 @@ {% endif %}
++ {% set endbefore = state_attr('input_datetime.school_day_end','timestamp') - 3600 %} + {% set endafter = state_attr('input_datetime.school_day_end','timestamp') + 3600 %} + {% set current = ((now().hour * 60 + now().minute) * 60 ) %} + {% if is_state('input_boolean.school_today_extended','on') and current > endbefore and current < endafter %} + Welcome home Kallen as well, I hope you had a great day at school! + {% endif %} +
+As you are no doubt aware, the weather outside is {{ state_attr('weather.iron_nerd_weather_station','temperature') | round }} degrees {% if is_state('weather.iron_nerd_weather_station','rainy') %} @@ -87,7 +96,7 @@
{% if is_state('person.christina_stork','Bob Evans') and is_state('input_boolean.work_today','on') %}
- Tina is at work right now. She will be done at approximately {{ (state_attr('input_datetime.tina_workday_end','timestamp') | int | timestamp_custom('%I:%M %p', False)) }}
+ Tina is at work right now. She will be done at approximately {{ (state_attr('input_datetime.tina_workday_end','timestamp') | int | timestamp_custom('%I:%M %p', False)) }}
{% elif is_state('input_boolean.work_today','on') %}
Tina has work today.
{% endif %}