Try to fix the Flag sensor.
This commit is contained in:
parent
595fabdb84
commit
0d889da2b6
|
@ -39,14 +39,14 @@ sensor:
|
||||||
{{ holiday }}
|
{{ holiday }}
|
||||||
|
|
||||||
- platform: rest
|
- platform: rest
|
||||||
resource: http://www.webcal.fi/cal.php?id=335&format=json&start_year=current_year&end_year=2018&tz=America%2FNew_York
|
resource: http://www.webcal.fi/cal.php?id=335&format=json&start_year=current_year&end_year=2020&tz=America%2FNew_York
|
||||||
name: Flag
|
name: Flag
|
||||||
scan_interval: 14400
|
scan_interval: 14400
|
||||||
value_template: >-
|
value_template: >-
|
||||||
{% set is_flag_day = False %}
|
{% set is_flag_day = False %}
|
||||||
{%- for day_val in value_json -%}
|
{%- for day_val in value_json -%}
|
||||||
{% set now_string = now().strftime('%Y-%m-%d') %}
|
{% set now_string = now().strftime('%Y-%m-%d') %}
|
||||||
{%- if day_val.date == now_string and day_val.flag_day == 1-%}
|
{%- if day_val.date==now_string and day_val.flag_day==1 -%}
|
||||||
{% set is_flag_day = True %}
|
{% set is_flag_day = True %}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
Loading…
Reference in New Issue