Rename status report macros

This commit is contained in:
2024-04-26 12:01:37 -04:00
parent 7ee95a1936
commit f53452e3a5
7 changed files with 60 additions and 60 deletions

View File

@ -16,7 +16,7 @@
{% set kallenText = 'Kallen' %} {% set kallenText = 'Kallen' %}
{% set kallenTTS = 'Collin' %} {% set kallenTTS = 'Collin' %}
{% macro laundryReport(type,method) %} {% macro laundry_report(type,method) %}
{% macro data() %} {% macro data() %}
{% set washerTimer = states('timer.washer_timer') %} {% set washerTimer = states('timer.washer_timer') %}
{% set dryerTimer = states('timer.dryer_timer') %} {% set dryerTimer = states('timer.dryer_timer') %}
@ -57,7 +57,7 @@
{{ cleanup(data()) }} {{ cleanup(data()) }}
{% endmacro %} {% endmacro %}
{% macro climateDevices(type,method) %} {% macro climate_devices(type,method) %}
{% set total = states('sensor.climate_devices_running') | int %} {% set total = states('sensor.climate_devices_running') | int %}
{% set fans = states('sensor.fans_running') | int %} {% set fans = states('sensor.fans_running') | int %}
{% set aircons = states('sensor.aircons_running') | int %} {% set aircons = states('sensor.aircons_running') | int %}
@ -75,7 +75,7 @@
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}
{% macro airLeaks(type,method) %} {% macro air_leaks(type,method) %}
{% set windows = states('sensor.windows_open') %} {% set windows = states('sensor.windows_open') %}
{% set doors = states('sensor.doors_open') %} {% set doors = states('sensor.doors_open') %}
{% if states('sensor.air_leaks') > '0' %} {% if states('sensor.air_leaks') > '0' %}
@ -110,24 +110,24 @@
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}
{% macro houseStatusReport(type,method) %} {% macro house_status_report(type,method) %}
{% macro data() %} {% macro data() %}
{% if type == 'climate_devices' %} {% if type == 'climate_devices' %}
{{ climateDevices(type,method) }} {{ climate_devices(type,method) }}
{% elif type == 'airleaks' %} {% elif type == 'air_leaks' %}
{{ airLeaks(type,method) }} {{ air_leaks(type,method) }}
{% elif type == 'lights' %} {% elif type == 'lights' %}
{{ lights_on(type,method) }} {{ lights_on(type,method) }}
{% elif type == 'full' %} {% elif type == 'full' %}
{{ climateDevices(type,method) }} {{ climate_devices(type,method) }}
{{ lights_on(type,method) }} {{ lights_on(type,method) }}
{{ airLeaks(type,method) }} {{ air_leaks(type,method) }}
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}
{{ cleanup(data()) }} {{ cleanup(data()) }}
{% endmacro %} {% endmacro %}
{% macro tonyStatusReport(type,method) %} {% macro tony_status_report(type,method) %}
{% macro data() %} {% macro data() %}
{% if type == 'full' %} {% if type == 'full' %}
{% if is_state('input_boolean.tony_awake','on') %} {% if is_state('input_boolean.tony_awake','on') %}
@ -274,7 +274,7 @@
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}
{% macro workReportTina(type,method) %} {% macro work_report_tina(type,method) %}
{% set tina = states.person.christina_stork.state %} {% set tina = states.person.christina_stork.state %}
{% set start = (state_attr('binary_sensor.tina_work_tomorrow','start_timestamp') | int) // 1000 %} {% set start = (state_attr('binary_sensor.tina_work_tomorrow','start_timestamp') | int) // 1000 %}
{% set tmrw = (as_timestamp(states('sensor.date')) + 86400) | int %} {% set tmrw = (as_timestamp(states('sensor.date')) + 86400) | int %}
@ -339,20 +339,20 @@
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}
{% macro medReportTina(type,method) %} {% macro work_report_tina(type,method) %}
{{ tina_morning_meds(type,method) }} {{ tina_morning_meds(type,method) }}
{{ tina_night_meds(type,method) }} {{ tina_night_meds(type,method) }}
{% endmacro %} {% endmacro %}
{% macro tinaStatusReport(type,method) %} {% macro tina_status_report(type,method) %}
{% macro data() %} {% macro data() %}
{% if type == 'work' %} {% if type == 'work' %}
{{ workReportTina(type,method) }} {{ work_report_tina(type,method) }}
{% elif type == 'meds' %} {% elif type == 'meds' %}
{{ medReportTina(type,method) }} {{ work_report_tina(type,method) }}
{% elif type == 'full' %} {% elif type == 'full' %}
{{ workReportTina(type,method) }} {{ work_report_tina(type,method) }}
{{ medReportTina(type,method) }} {{ work_report_tina(type,method) }}
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}
{{ cleanup(data()) }} {{ cleanup(data()) }}
@ -423,7 +423,7 @@
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}
{% macro medReportKallen(type,method) %} {% macro med_report_kallen(type,method) %}
{% if is_state('input_boolean.kallen_overnight','on') %} {% if is_state('input_boolean.kallen_overnight','on') %}
{% if type == 'meds' %} {% if type == 'meds' %}
{% if method == 'text' %} {% if method == 'text' %}
@ -441,7 +441,7 @@
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}
{% macro schoolReportKallen(type,method) %} {% macro school_report_kallen(type,method) %}
{% set wakeup = state_attr('input_datetime.kallen_wakeup_time','timestamp') %} {% set wakeup = state_attr('input_datetime.kallen_wakeup_time','timestamp') %}
{% set bedtime = state_attr('input_datetime.kallen_bedtime','timestamp') %} {% set bedtime = state_attr('input_datetime.kallen_bedtime','timestamp') %}
{% if method == 'tts' %} {% if method == 'tts' %}
@ -556,7 +556,7 @@
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}
{% macro kallenSleep(type,method) %} {% macro kallen_sleep(type,method) %}
{% set bedtimestamp = state_attr('input_datetime.kallen_bedtime','timestamp') | int %} {% set bedtimestamp = state_attr('input_datetime.kallen_bedtime','timestamp') | int %}
{% if is_state('input_boolean.kallen_sleeping','on') %} {% if is_state('input_boolean.kallen_sleeping','on') %}
Kallen went to bed at {{ input_datetime_read('input_datetime.kallen_asleep_at') | trim }}. Kallen went to bed at {{ input_datetime_read('input_datetime.kallen_asleep_at') | trim }}.
@ -571,24 +571,24 @@
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}
{% macro kallenStatusReport(type,method) %} {% macro kallen_status_report(type,method) %}
{% macro data() %} {% macro data() %}
{% if type == 'meds' %} {% if type == 'meds' %}
{{ medReportKallen(type,method) }} {{ med_report_kallen(type,method) }}
{% elif type == 'school' %} {% elif type == 'school' %}
{{ schoolReportKallen(type,method) }} {{ school_report_kallen(type,method) }}
{% elif type == 'sleep' %} {% elif type == 'sleep' %}
{{ kallenSleep(type,method)}} {{ kallen_sleep(type,method)}}
{% elif type == 'full' %} {% elif type == 'full' %}
{{ kallenSleep(type,method) }} {{ kallen_sleep(type,method) }}
{{ medReportKallen(type,method) }} {{ med_report_kallen(type,method) }}
{{ schoolReportKallen(type,method) }} {{ school_report_kallen(type,method) }}
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}
{{ cleanup(data()) }} {{ cleanup(data()) }}
{% endmacro %} {% endmacro %}
{% macro emmaSleep(type,method) %} {% macro emma_sleep(type,method) %}
{% set asleep = state_attr('input_datetime.emma_down_for_nap','timestamp') | int %} {% set asleep = state_attr('input_datetime.emma_down_for_nap','timestamp') | int %}
{% set wakeup = state_attr('input_datetime.emma_up_from_nap','timestamp') | int %} {% set wakeup = state_attr('input_datetime.emma_up_from_nap','timestamp') | int %}
{% set day = now().strftime("%-d") %} {% set day = now().strftime("%-d") %}
@ -609,7 +609,7 @@
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}
{% macro emmaSleepNotification(type,method) %} {% macro emma_sleep_notification(type,method) %}
{% set asleep = state_attr('input_datetime.emma_down_for_nap','timestamp') | int %} {% set asleep = state_attr('input_datetime.emma_down_for_nap','timestamp') | int %}
{% set wakeup = state_attr('input_datetime.emma_up_from_nap','timestamp') | int %} {% set wakeup = state_attr('input_datetime.emma_up_from_nap','timestamp') | int %}
{% set day = now().strftime("%-d") %} {% set day = now().strftime("%-d") %}
@ -628,7 +628,7 @@
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}
{% macro medReportEmma(type,method) %} {% macro med_report_emma(type,method) %}
{% set tylenol_taken = input_datetime_read('input_datetime.emma_tylenol') | trim %} {% set tylenol_taken = input_datetime_read('input_datetime.emma_tylenol') | trim %}
{% set ibuprofen_taken = input_datetime_read('input_datetime.emma_ibuprofen') | trim %} {% set ibuprofen_taken = input_datetime_read('input_datetime.emma_ibuprofen') | trim %}
{% set cough_meds_taken = input_datetime_read('input_datetime.emma_cough_meds') | trim %} {% set cough_meds_taken = input_datetime_read('input_datetime.emma_cough_meds') | trim %}
@ -683,15 +683,15 @@
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}
{% macro emmaStatusReport(type,method) %} {% macro emma_status_report(type,method) %}
{% macro data() %} {% macro data() %}
{% if type == 'sleep' %} {% if type == 'sleep' %}
{{ emmaSleep(type,method) }} {{ emma_sleep(type,method) }}
{% elif type == 'meds' %} {% elif type == 'meds' %}
{{ medReportEmma(type,method) }} {{ med_report_emma(type,method) }}
{% elif type == 'full' %} {% elif type == 'full' %}
{{ emmaSleep(type,method) }} {{ emma_sleep(type,method) }}
{{ medReportEmma(type,method) }} {{ med_report_emma(type,method) }}
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}
{{ cleanup(data()) }} {{ cleanup(data()) }}

