Last active
May 22, 2021 10:00
-
-
Save oldgitdaddy/a65eacd0205b1f9ef1f20548da71fdcf to your computer and use it in GitHub Desktop.
Sensor informing you if there is a DWD warning NOW!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {% set dwd_warning = namespace(found=false)%} | |
| {% if state_attr('sensor.dwd_weather_warnings_current_warning_level', 'warning_count') > 0 %} | |
| {% for i in range(1, state_attr('sensor.dwd_weather_warnings_current_warning_level', 'warning_count')+1) %} | |
| {% set start = as_timestamp(state_attr('sensor.dwd_weather_warnings_current_warning_level', 'warning_'~i~'_start'))%} | |
| {% set end = as_timestamp(state_attr('sensor.dwd_weather_warnings_current_warning_level', 'warning_'~i~'_end'))%} | |
| {% if start < as_timestamp(now()) < as_timestamp(now()) < end %} | |
| {% set dwd_warning.found = true %} | |
| {%endif%} | |
| {%endfor%} | |
| {%endif%} | |
| {{dwd_warning.found}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment