Remove unnecessary repeated definitions of the cleanup macro

This commit is contained in:
2023-07-01 14:08:40 -04:00
parent 1c51c678e5
commit 529b24e310
16 changed files with 152 additions and 315 deletions

View File

@ -1,53 +1,61 @@
{% from 'formatting.jinja' import cleanup %}
{% macro sports_pregame(team) %}
{% if is_state(team,'PRE') %}
{% set date = state_attr(team,'date') | as_timestamp | timestamp_custom('%m-%d') %}
{% if date == now().strftime('%m-%d') %}
"The {{ state_attr(team,'friendly_name') }} will be playing today against the {{ state_attr(team,'opponent_name') }} at {{ state_attr(team,'venue') }}. "
"Start time is at {{ state_attr(team,'date') | as_timestamp | timestamp_custom('%I:%M %p') }}. "
{% macro data() %}
{% if is_state(team,'PRE') %}
{% set date = state_attr(team,'date') | as_timestamp | timestamp_custom('%m-%d') %}
{% if date == now().strftime('%m-%d') %}
The {{ state_attr(team,'friendly_name') }} will be playing today against the {{ state_attr(team,'opponent_name') }} at {{ state_attr(team,'venue') }}.
Start time is at {{ state_attr(team,'date') | as_timestamp | timestamp_custom('%I:%M %p') }}.
{% endif %}
{% endif %}
{% endif %}
{% endmacro%}
{{ cleanup(data()) }}
{% endmacro %}
{% macro sports_main(team) %}
{% if is_state(team,'POST') %}
{% set date = state_attr(team,'date') | as_timestamp | timestamp_custom('%m-%d') %}
{% set yday = (as_timestamp(now()) - (24*3600)) | timestamp_custom('%m-%d') %}
{% if date == now().strftime('%m-%d') %}
{% if state_attr(team,'clock') in ['postponed','Postponed'] %}
"The {{ state_attr(team,'friendly_name') }} had their game postponed today, and it will be played at a later date. "
{% elif (state_attr(team,'team_score') | int) == state_attr(team,'opponent_score') | int %}
"The {{ state_attr(team,'friendly_name') }} tied in their game today against the {{ state_attr(team,'opponent_name') }} by a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}. "
{% elif state_attr(team,'team_winner') == true %}
"The {{ state_attr(team,'friendly_name') }} won their game today against the {{ state_attr(team,'opponent_name') }} by a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}. "
{% elif state_attr(team,'opponent_winner') == true %}
"The {{ state_attr(team,'friendly_name') }} lost their game today against the {{ state_attr(team,'opponent_name') }} by a score of {{ state_attr(team,'opponent_score') }} to {{ state_attr(team,'team_score') }}. "
{% macro data() %}
{% if is_state(team,'POST') %}
{% set date = state_attr(team,'date') | as_timestamp | timestamp_custom('%m-%d') %}
{% set yday = (as_timestamp(now()) - (24*3600)) | timestamp_custom('%m-%d') %}
{% if date == now().strftime('%m-%d') %}
{% if state_attr(team,'clock') in ['postponed','Postponed'] %}
The {{ state_attr(team,'friendly_name') }} had their game postponed today, and it will be played at a later date.
{% elif (state_attr(team,'team_score') | int) == state_attr(team,'opponent_score') | int %}
The {{ state_attr(team,'friendly_name') }} tied in their game today against the {{ state_attr(team,'opponent_name') }} by a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}.
{% elif state_attr(team,'team_winner') == true %}
The {{ state_attr(team,'friendly_name') }} won their game today against the {{ state_attr(team,'opponent_name') }} by a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}.
{% elif state_attr(team,'opponent_winner') == true %}
The {{ state_attr(team,'friendly_name') }} lost their game today against the {{ state_attr(team,'opponent_name') }} by a score of {{ state_attr(team,'opponent_score') }} to {{ state_attr(team,'team_score') }}.
{% endif %}
{% if state_attr(team,'clock') not in ['postponed','Postponed'] %}
This brings their record to {{ state_attr(team,'team_record') | replace("-"," and ") }} on the season.
{% endif %}
{% elif yday == date %}
{% if state_attr(team,'clock') in ['postponed','Postponed'] %}
The {{ state_attr(team,'friendly_name') }} had their game postponed yesterday, and it will be played at a later date.
{% elif (state_attr(team,'team_score') | int) == state_attr(team,'opponent_score') | int %}
The {{ state_attr(team,'friendly_name') }} tied in their game yesterday against the {{ state_attr(team,'opponent_name') }} by a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}.
{% elif state_attr(team,'team_winner') == true %}
The {{ state_attr(team,'friendly_name') }} won their game yesterday against the {{ state_attr(team,'opponent_name') }} by a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}.
{% elif state_attr(team,'opponent_winner') == true %}
The {{ state_attr(team,'friendly_name') }} lost their game yesterday against the {{ state_attr(team,'opponent_name') }} by a score of {{ state_attr(team,'opponent_score') }} to {{ state_attr(team,'team_score') }}.
{% endif %}
{% if state_attr(team,'clock') not in ['postponed','Postponed'] %}
This brings their record to {{ state_attr(team,'team_record') | replace("-"," and ") }} on the season.
{% endif %}
{% endif %}
{% if state_attr(team,'clock') not in ['postponed','Postponed'] %}
"This brings their record to {{ state_attr(team,'team_record') | replace("-"," and ") }} on the season. "
{% endif %}
{% elif yday == date %}
{% if state_attr(team,'clock') in ['postponed','Postponed'] %}
"The {{ state_attr(team,'friendly_name') }} had their game postponed yesterday, and it will be played at a later date. "
{% elif (state_attr(team,'team_score') | int) == state_attr(team,'opponent_score') | int %}
"The {{ state_attr(team,'friendly_name') }} tied in their game yesterday against the {{ state_attr(team,'opponent_name') }} by a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}. "
{% elif state_attr(team,'team_winner') == true %}
"The {{ state_attr(team,'friendly_name') }} won their game yesterday against the {{ state_attr(team,'opponent_name') }} by a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}. "
{% elif state_attr(team,'opponent_winner') == true %}
"The {{ state_attr(team,'friendly_name') }} lost their game yesterday against the {{ state_attr(team,'opponent_name') }} by a score of {{ state_attr(team,'opponent_score') }} to {{ state_attr(team,'team_score') }}. "
{% endif %}
{% if state_attr(team,'clock') not in ['postponed','Postponed'] %}
"This brings their record to {{ state_attr(team,'team_record') | replace("-"," and ") }} on the season. "
{% elif is_state(team,'IN') %}
{% if (state_attr(team,'team_score') | int) == (state_attr(team,'opponent_score') | int) %}
The {{ state_attr(team,'friendly_name') }} are currently tied in their game against the {{ state_attr(team,'opponent_name') }} with a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}.
{% elif (state_attr(team,'team_score') | int) > (state_attr(team,'opponent_score') | int) %}
The {{ state_attr(team,'friendly_name') }} are currently winning their game against the {{ state_attr(team,'opponent_name') }} with a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}.
{% else %}
The {{ state_attr(team,'friendly_name') }} are currently losing their game against the {{ state_attr(team,'opponent_name') }} with a score of {{ state_attr(team,'opponent_score') }} to {{ state_attr(team,'team_score') }}.
{% endif %}
{% endif %}
{% elif is_state(team,'IN') %}
{% if (state_attr(team,'team_score') | int) == (state_attr(team,'opponent_score') | int) %}
"The {{ state_attr(team,'friendly_name') }} are currently tied in their game against the {{ state_attr(team,'opponent_name') }} with a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}. "
{% elif (state_attr(team,'team_score') | int) > (state_attr(team,'opponent_score') | int) %}
"The {{ state_attr(team,'friendly_name') }} are currently winning their game against the {{ state_attr(team,'opponent_name') }} with a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}. "
{% else %}
"The {{ state_attr(team,'friendly_name') }} are currently losing their game against the {{ state_attr(team,'opponent_name') }} with a score of {{ state_attr(team,'opponent_score') }} to {{ state_attr(team,'team_score') }}. "
{% endif %}
{% endif %}
{% endmacro %}
{{ cleanup(data()) }}
{% endmacro %}
{% macro sports_inhibit(team) %}