View File

@ -166,9 +166,9 @@ automation:
type: alert type: alert
title: Emma Sleeping title: Emma Sleeping
message: > message: >
{% from 'status.jinja' import emmaSleepNotification %} {% from 'status.jinja' import emma_sleep_notification %}
{% from 'formatting.jinja' import cleanup %} {% from 'formatting.jinja' import cleanup %}
{{ cleanup(emmaSleepNotification()) }} {{ cleanup(emma_sleep_notification()) }}
tag: emma-sleep tag: emma-sleep
- conditions: - conditions:
- condition: trigger - condition: trigger
@ -219,9 +219,9 @@ automation:
type: alert type: alert
title: Emma Awakens title: Emma Awakens
message: > message: >
{% from 'status.jinja' import emmaSleepNotification %} {% from 'status.jinja' import emma_sleep_notification %}
{% from 'formatting.jinja' import cleanup %} {% from 'formatting.jinja' import cleanup %}
{{ cleanup(emmaSleepNotification()) }} {{ cleanup(emma_sleep_notification()) }}
tag: emma-wake tag: emma-wake
- service: script.emma_wakeup - service: script.emma_wakeup

View File

@ -3,7 +3,7 @@
{% from 'formatting.jinja' import cleanup %} {% from 'formatting.jinja' import cleanup %}
{%- macro getReport() -%} {%- macro getReport() -%}
{% from 'speech.jinja' import greeting, dadjoke, inspirational_quote, today_is, sun_status %} {% from 'speech.jinja' import greeting, dadjoke, inspirational_quote, today_is, sun_status %}
{% from 'status.jinja' import houseStatusReport, tonyStatusReport, tinaStatusReport, kallenStatusReport, emmaStatusReport %} {% from 'status.jinja' import house_status_report, tony_status_report, tina_status_report, kallen_status_report, emma_status_report %}
{% from 'easy_time.jinja' import count_the_days %} {% from 'easy_time.jinja' import count_the_days %}
{% from 'weather.jinja' import weatherReport %} {% from 'weather.jinja' import weatherReport %}
{% from 'sports.jinja' import sports_updates %} {% from 'sports.jinja' import sports_updates %}
@ -76,7 +76,7 @@
Tomorrow is Tony and Christina's wedding anniversary! Tomorrow is Tony and Christina's wedding anniversary!
{% endif %} {% endif %}
{{ tinaStatusReport('work','tts') }} {{ tina_status_report('work','tts') }}
{% else %} {% else %}
@ -188,19 +188,19 @@
{%- endif -%} {%- endif -%}
{%- endif -%} {%- endif -%}
{{ tinaStatusReport('work','tts') }} {{ tina_status_report('work','tts') }}
{{ tonyStatusReport('stream','tts') }} {{ tony_status_report('stream','tts') }}
{{ kallenStatusReport('school','tts') }} {{ kallen_status_report('school','tts') }}
{{ emmaStatusReport('sleep','tts') }} {{ emma_status_report('sleep','tts') }}
{% endif %} {% endif %}
</p> </p>
<p> <p>
{{ houseStatusReport('full','tts') }} {{ house_status_report('full','tts') }}
</p> </p>
<p> <p>

