Closed Tom-ahawk closed 4 years ago
Copied your code, and then it worked, : D
Here are code with event icons:
{% if not is_state('sensor.meteorologisk_alarm', '0') %}
{% for s in ['today'] %}
{% set v = state_attr('sensor.meteorologisk_alarm', s) %}
{% if v -%}
{% for d in v -%}
**<font color="red">Meteorological alarm - {{s}}</font>**
**Event:**
{%if d['event'] == 'Forestfire'%} <ha-icon icon='mdi:pine-tree'> </ha-icon> {% endif %}{%if d['event'] == 'Wind'%}<ha-icon icon='mdi:weather-windy'></ha-icon>{% endif %}{%if d['event'] == 'Snow/Ice'%}<ha-icon icon='mdi:snowflake-melt'></ha-icon>{% endif %}{%if d['event'] == 'Thunderstorm'%}<ha-icon icon='mdi:weather-lightning'></ha-icon>{% endif %}{%if d['event'] == 'Fog'%}<ha-icon icon='mdi:weather-fog'></ha-icon>{% endif %} {%if d['event'] == 'Extreame high Temp'%}<ha-icon icon='mdi:thermometer-plus'></ha-icon>{% endif %}{%if d['event'] == 'Extreame low temp'%}<ha-icon icon='mdi:thermometer-minus'></ha-icon>{% endif %}{%if d['event'] == 'Costal evenet'%}<ha-icon icon='mdi:sland'></ha-icon>{% endif %}{%if d['event'] == 'Avalances'%}<ha-icon icon='mdi:snowflake-variant'></ha-icon>{% endif %}{%if d['event'] == 'Rain'%}<ha-icon icon='mdi:weather-rainy'></ha-icon>{% endif %}{%if d['event'] == 'Flood'%}<ha-icon icon='mdi:waves'></ha-icon>{% endif %}{%if d['event'] == 'Rain-Flood'%}<ha-icon icon='mdi:weather-pouring'></ha-icon>{% endif %}{{d['event']}}
**Severity:**
{{d['code']}}
**Time:**
{{d['start']}} - {{d['end']}}
**Description:**
{{d['norsk']}}
{% endfor %}
{% endif %}
{% endfor -%}
{% endif %}
Using your code in a markdown card. Today looks OK, but tomorrow is not displayed correctly. Any ideas why?