Tweaks to E's med tracker involving sleep/wake times #130
This commit is contained in:
@ -506,7 +506,7 @@ Tony is currently streaming. The current stream category is {{ game }}. The curr
|
|||||||
{{ cleanup(data()) }}
|
{{ cleanup(data()) }}
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
{% macro emma_sleep(type,method) %}
|
{% macro emmaSleep(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") %}
|
||||||
@ -553,34 +553,41 @@ Tony is currently streaming. The current stream category is {{ game }}. The curr
|
|||||||
{% set tylenol_next = input_datetime_read('input_datetime.emma_tylenol_notify','nodate') | trim %}
|
{% set tylenol_next = input_datetime_read('input_datetime.emma_tylenol_notify','nodate') | trim %}
|
||||||
{% set ibuprofen_next = input_datetime_read('input_datetime.emma_ibuprofen_notify','nodate') | trim %}
|
{% set ibuprofen_next = input_datetime_read('input_datetime.emma_ibuprofen_notify','nodate') | trim %}
|
||||||
{% set cough_meds_next = input_datetime_read('input_datetime.emma_cough_meds_notify','nodate') | trim %}
|
{% set cough_meds_next = input_datetime_read('input_datetime.emma_cough_meds_notify','nodate') | trim %}
|
||||||
|
{% if type == 'meds' %}
|
||||||
|
{% set identEmma = 'Emma' %}
|
||||||
|
{% else %}
|
||||||
|
{% set identEmma = 'She' %}
|
||||||
|
{% endif %}
|
||||||
{% if is_state('input_boolean.emma_alternating_meds_active','on') and
|
{% if is_state('input_boolean.emma_alternating_meds_active','on') and
|
||||||
is_state('input_boolean.emma_cough_meds_active','on') and
|
is_state('input_boolean.emma_cough_meds_active','on') and
|
||||||
is_state('input_boolean.emma_tylenol','off') and
|
is_state('input_boolean.emma_tylenol','off') and
|
||||||
is_state('input_boolean.emma_ibuprofen','off') and
|
is_state('input_boolean.emma_ibuprofen','off') and
|
||||||
is_state('input_boolean.emma_cough_meds','off') %}
|
is_state('input_boolean.emma_cough_meds','off') %}
|
||||||
Emma has not taken her ibuprofen, tylenol, or cough meds.
|
{{ identEmma }} has not taken her ibuprofen, tylenol, or cough meds.
|
||||||
|
{% elif (is_state('input_boolean.emma_alternating_meds_active','on') or is_state('input_boolean.emma_cough_meds_active','on')) and is_state('input_boolean.emma_sleeping','on') %}
|
||||||
|
Med tracking is paused during sleep.
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if is_state('input_boolean.emma_alternating_meds_active','on') %}
|
{% if is_state('input_boolean.emma_alternating_meds_active','on') %}
|
||||||
{% if is_state('input_boolean.emma_tylenol','off') and is_state('input_boolean.emma_ibuprofen','off') %}
|
{% if is_state('input_boolean.emma_tylenol','off') and is_state('input_boolean.emma_ibuprofen','off') %}
|
||||||
Emma has not taken her ibuprofen or her tylenol.
|
{{ identEmma }} has not taken her ibuprofen or her tylenol.
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if is_state('input_boolean.emma_tylenol','on') %}
|
{% if is_state('input_boolean.emma_tylenol','on') %}
|
||||||
Emma has taken her tylenol. Her most recent dose was at {{ tylenol_taken }}. Her next dose is at {{ tylenol_next }}.
|
{{ identEmma }} has taken her tylenol. Her most recent dose was at {{ tylenol_taken }}. Her next dose is at {{ tylenol_next }}.
|
||||||
{% else %}
|
{% else %}
|
||||||
Emma has not taken her tylenol.
|
{{ identEmma }} has not taken her tylenol.
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if is_state('input_boolean.emma_ibuprofen','on') %}
|
{% if is_state('input_boolean.emma_ibuprofen','on') %}
|
||||||
Emma has taken her ibuprofen. Her most recent dose was at {{ ibuprofen_taken }}. Her next dose is at {{ ibuprofen_next }}.
|
{{ identEmma }} has taken her ibuprofen. Her most recent dose was at {{ ibuprofen_taken }}. Her next dose is at {{ ibuprofen_next }}.
|
||||||
{% else %}
|
{% else %}
|
||||||
Emma has not taken her ibuprofen.
|
{{ identEmma }} has not taken her ibuprofen.
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if is_state('input_boolean.emma_cough_meds_active','on') %}
|
{% if is_state('input_boolean.emma_cough_meds_active','on') %}
|
||||||
{% if is_state('input_boolean.emma_cough_meds','on') %}
|
{% if is_state('input_boolean.emma_cough_meds','on') %}
|
||||||
Emma has taken her cough meds. Her most recent dose was at {{ cough_meds_taken }}. Her next dose is at {{ cough_meds_next }}.
|
{{ identEmma }} has taken her cough meds. Her most recent dose was at {{ cough_meds_taken }}. Her next dose is at {{ cough_meds_next }}.
|
||||||
{% else %}
|
{% else %}
|
||||||
Emma has not taken her cough meds.
|
{{ identEmma }} has not taken her cough meds.
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -589,11 +596,11 @@ Tony is currently streaming. The current stream category is {{ game }}. The curr
|
|||||||
{% macro emmaStatusReport(type,method) %}
|
{% macro emmaStatusReport(type,method) %}
|
||||||
{% macro data() %}
|
{% macro data() %}
|
||||||
{% if type == 'sleep' %}
|
{% if type == 'sleep' %}
|
||||||
{{ emma_sleep(type,method) }}
|
{{ emmaSleep(type,method) }}
|
||||||
{% elif type == 'meds' %}
|
{% elif type == 'meds' %}
|
||||||
{{ medReportEmma(type,method) }}
|
{{ medReportEmma(type,method) }}
|
||||||
{% elif type == 'full' %}
|
{% elif type == 'full' %}
|
||||||
{{ emma_sleep(type,method) }}
|
{{ emmaSleep(type,method) }}
|
||||||
{{ medReportEmma(type,method) }}
|
{{ medReportEmma(type,method) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
@ -557,12 +557,12 @@ script:
|
|||||||
mode: queued
|
mode: queued
|
||||||
max: 10
|
max: 10
|
||||||
sequence:
|
sequence:
|
||||||
|
- service: input_boolean.turn_off
|
||||||
|
target:
|
||||||
|
entity_id: input_boolean.emma_ibuprofen
|
||||||
- choose:
|
- choose:
|
||||||
- conditions: "{{ reason == 'ibuprofen-notify' and is_state('input_boolean.emma_sleeping','off') }}"
|
- conditions: "{{ reason == 'ibuprofen-notify' and is_state('input_boolean.emma_sleeping','off') }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: input_boolean.turn_off
|
|
||||||
target:
|
|
||||||
entity_id: input_boolean.emma_ibuprofen
|
|
||||||
- service: script.text_notify
|
- service: script.text_notify
|
||||||
data:
|
data:
|
||||||
who: >
|
who: >
|
||||||
@ -686,12 +686,12 @@ script:
|
|||||||
mode: queued
|
mode: queued
|
||||||
max: 10
|
max: 10
|
||||||
sequence:
|
sequence:
|
||||||
|
- service: input_boolean.turn_off
|
||||||
|
target:
|
||||||
|
entity_id: input_boolean.emma_tylenol
|
||||||
- choose:
|
- choose:
|
||||||
- conditions: "{{ reason == 'tylenol-notify' and is_state('input_boolean.emma_sleeping','off') }}"
|
- conditions: "{{ reason == 'tylenol-notify' and is_state('input_boolean.emma_sleeping','off') }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: input_boolean.turn_off
|
|
||||||
target:
|
|
||||||
entity_id: input_boolean.emma_tylenol
|
|
||||||
- service: script.text_notify
|
- service: script.text_notify
|
||||||
data:
|
data:
|
||||||
who: >
|
who: >
|
||||||
@ -814,12 +814,12 @@ script:
|
|||||||
mode: queued
|
mode: queued
|
||||||
max: 10
|
max: 10
|
||||||
sequence:
|
sequence:
|
||||||
|
- service: input_boolean.turn_off
|
||||||
|
target:
|
||||||
|
entity_id: input_boolean.emma_cough_meds
|
||||||
- choose:
|
- choose:
|
||||||
- conditions: "{{ reason == 'cough-notify' and is_state('input_boolean.emma_sleeping','off') }}"
|
- conditions: "{{ reason == 'cough-notify' and is_state('input_boolean.emma_sleeping','off') }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: input_boolean.turn_off
|
|
||||||
target:
|
|
||||||
entity_id: input_boolean.emma_cough_meds
|
|
||||||
- service: script.text_notify
|
- service: script.text_notify
|
||||||
data:
|
data:
|
||||||
who: >
|
who: >
|
||||||
@ -933,6 +933,13 @@ script:
|
|||||||
before: '16:00:00'
|
before: '16:00:00'
|
||||||
then:
|
then:
|
||||||
- service: script.emma_bedroom_scheduling_evening
|
- service: script.emma_bedroom_scheduling_evening
|
||||||
|
# Meds
|
||||||
|
- service: script.turn_off
|
||||||
|
target:
|
||||||
|
entity_id:
|
||||||
|
- script.emma_ibuprofen
|
||||||
|
- script.emma_tylenol
|
||||||
|
- script.emma_cough_meds
|
||||||
# Lighting
|
# Lighting
|
||||||
- choose:
|
- choose:
|
||||||
- conditions:
|
- conditions:
|
||||||
@ -1066,7 +1073,7 @@ script:
|
|||||||
data:
|
data:
|
||||||
datetime: >
|
datetime: >
|
||||||
{% from 'time.jinja' import set_datetime %}
|
{% from 'time.jinja' import set_datetime %}
|
||||||
{{ set_datetime(0,1) }}
|
{{ set_datetime(0,5) }}
|
||||||
- if:
|
- if:
|
||||||
- condition: state
|
- condition: state
|
||||||
entity_id: binary_sensor.basement_occupied
|
entity_id: binary_sensor.basement_occupied
|
||||||
|
Reference in New Issue
Block a user