View File

@ -2,7 +2,7 @@
{# Master Bedroom Wakeup #} {# Master Bedroom Wakeup #}
{%- macro getReport() -%} {%- macro getReport() -%}
{% from 'speech.jinja' import greeting, today_is %} {% from 'speech.jinja' import greeting, today_is %}
{% from 'status.jinja' import tonyStatusReport, tinaStatusReport, kallenStatusReport, emmaStatusReport %} {% from 'status.jinja' import tony_status_report, tina_status_report, kallen_status_report, emma_status_report %}
{% from 'weather.jinja' import weatherReport %} {% from 'weather.jinja' import weatherReport %}
<p> <p>
{{ greeting('date') }} {{ greeting('date') }}
@ -15,13 +15,13 @@
<p> <p>
{{ weatherReport('alerts','tts','day') }} {{ weatherReport('alerts','tts','day') }}
{{ tonyStatusReport('full','tts') }} {{ tony_status_report('full','tts') }}
{{ tinaStatusReport('full','tts') }} {{ tina_status_report('full','tts') }}
{{ kallenStatusReport('full','tts') }} {{ kallen_status_report('full','tts') }}
{{ emmaStatusReport('full','tts') }} {{ emma_status_report('full','tts') }}
</p> </p>
<p> <p>

View File

@ -3,7 +3,7 @@
{% from 'formatting.jinja' import cleanup %} {% from 'formatting.jinja' import cleanup %}
{%- macro getReport() -%} {%- macro getReport() -%}
{% from 'speech.jinja' import greeting, dadjoke, inspirational_quote, today_is %} {% from 'speech.jinja' import greeting, dadjoke, inspirational_quote, today_is %}
{% from 'status.jinja' import tonyStatusReport, tinaStatusReport, kallenStatusReport, emmaStatusReport %} {% from 'status.jinja' import tony_status_report, tina_status_report, kallen_status_report, emma_status_report %}
{% from 'easy_time.jinja' import count_the_days %} {% from 'easy_time.jinja' import count_the_days %}
{% from 'weather.jinja' import weatherReport %} {% from 'weather.jinja' import weatherReport %}
{% from 'sports.jinja' import sports_updates %} {% from 'sports.jinja' import sports_updates %}
@ -53,7 +53,7 @@
{% endif %} {% endif %}
</p> </p>
<p> <p>
{{ tinaStatusReport('work','tts') }} {{ tina_status_report('work','tts') }}
</p> </p>
<p> <p>
{% if is_state('input_boolean.kallen_school_today','on') and is_state('input_boolean.work_today','on') %} {% if is_state('input_boolean.kallen_school_today','on') and is_state('input_boolean.work_today','on') %}
@ -92,7 +92,7 @@
</p> </p>
<p> <p>
{{ tonyStatusReport('stream','tts') }} {{ tony_status_report('stream','tts') }}
</p> </p>
<p> <p>

View File

@ -4,7 +4,7 @@
{%- macro getReport() -%} {%- macro getReport() -%}
{% from 'speech.jinja' import greeting, dadjoke, inspirational_quote %} {% from 'speech.jinja' import greeting, dadjoke, inspirational_quote %}
{% from 'time.jinja' import input_datetime_read, time_from_calendar, next_twitch_stream %} {% from 'time.jinja' import input_datetime_read, time_from_calendar, next_twitch_stream %}
{% from 'status.jinja' import tonyStatusReport, tinaStatusReport, kallenStatusReport, emmaStatusReport %} {% from 'status.jinja' import tony_status_report, tina_status_report, kallen_status_report, emma_status_report %}
{% from 'easy_time.jinja' import count_the_days %} {% from 'easy_time.jinja' import count_the_days %}
{% from 'weather.jinja' import weatherReport %} {% from 'weather.jinja' import weatherReport %}
{% from 'sports.jinja' import sports_updates %} {% from 'sports.jinja' import sports_updates %}
@ -26,14 +26,14 @@
</p> </p>
<p> <p>
{{ tonyStatusReport('stream','tts') }} {{ tony_status_report('stream','tts') }}
{% if is_state('binary_sensor.kallen_school_tomorrow','on') %} {% if is_state('binary_sensor.kallen_school_tomorrow','on') %}
"Collin has school tomorrow at {{ time_from_calendar('calendar.kallen_school_days','start_time','read') }}. " "Collin has school tomorrow at {{ time_from_calendar('calendar.kallen_school_days','start_time','read') }}. "
{% else %} {% else %}
"Collin does not have school tomorrow. " "Collin does not have school tomorrow. "
{% endif %} {% endif %}
{{ tinaStatusReport('work','tts') }} {{ tina_status_report('work','tts') }}
{{ emmaStatusReport('sleep','tts') }} {{ emma_status_report('sleep','tts') }}
</p> </p>
<p> <p>

View File

@ -4,7 +4,7 @@
{%- macro getReport() -%} {%- macro getReport() -%}
{% from 'speech.jinja' import dadjoke %} {% from 'speech.jinja' import dadjoke %}
{% from 'time.jinja' import input_datetime_read %} {% from 'time.jinja' import input_datetime_read %}
{% from 'status.jinja' import emmaSleep %} {% from 'status.jinja' import emma_sleep %}
{% from 'easy_time.jinja' import count_the_days %} {% from 'easy_time.jinja' import count_the_days %}
{% from 'weather.jinja' import weatherReport %} {% from 'weather.jinja' import weatherReport %}
<p> <p>
@ -124,7 +124,7 @@
</p> </p>
<p> <p>
{{ emmaSleep() }} {{ emma_sleep() }}
</p> </p>
<p> <p>