New jinja template for current hours/minutes timestamp
This commit is contained in:
@ -24,4 +24,8 @@
|
|||||||
|
|
||||||
{% macro read_time_from_calendar(calendar,start_or_end) %}
|
{% macro read_time_from_calendar(calendar,start_or_end) %}
|
||||||
{{ as_timestamp(strptime(state_attr(calendar,start_or_end), '%Y-%m-%d %H:%M:%S')) | timestamp_custom("%I:%M %p") }}
|
{{ as_timestamp(strptime(state_attr(calendar,start_or_end), '%Y-%m-%d %H:%M:%S')) | timestamp_custom("%I:%M %p") }}
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
|
{% macro ct() %}
|
||||||
|
{{ ((now().hour * 60 + now().minute) * 60 ) }}
|
||||||
{% endmacro %}
|
{% endmacro %}
|
@ -183,7 +183,8 @@ script:
|
|||||||
- if:
|
- if:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: >
|
value_template: >
|
||||||
{% set ct = ((now().hour * 60 + now().minute) * 60 ) %}
|
{% from 'time.jinja' import ct %}
|
||||||
|
{% set ct = ct() | int %}
|
||||||
{{ ct >= state_attr('input_datetime.kallen_bedtime','timestamp') }}
|
{{ ct >= state_attr('input_datetime.kallen_bedtime','timestamp') }}
|
||||||
then:
|
then:
|
||||||
- service: script.speech_engine
|
- service: script.speech_engine
|
||||||
@ -209,7 +210,8 @@ script:
|
|||||||
- if:
|
- if:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: >
|
value_template: >
|
||||||
{% set ct = ((now().hour * 60 + now().minute) * 60 ) %}
|
{% from 'time.jinja' import ct %}
|
||||||
|
{% set ct = ct() | int %}
|
||||||
{{ ct >= state_attr('input_datetime.kallen_bedtime','timestamp') }}
|
{{ ct >= state_attr('input_datetime.kallen_bedtime','timestamp') }}
|
||||||
then:
|
then:
|
||||||
- service: script.speech_engine
|
- service: script.speech_engine
|
||||||
@ -229,7 +231,8 @@ script:
|
|||||||
- if:
|
- if:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: >
|
value_template: >
|
||||||
{% set ct = ((now().hour * 60 + now().minute) * 60 ) %}
|
{% from 'time.jinja' import ct %}
|
||||||
|
{% set ct = ct() | int %}
|
||||||
{{ ct >= state_attr('input_datetime.kallen_bedtime','timestamp') }}
|
{{ ct >= state_attr('input_datetime.kallen_bedtime','timestamp') }}
|
||||||
then:
|
then:
|
||||||
- service: script.speech_engine
|
- service: script.speech_engine
|
||||||
|
@ -621,7 +621,8 @@ script:
|
|||||||
entity_id: input_datetime.morning_alarm_disarm
|
entity_id: input_datetime.morning_alarm_disarm
|
||||||
data:
|
data:
|
||||||
time: >
|
time: >
|
||||||
{% set ct = ((now().hour * 60 + now().minute) * 60 ) %}
|
{% from 'time.jinja' import ct %}
|
||||||
|
{% set ct = ct() | int %}
|
||||||
{% if is_state('input_boolean.work_today','on') and is_state('input_boolean.kallen_school_today','on') %}
|
{% if is_state('input_boolean.work_today','on') and is_state('input_boolean.kallen_school_today','on') %}
|
||||||
{% if ct > state_attr('input_datetime.kallen_school_day_start','timestamp') %}
|
{% if ct > state_attr('input_datetime.kallen_school_day_start','timestamp') %}
|
||||||
{{ (state_attr('input_datetime.tina_workday_start','timestamp') - 1800) | timestamp_custom('%H:%M', false) }}
|
{{ (state_attr('input_datetime.tina_workday_start','timestamp') - 1800) | timestamp_custom('%H:%M', false) }}
|
||||||
@ -643,7 +644,8 @@ script:
|
|||||||
entity_id: input_datetime.morning_alarm_rearm
|
entity_id: input_datetime.morning_alarm_rearm
|
||||||
data:
|
data:
|
||||||
time: >
|
time: >
|
||||||
{% set ct = ((now().hour * 60 + now().minute) * 60 ) %}
|
{% from 'time.jinja' import ct %}
|
||||||
|
{% set ct = ct() | int %}
|
||||||
{% if is_state('input_boolean.work_today','on') and is_state('input_boolean.kallen_school_today','off') %}
|
{% if is_state('input_boolean.work_today','on') and is_state('input_boolean.kallen_school_today','off') %}
|
||||||
{{ (state_attr('input_datetime.tina_workday_start','timestamp') + 900) | timestamp_custom('%H:%M', false) }}
|
{{ (state_attr('input_datetime.tina_workday_start','timestamp') + 900) | timestamp_custom('%H:%M', false) }}
|
||||||
{% elif is_state('input_boolean.kallen_school_today','on') and is_state('input_boolean.work_today','off') %}
|
{% elif is_state('input_boolean.kallen_school_today','on') and is_state('input_boolean.work_today','off') %}
|
||||||
|
Reference in New Issue
Block a user