another minor update #1141

This commit is contained in:
CCOSTAN 2024-09-18 17:51:15 +00:00
parent 374bbcf312
commit 16164f93f7
2 changed files with 4 additions and 1 deletions

View File

@ -6,8 +6,10 @@
"6/14": "Flag Day", "6/14": "Flag Day",
"7/4": "Independence Day", "7/4": "Independence Day",
"7/27": "National Korean War Veterans Armistice Day", "7/27": "National Korean War Veterans Armistice Day",
"9/11": "Patriot Day",
"9/17": "Constitution Day", "9/17": "Constitution Day",
"10/27": "Navy Day", "10/27": "Navy Day",
"11/11": "Veterans Day",
"12/7": "Pearl Harbor Remembrance Day" "12/7": "Pearl Harbor Remembrance Day"
}, },
"dynamic": { "dynamic": {

View File

@ -48,13 +48,14 @@ sensor:
scan_interval: 14400 scan_interval: 14400
value_template: >- value_template: >-
{%- set now_string = now().strftime('%m/%d') %} {%- set now_string = now().strftime('%m/%d') %}
{%- set now_full_string = now().strftime('%m/%d/%Y') %}
{% set static_days = value_json.Flag_Days_US.static %} {% set static_days = value_json.Flag_Days_US.static %}
{% set dynamic_days = value_json.Flag_Days_US.dynamic %} {% set dynamic_days = value_json.Flag_Days_US.dynamic %}
{% if static_days is defined and now_string in static_days %} {% if static_days is defined and now_string in static_days %}
True True
{% elif dynamic_days is defined %} {% elif dynamic_days is defined %}
{% for day_val in dynamic_days %} {% for day_val in dynamic_days %}
{% if day_val.date == now_string %} {% if day_val.date == now_full_string %}
True True
{% endif %} {% endif %}
{% endfor %} {% endfor %}