View File

@ -1,3 +1,4 @@
{% from 'formatting.jinja' import cleanup %}
{% from 'time.jinja' import input_datetime_read, ct, next_twitch_stream, calendar_event_today, time_from_calendar %}
{% from 'easy_time.jinja' import count_the_days, custom_time, custom_time_between, clock %}
{% from 'lighting.jinja' import lightsOn %}
@ -57,17 +58,20 @@
{% endmacro %}
{% macro houseStatusReport(type,method) %}
{% if type == 'climate_devices' %}
{{ climateDevices(type,method) }}
{% elif type == 'airleaks' %}
{{ airLeaks(type,method) }}
{% elif type == 'lights' %}
{{ lightsOn(type,method) }}
{% elif type == 'full' %}
{{ climateDevices(type,method) }}
{{ lightsOn(type,method) }}
{{ airLeaks(type,method) }}
{% endif %}
{% macro data() %}
{% if type == 'climate_devices' %}
{{ climateDevices(type,method) }}
{% elif type == 'airleaks' %}
{{ airLeaks(type,method) }}
{% elif type == 'lights' %}
{{ lightsOn(type,method) }}
{% elif type == 'full' %}
{{ climateDevices(type,method) }}
{{ lightsOn(type,method) }}
{{ airLeaks(type,method) }}
{% endif %}
{% endmacro %}
{{ cleanup(data()) }}
{% endmacro %}
{% macro twitchStreamInfo(type,method) %}
@ -147,16 +151,19 @@ Tony is currently streaming. The current stream category is {{ game }}. The curr
{% endmacro %}
{% macro tonyStatusReport(type,method) %}
{% if type == 'meds' %}
{{ medReportTony(type,method) }}
{% endif %}
{% if type == 'stream' %}
{{ twitchStreamInfo(type,method) }}
{% endif %}
{% if type == 'full' %}
{{ twitchStreamInfo(type,method) }}
{{ medReportTony(type,method) }}
{% endif %}
{% macro data() %}
{% if type == 'meds' %}
{{ medReportTony(type,method) }}
{% endif %}
{% if type == 'stream' %}
{{ twitchStreamInfo(type,method) }}
{% endif %}
{% if type == 'full' %}
{{ twitchStreamInfo(type,method) }}
{{ medReportTony(type,method) }}
{% endif %}
{% endmacro %}
{{ cleanup(data()) }}
{% endmacro %}
{% macro tina_morning_meds(type,method) %}
@ -268,14 +275,17 @@ Tony is currently streaming. The current stream category is {{ game }}. The curr
{% endmacro %}
{% macro tinaStatusReport(type,method) %}
{% if type == 'work' %}
{{ workReportTina(type,method) }}
{% elif type == 'meds' %}
{{ medReportTina(type,method) }}
{% elif type == 'full' %}
{{ workReportTina(type,method) }}
{{ medReportTina(type,method) }}
{% endif %}
{% macro data() %}
{% if type == 'work' %}
{{ workReportTina(type,method) }}
{% elif type == 'meds' %}
{{ medReportTina(type,method) }}
{% elif type == 'full' %}
{{ workReportTina(type,method) }}
{{ medReportTina(type,method) }}
{% endif %}
{% endmacro %}
{{ cleanup(data()) }}
{% endmacro %}
{% macro kallen_morning_meds(type,method) %}
@ -447,17 +457,20 @@ Tony is currently streaming. The current stream category is {{ game }}. The curr
{% endmacro %}
{% macro kallenStatusReport(type,method) %}
{% if type == 'meds' %}
{{ medReportKallen(type,method) }}
{% elif type == 'school' %}
{{ schoolReportKallen(type,method) }}
{% elif type == 'sleep' %}
{{ kallenSleep(type,method)}}
{% elif type == 'full' %}
{{ kallenSleep(type,method) }}
{{ medReportKallen(type,method) }}
{{ schoolReportKallen(type,method) }}
{% endif %}
{% macro data() %}
{% if type == 'meds' %}
{{ medReportKallen(type,method) }}
{% elif type == 'school' %}
{{ schoolReportKallen(type,method) }}
{% elif type == 'sleep' %}
{{ kallenSleep(type,method)}}
{% elif type == 'full' %}
{{ kallenSleep(type,method) }}
{{ medReportKallen(type,method) }}
{{ schoolReportKallen(type,method) }}
{% endif %}
{% endmacro %}
{{ cleanup(data()) }}
{% endmacro %}
{% macro emma_sleep(type,method) %}
@ -501,9 +514,12 @@ Tony is currently streaming. The current stream category is {{ game }}. The curr
{% endmacro %}
{% macro emmaStatusReport(type,method) %}
{% if type == 'sleep' %}
{{ emma_sleep(type,method) }}
{% elif type == 'full' %}
{{ emma_sleep(type,method) }}
{% endif %}
{% macro data() %}
{% if type == 'sleep' %}
{{ emma_sleep(type,method) }}
{% elif type == 'full' %}
{{ emma_sleep(type,method) }}
{% endif %}
{% endmacro %}
{{ cleanup(data()) }}
{% endmacro %}

