Made datetime increment macro capable of using minutes
This commit is contained in:
@ -38,8 +38,12 @@
|
|||||||
{{ 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 %}
|
{% endmacro %}
|
||||||
|
|
||||||
{% macro increment_datetime_from_now(hours) %}
|
{% macro increment_datetime_from_now(hours,minutes) %}
|
||||||
|
{% if minutes is defined %}
|
||||||
|
{{ (as_timestamp(now()) + (((hours * 60) * 60) + (minutes * 60))) | int | timestamp_custom('%Y-%m-%d %H:%M:%S') }}
|
||||||
|
{% else %}
|
||||||
{{ (as_timestamp(now()) + ((hours* 60) * 60)) | int | timestamp_custom('%Y-%m-%d %H:%M:%S') }}
|
{{ (as_timestamp(now()) + ((hours* 60) * 60)) | int | timestamp_custom('%Y-%m-%d %H:%M:%S') }}
|
||||||
|
{% endif %}
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
{% macro ct() %}
|
{% macro ct() %}
|
||||||
|
@ -465,7 +465,7 @@ script:
|
|||||||
data:
|
data:
|
||||||
datetime: >
|
datetime: >
|
||||||
{% from 'time.jinja' import increment_datetime_from_now %}
|
{% from 'time.jinja' import increment_datetime_from_now %}
|
||||||
{{ increment_datetime_from_now(0.5) }}
|
{{ increment_datetime_from_now(0,30) }}
|
||||||
- service: script.text_notify
|
- service: script.text_notify
|
||||||
data:
|
data:
|
||||||
who: parents
|
who: parents
|
||||||
@ -553,7 +553,7 @@ script:
|
|||||||
data:
|
data:
|
||||||
datetime: >
|
datetime: >
|
||||||
{% from 'time.jinja' import increment_datetime_from_now %}
|
{% from 'time.jinja' import increment_datetime_from_now %}
|
||||||
{{ increment_datetime_from_now(0.5) }}
|
{{ increment_datetime_from_now(0,30) }}
|
||||||
- service: script.text_notify
|
- service: script.text_notify
|
||||||
data:
|
data:
|
||||||
who: parents
|
who: parents
|
||||||
|
Reference in New Issue
Block a user