From 9563af74bad6cee9ea78370cf2efa8110bd7d2dd Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Tue, 9 Jan 2024 17:58:22 -0500 Subject: [PATCH] Handle name usage better --- custom_templates/status.jinja | 39 ++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/custom_templates/status.jinja b/custom_templates/status.jinja index 6171139..f6b1d97 100644 --- a/custom_templates/status.jinja +++ b/custom_templates/status.jinja @@ -126,9 +126,9 @@ {% endif %} {% if type in ['stream','full'] %} {% if type == 'stream' %} - {% set identTonyStream = 'Tony' %} + {% set identTony = 'Tony' %} {% else %} - {% set identTonyStream = 'He' %} + {% set identTony = 'He' %} {% endif %} {% if is_state('input_boolean.tony_streaming_today','on') or calendar_event_today('calendar.tony_s_twitch_schedule') == 'false' %} {% set streamstart = state_attr('input_datetime.tony_streaming_start_time','timestamp') | timestamp_custom('%-I:%M %p',false) %} @@ -138,10 +138,11 @@ {% set game = state_attr('sensor.twitch_ironnerd24','game') %} {% set viewers = state_attr('sensor.twitch_ironnerd24','viewers') %} {% if is_state('sensor.twitch_ironnerd24','streaming') %} - Iron Nerd Gaming is currently streaming {{ game }} to {{ viewers }} viewers. + {{ identTony }} is currently streaming {{ game }} to {{ viewers }} viewers. + {% set identTony = 'He' %} {% elif is_state('input_boolean.tony_streaming_today','on') or calendar_event_today('calendar.tony_s_twitch_schedule') == 'true' %} {% if method == 'tts' %} - {{ identTonyStream }} + {{ identTony }} {{ [ " will be pretending to be a real content creator tonight. ", " will be doing his best to defeat his impostor syndrome tonight. ", @@ -150,26 +151,30 @@ " is not really all that funny, but tonight he will present himself to a crowd of questionable individuals who seem to think that he is. " ] | random }} The studio is scheduled to go online at {{ streamstart }}. " {% elif method == 'text' %} - Iron Nerd Gaming will be live today at {{ streamstart }}. + {{ identTony }} will be live today at {{ streamstart }}. {% endif %} + {% set identTony = 'He' %} {% elif state_attr('calendar.tony_s_twitch_schedule','start_time') != none %} {% if count_the_days('calendar.tony_s_twitch_schedule','start_time') | int == 1 %} - Iron Nerd Gaming will be streaming at {{ time_from_calendar('calendar.tony_s_twitch_schedule','start_time','read') }} tomorrow. + {{ identTony }} will be streaming at {{ time_from_calendar('calendar.tony_s_twitch_schedule','start_time','read') }} tomorrow. {% endif %} + {% set identTony = 'He' %} + {% else %} + {% set identTony = 'Tony' %} {% endif %} {% endif %} {% if type in ['meds','full'] %} {% if type == 'meds' %} - {% set identTonyMeds = 'Tony' %} + {% set identTony = 'Tony' %} {% else %} - {% set identTonyMeds = 'He' %} + {% set identTony = 'He' %} {% endif %} {% set morningNotifyTimestamp = state_attr('input_datetime.tony_morning_meds_notify','timestamp') | int %} {% if is_state('binary_sensor.overnight','off') and is_state('input_boolean.tony_awake','on') %} {% if is_state('input_boolean.tony_morning_meds_taken','on') %} - {{ identTonyMeds }} took his morning meds at {{ input_datetime_read('input_datetime.tony_morning_meds_taken') | trim }}. + {{ identTony }} took his morning meds at {{ input_datetime_read('input_datetime.tony_morning_meds_taken') | trim }}. {% elif is_state('input_boolean.tony_morning_meds_taken','off') %} - {{ identTonyMeds }} has not taken his morning meds. + {{ identTony }} has not taken his morning meds. {% if ct < morningNotifyTimestamp %} {% if method == 'tts' %} {{ ['He has a reminder scheduled for', @@ -182,13 +187,16 @@ {% endif %} {% endif %} {% endif %} + {% set identTony = 'He' %} + {% else %} + {% set identTony = 'Tony' %} {% endif %} {% set afternoonNotifyTimestamp = state_attr('input_datetime.tony_afternoon_meds_notify','timestamp') | int %} {% if is_state('input_boolean.tony_afternoon_meds_taken','on') and is_state('input_boolean.tony_awake','on') %} - {{ identTonyMeds }} took his afternoon meds at {{ input_datetime_read('input_datetime.tony_afternoon_meds_taken') | trim }}. + {{ identTony }} took his afternoon meds at {{ input_datetime_read('input_datetime.tony_afternoon_meds_taken') | trim }}. {% elif is_state('input_boolean.tony_afternoon_meds_taken','off') and (afternoonNotifyTimestamp - ct) < 7200 and ct < 86400 %} - {{ identTonyMeds }} has not taken his afternoon meds. + {{ identTony }} has not taken his afternoon meds. {% if ct < afternoonNotifyTimestamp %} {% if method == 'tts' %} {{ ['He has a reminder scheduled for', @@ -200,11 +208,14 @@ He will be reminded at {{ input_datetime_read('input_datetime.tony_afternoon_meds_notify') | trim }}. {% endif %} {% endif %} + {% set identTony = 'He' %} + {% else %} + {% set identTony = 'Tony' %} {% endif %} {% if is_state('input_boolean.tony_night_meds_taken','on') and (is_state('input_boolean.tony_awake','off') or is_state('input_boolean.night_mode','on')) %} - {{ identTonyMeds }} took his night meds at {{ input_datetime_read('input_datetime.tony_night_meds_taken') | trim }}. + {{ identTony }} took his night meds at {{ input_datetime_read('input_datetime.tony_night_meds_taken') | trim }}. {% elif is_state('input_boolean.tony_night_meds_taken','off') and is_state('input_boolean.night_mode','on') %} - {{ identTonyMeds }} has not taken his night meds. + {{ identTony }} has not taken his night meds. {% if method == 'tts' %} {{ ['He will be reminded when he goes to bed.', 'I will make sure he is reminded when it is time.',