diff --git a/custom_templates/status.jinja b/custom_templates/status.jinja index bf67387..8a1f5ad 100644 --- a/custom_templates/status.jinja +++ b/custom_templates/status.jinja @@ -1,5 +1,5 @@ {% macro emma_sleep() %} -{% from 'time.jinja' import input_datetime_12hr_with_date %} +{% from 'time.jinja' import input_datetime_12hr_with_date, input_datetime_12hr %} {% from 'easy_time.jinja' import custom_time, custom_time_between %} {% set asleep = state_attr('input_datetime.emma_down_for_nap','timestamp') | int %} {% set wakeup = state_attr('input_datetime.emma_up_from_nap','timestamp') | int %} @@ -17,7 +17,7 @@ Emma has not yet awoken for the day. {% endif %} {% else %} - Emma is awake, and does not appear to have napped yet today. + Emma is awake, and does not appear to have napped yet. She woke up at {{ input_datetime_12hr('input_datetime.emma_wakeup') }} today. {% endif %} {% endmacro %} @@ -54,8 +54,6 @@ '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 %} - There are no further notifications scheduled for him today. {% endif %} {% endif %} {% endmacro %} @@ -95,8 +93,6 @@ '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', ] | random }} {{ input_datetime_12hr('input_datetime.kallen_morning_meds_notify') }} today. - {% else %} - There are no further notifications scheduled for him today. {% endif %} {% endif %} {% endif %} diff --git a/custom_templates/time.jinja b/custom_templates/time.jinja index c81ad53..a22153a 100644 --- a/custom_templates/time.jinja +++ b/custom_templates/time.jinja @@ -2,12 +2,12 @@ {{ (states(input_number)) | int * 60 }} {% endmacro %} -{% macro current_time_12hr() %} +{% macro current_time(hr) %} +{% if hr == 12 %} {{ now().strftime('%-I:%M %p') }} -{% endmacro %} - -{% macro current_time_24hr() %} +{% elif hr == 24 %} {{ now().strftime('%H:%M') }} +{% endif %} {% endmacro %} {% macro current_date_input() %} diff --git a/packages/emmalynn.yaml b/packages/emmalynn.yaml index bf0e7d8..4b8a211 100644 --- a/packages/emmalynn.yaml +++ b/packages/emmalynn.yaml @@ -682,6 +682,17 @@ script: # Lighting - variables: brightness: "{{ state_attr('switch.adaptive_lighting_emma_bedroom','brightness_pct') }}" + - if: + - condition: template + value_template: "{{ is_state('binary_sensor.morning','on') or is_state('binary_sensor.midday','on') }}" + then: + - service: input_datetime.set_datetime + target: + entity_id: input_datetime.emma_wakeup + data: + time: > + {% from 'time.jinja' import current_time %} + {{ current_time(24) }} - if: - condition: state entity_id: binary_sensor.early_night_mode diff --git a/templates/speech/kallen_morning_briefing.yaml b/templates/speech/kallen_morning_briefing.yaml index 4a0d0d0..ef1a342 100644 --- a/templates/speech/kallen_morning_briefing.yaml +++ b/templates/speech/kallen_morning_briefing.yaml @@ -1,7 +1,7 @@ > {# Kallen Morning Briefing #} {%- macro getReport() -%} - {% from 'time.jinja' import current_time_12hr, current_date_readout, input_datetime_12hr %} + {% from 'time.jinja' import current_time, current_date_readout, input_datetime_12hr %} {% from 'speech.jinja' import dadjoke, inspirational_quote %} {% from 'easy_time.jinja' import count_the_day, custom_time %}

@@ -10,7 +10,7 @@ {% if is_state('binary_sensor.morning','on') %} Today is {{ current_date_readout() }}. {% else %} - It is {{ current_time_12hr() }}. + It is {{ current_time(12) }}. {% endif %} {% if is_state('sensor.anniversary_kallen_s_birthday', '0') %}