Consolidate set/read from calendars into one macro

This commit is contained in:
2023-06-02 14:14:04 -04:00
parent 6b29933088
commit e686283884
7 changed files with 20 additions and 20 deletions

View File

@ -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) %}