View File

@ -1,3 +1,4 @@
{% from 'formatting.jinja' import cleanup %}
{% from 'time.jinja' import ct %}
{% set ct = ct() | int %}
@ -82,7 +83,10 @@
{% endmacro %}
{% macro weatherReport(type,method,time) %}
{{ weatherInfo(type,method,time) | replace('clear-night','clear') | replace('partlycloudy','partly cloudy') }}
{% macro data() %}
{{ weatherInfo(type,method,time) | replace('clear-night','clear') | replace('partlycloudy','partly cloudy') }}
{% endmacro %}
{{ cleanup(data()) }}
{% endmacro %}
{% macro tempConvert(temp,unitFrom,unitTo) %}

Submodule node-red/projects/NerdFlows updated: c8568f46e3...4985b28f0f

View File

@ -207,6 +207,7 @@ sensor:
unique_id: e5ae9864-70b5-402c-9d2f-c4d6a10085df
icon_template: mdi:weather-sunny
value_template: >-
{% from 'formatting.jinja' import cleanup %}
{%- macro getReport() -%}
{{ [
'Today in Defiance ',
@ -310,18 +311,7 @@ sensor:
] | random }}
{{ states('sensor.overnight_lowest_temperature') }} degrees.
{%- 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()) -}}
{{- cleanup(getReport()) -}}
tomorrow_forecast:
friendly_name: Tomorrows Forecast
unique_id: a8ae26b0-ed26-4568-bb2b-f7c72707b009
@ -350,6 +340,7 @@ sensor:
unique_id: 21374ed0-80d1-49ba-817d-3e93eb3865e4
icon_template: mdi:weather-sunny
value_template: >-
{% from 'formatting.jinja' import cleanup %}
{%- macro getReport() -%}
{{ [
'Tomorrow in Defiance ',
@ -442,23 +433,13 @@ sensor:
] | random }}
{{ state_attr('sensor.tomorrow_forecast','overnight_low') }} degrees.
{%- 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()) -}}
{{- cleanup(getReport()) -}}
current_conditions:
friendly_name: Current Conditions
unique_id: 70db7e57-08db-48b2-919b-03b5face37b9
icon_template: mdi:weather-sunny
value_template: >-
{% from 'formatting.jinja' import cleanup %}
{%- macro getReport() -%}
The Weather in Defiance
{{ [
@ -498,23 +479,13 @@ sensor:
and {{ states.weather.iron_nerd_weather_station.state }}
{% endif %}
{%- 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()) -}}
{{- cleanup(getReport()) -}}
current_conditions_detail:
friendly_name: Current Conditions Detail
unique_id: 2b3687d1-bdd5-4551-8c0a-05b1ff617543
icon_template: mdi:weather-sunny
value_template: >-
{% from 'formatting.jinja' import cleanup %}
{%- macro getReport() -%}
The Weather in Defiance
{{ [
@ -660,18 +631,7 @@ sensor:
{{ states('sensor.overnight_lowest_temperature') }} degrees.
{% endif %}
{%- 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()) -}}
{{- cleanup(getReport()) -}}
outside_pressure:
friendly_name: 'Outside Pressure'
unique_id: ac2944bb-e9d7-40a3-9707-ef477fd5f309
@ -725,6 +685,7 @@ sensor:
friendly_name: "Clothing Forecast Detail"
unique_id: 13065f50-5eef-4afd-830e-2a2c87f47496
value_template: >-
{% from 'formatting.jinja' import cleanup %}
{%- macro getReport() -%}
{% if is_state('binary_sensor.morning','on') %}
Based on the forecasted high temperature,
@ -874,19 +835,7 @@ sensor:
"The possibility of frost exists currently. Be prepared. "
{% endif %}
{%- 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()) -}}
{{- cleanup(getReport()) -}}
# current_inside_humidity:
# friendly_name: "Current Inside Humidity"
@ -905,6 +854,7 @@ sensor:
friendly_name: Weather Alert String
unique_id: 66b5f020-0b5e-48ed-92a2-740d2d708b30
value_template: >
{% from 'formatting.jinja' import cleanup %}
{%- macro getReport() -%}
{% set alerts = [
states('sensor.weatheralerts_alert_1_most_recent_active_alert'),
@ -925,14 +875,7 @@ sensor:
'None'
{% endif %}
{%- endmacro -%}
{%- macro cleanup(data) -%}
{%- for item in data.split("\n") if item | trim != "" -%}
{{ item | trim }} {% endfor -%}
{%- endmacro -%}
{%- macro mother_of_all_macros() -%}
{{ getReport() }}
{%- endmacro -%}
{{- cleanup(mother_of_all_macros()) -}}
{{- cleanup(getReport()) -}}
attribute_templates:
active_alerts: "{{ states('sensor.weatheralerts_active_alerts') }}"
icon_template: >
@ -945,6 +888,7 @@ sensor:
friendly_name: 'Weather Alerts Active - Corrected'
unique_id: e2f51da4-2271-4719-8edf-a28f76ac1e3f
value_template: >
{% from 'formatting.jinja' import cleanup %}
{%- macro getReport() -%}
{% set alerts = [
states('sensor.weatheralerts_alert_1_most_recent_active_alert'),
@ -958,14 +902,7 @@ sensor:
{% set flood1 = 1 if (flood > 0) else 0 %}
{{ (main + flood1) | int }}
{%- endmacro -%}
{%- macro cleanup(data) -%}
{%- for item in data.split("\n") if item | trim != "" -%}
{{ item | trim }} {% endfor -%}
{%- endmacro -%}
{%- macro mother_of_all_macros() -%}
{{ getReport() }}
{%- endmacro -%}
{{- cleanup(mother_of_all_macros()) -}}
{{- cleanup(getReport()) -}}
icon_template: >
{% if (states('sensor.weatheralerts_active_alerts') | int ) > 0 %}
mdi:alert

View File

@ -1489,6 +1489,7 @@ script:
data:
who: '{{ who }}'
message: >-
{% from 'formatting.jinja' import cleanup %}
{% macro greeting() %}
<p>
{% if now().strftime('%H')|int < 12%}
@ -1783,14 +1784,6 @@ script:
] | random }}
{% endmacro %}
{# a macro that removes all newline characters, empty spaces, and returns formatted text. Also replaces all Underscores with Spaces #}
{%- macro cleanup(data) -%}
{%- for item in data.split("\n") if item | trim != "" -%}
{{ item | trim | replace("_", " ") }} {% endfor -%}
{%- endmacro -%}
{# ********************************************* #}
{# ******** Start the Speech routines ******** #}
{# ********************************************* #}

View File

@ -177,6 +177,7 @@ sensor:
mdi:calendar-end
{% endif %}
value_template: >
{% from 'formatting.jinja' import cleanup %}
{%- macro getReport() -%}
{% set week = states('sensor.kallen_lunch_menu_week') %}
{% set dow = now().strftime('%A') %}
@ -232,17 +233,7 @@ sensor:
No menu for the current day.
{% endif %}
{%- 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()) -}}
{{- cleanup(getReport()) -}}
# - platform: rest

View File

@ -1,6 +1,7 @@
>
{# Birthdays #}
{%- macro getReport() -%}
{% from 'formatting.jinja' import cleanup %}
<p>
{{ [
'Attention household, I am told that there is a birthday among us!',
@ -27,17 +28,4 @@
</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()) -}}
{{- cleanup(getReport()) -}}

View File

@ -1,6 +1,7 @@
>
{# Daily Briefing #}
{%- macro getReport() -%}
{% from 'formatting.jinja' import cleanup %}
{% from 'speech.jinja' import greeting, dadjoke, inspirational_quote %}
{% from 'status.jinja' import houseStatusReport, tonyStatusReport, tinaStatusReport, kallenStatusReport, emmaStatusReport %}
{% from 'easy_time.jinja' import count_the_days %}
@ -312,18 +313,4 @@
</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()) -}}
{{- cleanup(getReport()) -}}

View File

@ -1,6 +1,7 @@
>
{# Kallen Morning Briefing #}
{%- macro getReport() -%}
{% from 'formatting.jinja' import cleanup %}
{% from 'time.jinja' import current_time, current_date_readout, input_datetime_read %}
{% from 'speech.jinja' import dadjoke, inspirational_quote %}
{% from 'easy_time.jinja' import count_the_days, custom_time %}
@ -191,17 +192,4 @@
</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()) -}}
{{- cleanup(getReport()) -}}

