From 3bcaeac28a144c7f480702d5028f95930e85a79b Mon Sep 17 00:00:00 2001 From: ccostan Date: Thu, 10 Jan 2019 15:32:07 -0500 Subject: [PATCH] Closes #394 - Thanks @SILVRRGIT for fixing and closing this issue. (til 2025!) lol --- config/packages/holiday.yaml | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/config/packages/holiday.yaml b/config/packages/holiday.yaml index 122bda71..7212c4c4 100755 --- a/config/packages/holiday.yaml +++ b/config/packages/holiday.yaml @@ -38,19 +38,17 @@ sensor: {% endif %} {{ holiday }} - # - platform: rest - # resource: http://www.webcal.fi/cal.php?id=335&format=json&start_year=current_year&end_year=2020&tz=America%2FNew_York - # name: Flag - # scan_interval: 14400 - # value_template: >- - # {% set is_flag_day = False %} - # {%- for day_val in value_json -%} - # {% set now_string = now().strftime('%Y-%m-%d') %} - # {%- if day_val.date==now_string and day_val.flag_day==1 -%} - # {% set is_flag_day = True %} - # {%- endif -%} - # {% endfor %} - # {{is_flag_day}} + - platform: rest + resource: http://www.webcal.fi/cal.php?id=335&format=json&start_year=current_year&end_year=current_year&tz=America%2FNew_York + name: Flag + scan_interval: 14400 + value_template: >- + {%- set now_string = now().strftime('%Y-%m-%d') %} + {% for day_val in value_json if day_val.date == now_string %} + True + {% else %} + False + {% endfor -%} ############################################################################### # Automation that notifies of a Holiday "state" change