From f53452e3a50fb36c7c173363d6b46ea9a5a7706c Mon Sep 17 00:00:00 2001
From: Tony Stork
Date: Fri, 26 Apr 2024 12:01:37 -0400
Subject: [PATCH] Rename status report macros
---
custom_templates/status.jinja | 70 ++++++++++-----------
packages/emmalynn.yaml | 8 +--
templates/speech/daily_briefing.yaml | 14 ++---
templates/speech/master_bedroom_wakeup.yaml | 10 +--
templates/speech/morning_briefing.yaml | 6 +-
templates/speech/nightly_briefing.yaml | 8 +--
templates/speech/welcome_home.yaml | 4 +-
7 files changed, 60 insertions(+), 60 deletions(-)
diff --git a/custom_templates/status.jinja b/custom_templates/status.jinja
index 82b3b8f..cbc5e4a 100644
--- a/custom_templates/status.jinja
+++ b/custom_templates/status.jinja
@@ -16,7 +16,7 @@
{% set kallenText = 'Kallen' %}
{% set kallenTTS = 'Collin' %}
-{% macro laundryReport(type,method) %}
+{% macro laundry_report(type,method) %}
{% macro data() %}
{% set washerTimer = states('timer.washer_timer') %}
{% set dryerTimer = states('timer.dryer_timer') %}
@@ -57,7 +57,7 @@
{{ cleanup(data()) }}
{% endmacro %}
-{% macro climateDevices(type,method) %}
+{% macro climate_devices(type,method) %}
{% set total = states('sensor.climate_devices_running') | int %}
{% set fans = states('sensor.fans_running') | int %}
{% set aircons = states('sensor.aircons_running') | int %}
@@ -75,7 +75,7 @@
{% endif %}
{% endmacro %}
-{% macro airLeaks(type,method) %}
+{% macro air_leaks(type,method) %}
{% set windows = states('sensor.windows_open') %}
{% set doors = states('sensor.doors_open') %}
{% if states('sensor.air_leaks') > '0' %}
@@ -110,24 +110,24 @@
{% endif %}
{% endmacro %}
-{% macro houseStatusReport(type,method) %}
+{% macro house_status_report(type,method) %}
{% macro data() %}
{% if type == 'climate_devices' %}
- {{ climateDevices(type,method) }}
- {% elif type == 'airleaks' %}
- {{ airLeaks(type,method) }}
+ {{ climate_devices(type,method) }}
+ {% elif type == 'air_leaks' %}
+ {{ air_leaks(type,method) }}
{% elif type == 'lights' %}
{{ lights_on(type,method) }}
{% elif type == 'full' %}
- {{ climateDevices(type,method) }}
+ {{ climate_devices(type,method) }}
{{ lights_on(type,method) }}
- {{ airLeaks(type,method) }}
+ {{ air_leaks(type,method) }}
{% endif %}
{% endmacro %}
{{ cleanup(data()) }}
{% endmacro %}
-{% macro tonyStatusReport(type,method) %}
+{% macro tony_status_report(type,method) %}
{% macro data() %}
{% if type == 'full' %}
{% if is_state('input_boolean.tony_awake','on') %}
@@ -274,7 +274,7 @@
{% endif %}
{% endmacro %}
-{% macro workReportTina(type,method) %}
+{% macro work_report_tina(type,method) %}
{% set tina = states.person.christina_stork.state %}
{% set start = (state_attr('binary_sensor.tina_work_tomorrow','start_timestamp') | int) // 1000 %}
{% set tmrw = (as_timestamp(states('sensor.date')) + 86400) | int %}
@@ -339,20 +339,20 @@
{% endif %}
{% endmacro %}
-{% macro medReportTina(type,method) %}
+{% macro work_report_tina(type,method) %}
{{ tina_morning_meds(type,method) }}
{{ tina_night_meds(type,method) }}
{% endmacro %}
-{% macro tinaStatusReport(type,method) %}
+{% macro tina_status_report(type,method) %}
{% macro data() %}
{% if type == 'work' %}
- {{ workReportTina(type,method) }}
+ {{ work_report_tina(type,method) }}
{% elif type == 'meds' %}
- {{ medReportTina(type,method) }}
+ {{ work_report_tina(type,method) }}
{% elif type == 'full' %}
- {{ workReportTina(type,method) }}
- {{ medReportTina(type,method) }}
+ {{ work_report_tina(type,method) }}
+ {{ work_report_tina(type,method) }}
{% endif %}
{% endmacro %}
{{ cleanup(data()) }}
@@ -423,7 +423,7 @@
{% endif %}
{% endmacro %}
-{% macro medReportKallen(type,method) %}
+{% macro med_report_kallen(type,method) %}
{% if is_state('input_boolean.kallen_overnight','on') %}
{% if type == 'meds' %}
{% if method == 'text' %}
@@ -441,7 +441,7 @@
{% endif %}
{% endmacro %}
-{% macro schoolReportKallen(type,method) %}
+{% macro school_report_kallen(type,method) %}
{% set wakeup = state_attr('input_datetime.kallen_wakeup_time','timestamp') %}
{% set bedtime = state_attr('input_datetime.kallen_bedtime','timestamp') %}
{% if method == 'tts' %}
@@ -556,7 +556,7 @@
{% endif %}
{% endmacro %}
-{% macro kallenSleep(type,method) %}
+{% macro kallen_sleep(type,method) %}
{% set bedtimestamp = state_attr('input_datetime.kallen_bedtime','timestamp') | int %}
{% if is_state('input_boolean.kallen_sleeping','on') %}
Kallen went to bed at {{ input_datetime_read('input_datetime.kallen_asleep_at') | trim }}.
@@ -571,24 +571,24 @@
{% endif %}
{% endmacro %}
-{% macro kallenStatusReport(type,method) %}
+{% macro kallen_status_report(type,method) %}
{% macro data() %}
{% if type == 'meds' %}
- {{ medReportKallen(type,method) }}
+ {{ med_report_kallen(type,method) }}
{% elif type == 'school' %}
- {{ schoolReportKallen(type,method) }}
+ {{ school_report_kallen(type,method) }}
{% elif type == 'sleep' %}
- {{ kallenSleep(type,method)}}
+ {{ kallen_sleep(type,method)}}
{% elif type == 'full' %}
- {{ kallenSleep(type,method) }}
- {{ medReportKallen(type,method) }}
- {{ schoolReportKallen(type,method) }}
+ {{ kallen_sleep(type,method) }}
+ {{ med_report_kallen(type,method) }}
+ {{ school_report_kallen(type,method) }}
{% endif %}
{% endmacro %}
{{ cleanup(data()) }}
{% endmacro %}
-{% macro emmaSleep(type,method) %}
+{% macro emma_sleep(type,method) %}
{% 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 day = now().strftime("%-d") %}
@@ -609,7 +609,7 @@
{% endif %}
{% endmacro %}
-{% macro emmaSleepNotification(type,method) %}
+{% macro emma_sleep_notification(type,method) %}
{% 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 day = now().strftime("%-d") %}
@@ -628,7 +628,7 @@
{% endif %}
{% endmacro %}
-{% macro medReportEmma(type,method) %}
+{% macro med_report_emma(type,method) %}
{% set tylenol_taken = input_datetime_read('input_datetime.emma_tylenol') | 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 %}
@@ -683,15 +683,15 @@
{% endif %}
{% endmacro %}
-{% macro emmaStatusReport(type,method) %}
+{% macro emma_status_report(type,method) %}
{% macro data() %}
{% if type == 'sleep' %}
- {{ emmaSleep(type,method) }}
+ {{ emma_sleep(type,method) }}
{% elif type == 'meds' %}
- {{ medReportEmma(type,method) }}
+ {{ med_report_emma(type,method) }}
{% elif type == 'full' %}
- {{ emmaSleep(type,method) }}
- {{ medReportEmma(type,method) }}
+ {{ emma_sleep(type,method) }}
+ {{ med_report_emma(type,method) }}
{% endif %}
{% endmacro %}
{{ cleanup(data()) }}
diff --git a/packages/emmalynn.yaml b/packages/emmalynn.yaml
index b740493..8959517 100644
--- a/packages/emmalynn.yaml
+++ b/packages/emmalynn.yaml
@@ -166,9 +166,9 @@ automation:
type: alert
title: Emma Sleeping
message: >
- {% from 'status.jinja' import emmaSleepNotification %}
+ {% from 'status.jinja' import emma_sleep_notification %}
{% from 'formatting.jinja' import cleanup %}
- {{ cleanup(emmaSleepNotification()) }}
+ {{ cleanup(emma_sleep_notification()) }}
tag: emma-sleep
- conditions:
- condition: trigger
@@ -219,9 +219,9 @@ automation:
type: alert
title: Emma Awakens
message: >
- {% from 'status.jinja' import emmaSleepNotification %}
+ {% from 'status.jinja' import emma_sleep_notification %}
{% from 'formatting.jinja' import cleanup %}
- {{ cleanup(emmaSleepNotification()) }}
+ {{ cleanup(emma_sleep_notification()) }}
tag: emma-wake
- service: script.emma_wakeup
diff --git a/templates/speech/daily_briefing.yaml b/templates/speech/daily_briefing.yaml
index 3bce7d7..6aa0847 100644
--- a/templates/speech/daily_briefing.yaml
+++ b/templates/speech/daily_briefing.yaml
@@ -3,7 +3,7 @@
{% from 'formatting.jinja' import cleanup %}
{%- macro getReport() -%}
{% 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 'weather.jinja' import weatherReport %}
{% from 'sports.jinja' import sports_updates %}
@@ -76,7 +76,7 @@
Tomorrow is Tony and Christina's wedding anniversary!
{% endif %}
- {{ tinaStatusReport('work','tts') }}
+ {{ tina_status_report('work','tts') }}
{% else %}
@@ -188,19 +188,19 @@
{%- 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 %}
- {{ houseStatusReport('full','tts') }}
+ {{ house_status_report('full','tts') }}
diff --git a/templates/speech/master_bedroom_wakeup.yaml b/templates/speech/master_bedroom_wakeup.yaml
index bb18690..2e0414f 100644
--- a/templates/speech/master_bedroom_wakeup.yaml
+++ b/templates/speech/master_bedroom_wakeup.yaml
@@ -2,7 +2,7 @@
{# Master Bedroom Wakeup #}
{%- macro getReport() -%}
{% 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 %}
{{ greeting('date') }}
@@ -15,13 +15,13 @@
{{ 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') }}
diff --git a/templates/speech/morning_briefing.yaml b/templates/speech/morning_briefing.yaml
index 90bbb5b..7d00a59 100644
--- a/templates/speech/morning_briefing.yaml
+++ b/templates/speech/morning_briefing.yaml
@@ -3,7 +3,7 @@
{% from 'formatting.jinja' import cleanup %}
{%- macro getReport() -%}
{% 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 'weather.jinja' import weatherReport %}
{% from 'sports.jinja' import sports_updates %}
@@ -53,7 +53,7 @@
{% endif %}
- {{ tinaStatusReport('work','tts') }}
+ {{ tina_status_report('work','tts') }}
{% if is_state('input_boolean.kallen_school_today','on') and is_state('input_boolean.work_today','on') %}
@@ -92,7 +92,7 @@
- {{ tonyStatusReport('stream','tts') }}
+ {{ tony_status_report('stream','tts') }}
diff --git a/templates/speech/nightly_briefing.yaml b/templates/speech/nightly_briefing.yaml
index 7d09d04..0694639 100644
--- a/templates/speech/nightly_briefing.yaml
+++ b/templates/speech/nightly_briefing.yaml
@@ -4,7 +4,7 @@
{%- macro getReport() -%}
{% 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 %}
+ {% 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 'weather.jinja' import weatherReport %}
{% from 'sports.jinja' import sports_updates %}
@@ -26,14 +26,14 @@
- {{ tonyStatusReport('stream','tts') }}
+ {{ tony_status_report('stream','tts') }}
{% if is_state('binary_sensor.kallen_school_tomorrow','on') %}
"Collin has school tomorrow at {{ time_from_calendar('calendar.kallen_school_days','start_time','read') }}. "
{% else %}
"Collin does not have school tomorrow. "
{% endif %}
- {{ tinaStatusReport('work','tts') }}
- {{ emmaStatusReport('sleep','tts') }}
+ {{ tina_status_report('work','tts') }}
+ {{ emma_status_report('sleep','tts') }}
diff --git a/templates/speech/welcome_home.yaml b/templates/speech/welcome_home.yaml
index 54c87ea..3c2ea42 100644
--- a/templates/speech/welcome_home.yaml
+++ b/templates/speech/welcome_home.yaml
@@ -4,7 +4,7 @@
{%- macro getReport() -%}
{% from 'speech.jinja' import dadjoke %}
{% 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 'weather.jinja' import weatherReport %}
@@ -124,7 +124,7 @@
- {{ emmaSleep() }}
+ {{ emma_sleep() }}