Afternoon meds added to meds tracker

This commit is contained in:
2023-11-05 13:11:07 -05:00
parent 025f611ba5
commit 1fb7fb145a
5 changed files with 212 additions and 10 deletions

View File

@ -172,7 +172,7 @@ Tony is currently streaming. The current stream category is {{ game }}. The curr
{% endif %}
{% endmacro %}
{% macro tony_night_meds(type,method) %}
{% macro tony_afternoon_meds(type,method) %}
{% set streamBlock = twitchStreamInfo(type,method) | trim == '' %}
{% set morningBlock = tony_morning_meds(type,method) | trim != '' %}
{% if type == 'meds' or streamBlock == true or morningBlock == true %}
@ -180,6 +180,33 @@ Tony is currently streaming. The current stream category is {{ game }}. The curr
{% else %}
{% set identTony = 'He' %}
{% endif %}
{% if is_state('input_boolean.tony_afternoon_meds_taken','on') and is_state('input_boolean.tony_awake','on') %}
{{ 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 ct >= 61200 %}
{{ identTony }} has not taken his afternoon meds.
{% if ct < state_attr('input_datetime.tony_afternoon_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_read('input_datetime.tony_afternoon_meds_notify') | trim }}.
{% else %}
He will be reminded at {{ input_datetime_read('input_datetime.tony_afternoon_meds_notify') | trim }}.
{% endif %}
{% endif %}
{% endif %}
{% endmacro %}
{% macro tony_night_meds(type,method) %}
{% set streamBlock = twitchStreamInfo(type,method) | trim == '' %}
{% set morningBlock = tony_morning_meds(type,method) | trim != '' %}
{% set afternoonBlock = tony_afternoon_meds(type,method) | trim != '' %}
{% if type == 'meds' or streamBlock == true or (morningBlock == true and afternoonBlock == true) %}
{% set identTony = 'Tony' %}
{% else %}
{% set identTony = 'He' %}
{% endif %}
{% if is_state('input_boolean.tony_night_meds_taken','on') and (is_state('binary_sensor.overnight','on') or ct < 43200) %}
{{ 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('binary_sensor.overnight','on') %}
@ -198,6 +225,7 @@ Tony is currently streaming. The current stream category is {{ game }}. The curr
{% macro medReportTony(type,method) %}
{{ tony_morning_meds(type,method) }}
{{ tony_afternoon_meds(type,method) }}
{{ tony_night_meds(type,method) }}
{% endmacro %}