Consolidate set/read from calendars into one macro
This commit is contained in:
@ -38,12 +38,12 @@
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro set_time_from_calendar(calendar,start_or_end) %}
|
||||
{% macro time_from_calendar(calendar,start_or_end,action) %}
|
||||
{% if action == 'set' %}
|
||||
{{ as_timestamp(strptime(state_attr(calendar,start_or_end), '%Y-%m-%d %H:%M:%S')) | timestamp_custom("%H:%M") }}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro read_time_from_calendar(calendar,start_or_end) %}
|
||||
{% elif action == 'read' %}
|
||||
{{ as_timestamp(strptime(state_attr(calendar,start_or_end), '%Y-%m-%d %H:%M:%S')) | timestamp_custom("%-I:%M %p") }}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro set_datetime(hours,minutes,seconds) %}
|
||||
|
Reference in New Issue
Block a user