Still working on E's sleep info...
This commit is contained in:
@ -1,11 +1,10 @@
|
|||||||
{% macro emma_sleep() %}
|
{% macro emma_sleep() %}
|
||||||
{% from 'time.jinja' import input_datetime_12hr_with_date %}
|
{% from 'time.jinja' import input_datetime_12hr_with_date %}
|
||||||
|
{% from 'easy_time.jinja' import custom_time %}
|
||||||
{% 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 current = as_timestamp(now()) | int %}
|
{% set current = as_timestamp(now()) | int %}
|
||||||
{% set diff = (wakeup - asleep) | int %}
|
{% set diff = (wakeup - asleep) | int %}
|
||||||
{% set nowHour = (current - asleep) | timestamp_custom("%-H", false) %}
|
|
||||||
{% set nowMin = (current - asleep) | timestamp_custom("%-M", false) %}
|
|
||||||
{% set hour = diff | timestamp_custom('%-H', false) | int %}
|
{% set hour = diff | timestamp_custom('%-H', false) | int %}
|
||||||
{% set minute = diff | timestamp_custom('%-M', false) | int %}
|
{% set minute = diff | timestamp_custom('%-M', false) | int %}
|
||||||
{% set day = now().strftime("%-d") %}
|
{% set day = now().strftime("%-d") %}
|
||||||
@ -14,7 +13,7 @@
|
|||||||
{% if is_state('input_boolean.emma_sleeping','off') and is_state('input_boolean.emma_has_napped','on') or ((asleep_day == day) and (wakeup_day == day)) %}
|
{% if is_state('input_boolean.emma_sleeping','off') and is_state('input_boolean.emma_has_napped','on') or ((asleep_day == day) and (wakeup_day == day)) %}
|
||||||
Emma napped today for {{ hour }} hours and {{ minute }} minutes. She was retrieved from her room at {{ input_datetime_12hr_with_date('input_datetime.emma_up_from_nap') }} approximately.
|
Emma napped today for {{ hour }} hours and {{ minute }} minutes. She was retrieved from her room at {{ input_datetime_12hr_with_date('input_datetime.emma_up_from_nap') }} approximately.
|
||||||
{% elif is_state('input_boolean.emma_has_napped','off') and ((asleep_day == day) and (wakeup_day != day)) and is_state('input_boolean.emma_sleeping','on') %}
|
{% elif is_state('input_boolean.emma_has_napped','off') and ((asleep_day == day) and (wakeup_day != day)) and is_state('input_boolean.emma_sleeping','on') %}
|
||||||
Emma is down for nap. She was put down at {{ input_datetime_12hr_with_date('input_datetime.emma_down_for_nap') }} approximately. She has been asleep for {{ nowHour }} hours and {{ nowMin }} minutes.
|
Emma is down for nap. She was put down at {{ input_datetime_12hr_with_date('input_datetime.emma_down_for_nap') }} approximately. She has been asleep for {{ custom_time('input_datetime.emma_down_for_nap','hour,minute') }}.
|
||||||
{% elif is_state('input_boolean.emma_sleeping','on') %}
|
{% elif is_state('input_boolean.emma_sleeping','on') %}
|
||||||
{% if is_state('binary_sensor.early_night_mode','on') %}
|
{% if is_state('binary_sensor.early_night_mode','on') %}
|
||||||
Emma is asleep for the night.
|
Emma is asleep for the night.
|
||||||
@ -27,13 +26,12 @@
|
|||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
{% macro emma_sleep_notification() %}
|
{% macro emma_sleep_notification() %}
|
||||||
{% from 'time.jinja' import input_datetime_12hr_with_date, current_time_12hr %}
|
{% from 'time.jinja' import input_datetime_12hr_with_date %}
|
||||||
|
{% from 'easy_time.jinja' import clock %}
|
||||||
{% 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 current = as_timestamp(now()) | int %}
|
{% set current = as_timestamp(now()) | int %}
|
||||||
{% set diff = (wakeup - asleep) | int %}
|
{% set diff = (wakeup - asleep) | int %}
|
||||||
{% set nowHour = (current - asleep) | timestamp_custom("%-H", false) %}
|
|
||||||
{% set nowMin = (current - asleep) | timestamp_custom("%-M", false) %}
|
|
||||||
{% set hour = diff | timestamp_custom('%-H', false) | int %}
|
{% set hour = diff | timestamp_custom('%-H', false) | int %}
|
||||||
{% set minute = diff | timestamp_custom('%-M', false) | int %}
|
{% set minute = diff | timestamp_custom('%-M', false) | int %}
|
||||||
{% set day = now().strftime("%-d") %}
|
{% set day = now().strftime("%-d") %}
|
||||||
@ -42,11 +40,11 @@
|
|||||||
{% if is_state('input_boolean.emma_sleeping','off') and is_state('input_boolean.emma_has_napped','on') or ((asleep_day == day) and (wakeup_day == day)) %}
|
{% if is_state('input_boolean.emma_sleeping','off') and is_state('input_boolean.emma_has_napped','on') or ((asleep_day == day) and (wakeup_day == day)) %}
|
||||||
Emma has awoken. She napped today for {{ hour }} hours and {{ minute }} minutes. She was retrieved from her room at {{ input_datetime_12hr_with_date('input_datetime.emma_up_from_nap') }}
|
Emma has awoken. She napped today for {{ hour }} hours and {{ minute }} minutes. She was retrieved from her room at {{ input_datetime_12hr_with_date('input_datetime.emma_up_from_nap') }}
|
||||||
{% elif is_state('input_boolean.emma_has_napped','off') and is_state('input_boolean.emma_sleeping','off') and ((asleep_day != day) or (wakeup_day != day)) %}
|
{% elif is_state('input_boolean.emma_has_napped','off') and is_state('input_boolean.emma_sleeping','off') and ((asleep_day != day) or (wakeup_day != day)) %}
|
||||||
Emma has awoken for the day at {{ current_time_12hr() }}
|
Emma has awoken for the day at {{ clock('12-hr') }}
|
||||||
{% elif is_state('input_boolean.emma_has_napped','off') and ((asleep_day == day) and (wakeup_day != day)) and is_state('input_boolean.emma_sleeping','on') %}
|
{% elif is_state('input_boolean.emma_has_napped','off') and ((asleep_day == day) and (wakeup_day != day)) and is_state('input_boolean.emma_sleeping','on') %}
|
||||||
Emma is being put down for nap. She was put down at {{ input_datetime_12hr_with_date('input_datetime.emma_down_for_nap') }}
|
Emma is being put down for nap. She was put down at {{ input_datetime_12hr_with_date('input_datetime.emma_down_for_nap') }}
|
||||||
{% elif is_state('input_boolean.emma_sleeping','on') %}
|
{% elif is_state('input_boolean.emma_sleeping','on') %}
|
||||||
Emma is asleep for the night (or at least, her sleep switch is active) at {{ current_time_12hr() }}
|
Emma is asleep for the night (or at least, her sleep switch is active) at {{ clock('12-hr') }}
|
||||||
{% else %}
|
{% else %}
|
||||||
This notification is confused and should not be here. Blame Tony.
|
This notification is confused and should not be here. Blame Tony.
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Reference in New Issue
Block a user