Hello everyone,
I have a question: I have the DWD weather warning with the Markdown card.
Als Code nutze ich das hier:
{% set current_count = state_attr("sensor.stadt_pleidelsheim_aktuelle_warnstufe", "warning_count") %}
{% set advance_count = state_attr("sensor.stadt_pleidelsheim_vorwarnstufe", "warning_count") %}
{% if ((current_count == 0 or current_count == None) and (advance_count == 0 or advance_count == None)) %}
**<font color=#44739e>Keine Warnungen</font>**
{% else %}
{% for i in range(current_count) %}
{% set headline = state_attr("sensor.stadt_pleidelsheim_aktuelle_warnstufe", "warning_" ~ loop.index ~ "_headline") %}
{% set description = state_attr("sensor.stadt_pleidelsheim_aktuelle_warnstufe", "warning_" ~ loop.index ~ "_description") %}
{% set level = state_attr("sensor.stadt_pleidelsheim_aktuelle_warnstufe", "warning_" ~ loop.index ~ "_level") %}
{% set time_start = state_attr("sensor.stadt_pleidelsheim_aktuelle_warnstufe", "warning_" ~ loop.index ~ "_start") | as_timestamp %}
{% set weekday_start = time_start | timestamp_custom("%w", True) | int %}
{% set time_end = state_attr("sensor.stadt_pleidelsheim_aktuelle_warnstufe", "warning_" ~ loop.index ~ "_end") | as_timestamp %}
{% set weekday_end = time_end | timestamp_custom("%w", True) | int %}
**<font color=#fdd835>{{ headline }}</font>**
*<font color=gray>{{ ['Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag','Sonntag'][weekday_start-1] ~ ", " ~ time_start | timestamp_custom("%H:%M") ~ " - " ~ ['Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag','Sonntag'][weekday_end-1] ~ ", " ~ time_end | timestamp_custom("%H:%M") }}</font>*
{{ description|trim }}
{% if not loop.last %}
***
{% endif %}
{% endfor %}
{% if ((current_count != 0) and (advance_count != 0)) %}{% endif %}
{% for i in range(advance_count) %}
{% set headline = state_attr("sensor.stadt_pleidelsheim_vorwarnstufe", "warning_" ~ loop.index ~ "_headline") %}
{% set description = state_attr("sensor.stadt_pleidelsheim_vorwarnstufe", "warning_" ~ loop.index ~ "_description") %}
{% set level = state_attr("sensor.stadt_pleidelsheim_vorwarnstufe", "warning_" ~ loop.index ~ "_level") %}
{% set time_start = state_attr("sensor.stadt_pleidelsheim_vorwarnstufe", "warning_" ~ loop.index ~ "_start") | as_timestamp%}
{% set weekday_start = time_start | timestamp_custom("%w", True) | int %}
{% set time_end = state_attr("sensor.stadt_pleidelsheim_vorwarnstufe", "warning_" ~ loop.index ~ "_end") | as_timestamp %}
{% set weekday_end = time_end | timestamp_custom("%w", True) | int %}
**<font color=#fdd835>{{ headline }}</font>**
*<font color=gray>{{ ['Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag','Sonntag'][weekday_start-1] ~ ", " ~ time_start | timestamp_custom("%H:%M") ~ " - " ~ ['Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag','Sonntag'][weekday_end-1] ~ ", " ~ time_end | timestamp_custom("%H:%M") }}</font>*
{{ description|trim }}
{% if not loop.last %}
***
{% endif %}
{% endfor %}
{% endif %}
This also works very well and shows the current weather warnings.
Now I would like to do some automation. If a certain word (e.g. frost) appears in the text of the weather warnings, then I want to control something. Can someone tell me how I can query this? With the DWD extension I can only see the warning levels and no text.
Thanks in advance for your assistance