[solved] Output is not grouped and is displayed incorrectly

hi :wink:

I would like to output corresponding messages when an event exists. This works quite well for the first event.

As soon as another alarm comes, the display becomes strange and I don’t know how to fix it.

my code:

      - type: markdown
        content: >
          {% if
          states.sensor.dwd_weather_warnings_hamburg_eimsbuttel_aktuelle_warnstufe.state
          != 'unknown' %}
              {% set warning_description = state_attr('sensor.dwd_weather_warnings_hamburg_eimsbuttel_aktuelle_warnstufe', 'warning_1_description') %}
              {% if warning_description is defined and warning_description != None %}
                  <ha-alert alert-type="error">Aktuelle Wetterwarnung: {{ warning_description }}</ha-alert> 
              {% endif %}
          {% endif %}


          {% if
          states.sensor.dwd_weather_warnings_hamburg_eimsbuttel_aktuelle_warnstufe.state
          != 'unknown' %}
              {% set warning_instruction = state_attr('sensor.dwd_weather_warnings_hamburg_eimsbuttel_aktuelle_warnstufe', 'warning_1_instruction') %}
              {% if warning_instruction is defined and warning_instruction != None %}
                  <ha-alert alert-type="error">Hinweise: {{ warning_instruction }}</ha-alert> 
              {% endif %}
          {% endif %}

This is the output:

grafik

I would be delighted if someone could point me in the right direction. Unfortunately, I can’t figure it out. But I’m not a coder either :wink:

Solved by a buddy

Post the solution if you want to mark something as a solution. Otherwise don’t mark it if you don’t plan to post the solution.