More time-based Jinja2 custom templates

This commit is contained in:
2023-04-19 20:38:13 -04:00
parent ad2735d414
commit 53c0d4e86a
7 changed files with 45 additions and 28 deletions

View File

@ -1,7 +1,7 @@
>
{# Kallen Morning Briefing #}
{%- macro getReport() -%}
{% from 'time.jinja' import current_time_12hr, current_date_readout %}
{% from 'time.jinja' import current_time_12hr, current_date_readout, input_datetime_12hr%}
{% from 'speech.jinja' import dadjoke %}
<p>
Good morning, Collin.
@ -87,11 +87,15 @@
"And you even get to come home a little earlier today!",
] | random }}
{% endif %}
<s>School today starts at {{ (state_attr('input_datetime.kallen_school_day_start','timestamp') | int | timestamp_custom('%I:%M %p' , False)) }}</s>
<s>Pickup today will be at {{(state_attr('input_datetime.kallen_school_day_end', 'timestamp') | int | timestamp_custom('%I:%M %p', False)) }}</s>
<s>School today starts at {{ input_datetime_12hr('input_datetime.kallen_school_day_start') }}</s>
{% if is_state('input_boolean.kallen_alternate_pickup','on') %}
Today, you will be picked up from school by {{ states('input_text.kallen_pickup') }}.
{% elif is_state('input_boolean.work_today','off') %}
Today, you will be picked up from school by your parents.
{% else %}
Today, you will be picked up from school by your dad.
{% endif %}
<s>Pickup today will be at {{ input_datetime_12hr('input_datetime.kallen_school_day_end') }}</s>
{% if states.sensor.school_end_days2go.state | int == 0 -%}
But today is the last day of School!
{%- endif %}