From d280ff6e74934139a0c93ed73d736347fd6e173e Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Fri, 26 May 2023 13:36:47 -0400 Subject: [PATCH] Tweak my med report to clean it up a bit in text form --- custom_templates/status.jinja | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/custom_templates/status.jinja b/custom_templates/status.jinja index 6cfe2fe..d7976bf 100644 --- a/custom_templates/status.jinja +++ b/custom_templates/status.jinja @@ -44,19 +44,21 @@ {% macro tony_morning_meds(method) %} {% from 'time.jinja' import input_datetime_12hr, input_datetime_12hr_with_date, ct %} {% set ct = ct() | int %} -{% if is_state('input_boolean.tony_morning_meds_taken','on') %} - Tony took his morning meds at {{ input_datetime_12hr_with_date('input_datetime.tony_morning_meds_taken') }} today. -{% elif is_state('input_boolean.tony_morning_meds_taken','off') and ct >= 21600 %} - Tony has not taken his morning meds. - {% if ct < state_attr('input_datetime.tony_morning_meds_notify','timestamp') | int %} - {% if method == 'tts' %} - {{ ['He has a reminder scheduled for', - 'Rest assured that I will pester him mercilessly about this, starting at', - 'This is absolutely essential, and I will remind him to do it at', - 'Since nobody including Tony himself likes him without his meds, I will remind him at', - ] | random }} {{ input_datetime_12hr('input_datetime.tony_morning_meds_notify') }} today. - {% else %} - He will be reminded at {{ input_datetime_12hr('input_datetime.tony_morning_meds_notify') }} today. +{% if is_state('binary_sensor.overnight','off') %} + {% if is_state('input_boolean.tony_morning_meds_taken','on') %} + Tony took his morning meds at {{ input_datetime_12hr_with_date('input_datetime.tony_morning_meds_taken') }} today. + {% elif is_state('input_boolean.tony_morning_meds_taken','off') and ct >= 21600 %} + Tony has not taken his morning meds. + {% if ct < state_attr('input_datetime.tony_morning_meds_notify','timestamp') | int %} + {% if method == 'tts' %} + {{ ['He has a reminder scheduled for', + 'Rest assured that I will pester him mercilessly about this, starting at', + 'This is absolutely essential, and I will remind him to do it at', + 'Since nobody including Tony himself likes him without his meds, I will remind him at', + ] | random }} {{ input_datetime_12hr('input_datetime.tony_morning_meds_notify') }} today. + {% else %} + He will be reminded at {{ input_datetime_12hr('input_datetime.tony_morning_meds_notify') }} today. + {% endif %} {% endif %} {% endif %} {% endif %}