View File

@ -1,6 +1,7 @@
>
{# Kallen Nightly Briefing #}
{%- macro getReport() -%}
{% from 'formatting.jinja' import cleanup %}
{% from 'speech.jinja' import dadjoke %}
{% from 'easy_time.jinja' import count_the_days, custom_time %}
<p>
@ -116,18 +117,4 @@
</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()) -}}
{{- cleanup(getReport()) -}}

View File

@ -1,6 +1,7 @@
>
{# Kallen School Status #}
{%- macro getReport() -%}
{% from 'formatting.jinja' import cleanup %}
{% from 'time.jinja' import input_datetime_read %}
<p>
"Hello Collin, "
@ -27,17 +28,4 @@
</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()) -}}
{{- cleanup(getReport()) -}}

View File

@ -1,6 +1,7 @@
>
{# Morning Briefing #}
{%- macro getReport() -%}
{% from 'formatting.jinja' import cleanup %}
{% from 'speech.jinja' import greeting_nodate, dadjoke, inspirational_quote %}
{% from 'status.jinja' import tonyStatusReport, tinaStatusReport, kallenStatusReport, emmaStatusReport %}
{% from 'easy_time.jinja' import count_the_days %}
@ -187,18 +188,4 @@
</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()) -}}
{{- cleanup(getReport()) -}}

View File

@ -1,6 +1,7 @@
>
{# Nightly Briefing #}
{%- macro getReport() -%}
{% from 'formatting.jinja' import cleanup %}
{% from 'speech.jinja' import greeting, dadjoke, inspirational_quote %}
{% from 'time.jinja' import input_datetime_read, time_from_calendar, next_twitch_stream %}
{% from 'status.jinja' import tonyStatusReport, tinaStatusReport, kallenStatusReport, emmaStatusReport %}
@ -230,17 +231,4 @@
</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()) -}}
{{- cleanup(getReport()) -}}

View File

@ -1,6 +1,7 @@
>
{# Weather Briefing #}
{%- macro getReport() -%}
{% from 'formatting.jinja' import cleanup %}
<p>
{% if is_state('input_boolean.tornado_alarm','on') %}
@ -52,18 +53,4 @@
</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()) -}}
{{- cleanup(getReport()) -}}

View File

@ -1,6 +1,7 @@
>
{# Welcome Home #}
{%- macro getReport() -%}
{% from 'formatting.jinja' import cleanup %}
{% from 'speech.jinja' import dadjoke %}
{% from 'time.jinja' import input_datetime_read %}
{% from 'status.jinja' import emma_sleep %}
@ -174,17 +175,4 @@
</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()) -}}
{{- cleanup(getReport()) -}}