Can someone lend me a hand on helping me possibly fix some template errors showing in my logs? I'm not really sure how to fix these. (I'm somewhat new to home assistant)

Hello all, I am using a weatheralerts package in which I will paste the github project below.

The template package I am using is linked here (it is identical in my setup):

I am also posting the screenshot of the gui in the Logs section of home assistant and a code paste of the 2 errors below that.

Thank you all in advance for any help you can give me or anything you can teach me.

Also, one last question may be, I would love to fix these if possible, but worst case, is there a way we can hide them if we determine its just too much work to fix?

Error 1:

TemplateError('UndefinedError: list object has no element 0') while processing template 'Template("{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %} {{ states.sensor.weatheralerts_1.attributes.alerts[0].title }} {% else %} None {% endif %}")' for attribute 'display_title' in entity 'sensor.weatheralerts_1_alert_1'
TemplateError('UndefinedError: list object has no element 0') while processing template 'Template("{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %} {{ states.sensor.weatheralerts_1.attributes.alerts[0].zoneid }} {% else %} None {% endif %}")' for attribute 'alert_zoneid' in entity 'sensor.weatheralerts_1_alert_1'
TemplateError('UndefinedError: list object has no element 0') while processing template 'Template("{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %} {% if states.sensor.weatheralerts_1.attributes.alerts[0].NWSheadline != "null" %} {{ states.sensor.weatheralerts_1.attributes.alerts[0].NWSheadline | regex_replace('\[\'','') | regex_replace('\'\]','') }}<br> {% endif %} <br>{{ states.sensor.weatheralerts_1.attributes.alerts[0].description | regex_replace('\n\n','<p>') | regex_replace('\n',' ') | regex_replace('\*','\n*') | regex_replace('<p>','\n\n') }}</ul><br> {% if states.sensor.weatheralerts_1.attributes.alerts[0].instruction != None %} {{ states.sensor.weatheralerts_1.attributes.alerts[0].instruction | regex_replace('\n\n','<p>') | regex_replace('\n',' ') | regex_replace('\*','\n*') | regex_replace('<p>','\n\n') }}<br> {% endif %} <br>Where : {{ state_attr('sensor.weatheralerts_1', 'friendly_name') }} <br>Effective: {{ states.sensor.weatheralerts_1.attributes.alerts[0].effective }} {%- if states.sensor.weatheralerts_1.attributes.alerts[0].ends != None %} <br>Ends: {{ states.sensor.weatheralerts_1.attributes.alerts[0].ends }} {%- endif %} <br>Expires: {{ states.sensor.weatheralerts_1.attributes.alerts[0].expires }} {% else %} None {% endif %}")' for attribute 'display_message' in entity 'sensor.weatheralerts_1_alert_1'
TemplateError('UndefinedError: list object has no element 0') while processing template 'Template("{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %} Attention!!! Weather alert for {{ state_attr('sensor.weatheralerts_1', 'friendly_name') }}. A {{ states.sensor.weatheralerts_1.attributes.alerts[0].title }}. {{ states.sensor.weatheralerts_1.attributes.alerts[0].NWSheadline | regex_replace('\[\'','') | regex_replace('\'\]','') | capitalize }}. {% else %} None {% endif %}")' for attribute 'spoken_title' in entity 'sensor.weatheralerts_1_alert_1'
TemplateError('UndefinedError: list object has no element 0') while processing template 'Template("{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %} {{ states.sensor.weatheralerts_1.attributes.alerts[0].description | regex_replace('\n\n','<p>') | regex_replace('\n',' ') | regex_replace('\*','\n*') | regex_replace('<p>','\n\n') }} {% if states.sensor.weatheralerts_1.attributes.alerts[0].instruction != None %} {{ states.sensor.weatheralerts_1.attributes.alerts[0].instruction | regex_replace('\n\n','<p>') | regex_replace('\n',' ') | regex_replace('\*','\n*') | regex_replace('<p>','\n\n') }} {% endif %} {% else %} None {% endif %}")' for attribute 'spoken_message' in entity 'sensor.weatheralerts_1_alert_1'

Error 2: This shows when I click "Show full logs for the error message:

2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: list object has no element 0 when rendering '{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].id }}
{% else %}
None
{% endif %}'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: list object has no element 0 when rendering '{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].event }}
{% else %}
None
{% endif %}'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: list object has no element 0 when rendering '{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].area }}
{% else %}
None
{% endif %}'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: list object has no element 0 when rendering '{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].NWSheadline | regex_replace('\[\'','') | regex_replace('\'\]','') }}
{% else %}
None
{% endif %}'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: list object has no element 0 when rendering '{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].description }}
{% else %}
None
{% endif %}'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: list object has no element 0 when rendering '{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].messageType }}
{% else %}
None
{% endif %}'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: list object has no element 0 when rendering '{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].status }}
{% else %}
None
{% endif %}'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: list object has no element 0 when rendering '{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].category }}
{% else %}
None
{% endif %}'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: list object has no element 0 when rendering '{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].urgency }}
{% else %}
None
{% endif %}'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: list object has no element 0 when rendering '{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].severity }}
{% else %}
None
{% endif %}'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: list object has no element 0 when rendering '{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].certainty }}
{% else %}
None
{% endif %}'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: list object has no element 0 when rendering '{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].response }}
{% else %}
None
{% endif %}'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: list object has no element 0 when rendering '{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].instruction }}
{% else %}
None
{% endif %}'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: list object has no element 0 when rendering '{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].sent }}
{% else %}
None
{% endif %}'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: list object has no element 0 when rendering '{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].effective }}
{% else %}
None
{% endif %}'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: list object has no element 0 when rendering '{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].onset }}
{% else %}
None
{% endif %}'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: list object has no element 0 when rendering '{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].expires }}
{% else %}
None
{% endif %}'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: list object has no element 0 when rendering '{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].title }}
{% else %}
None
{% endif %}'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: list object has no element 0 when rendering '{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].zoneid }}
{% else %}
None
{% endif %}'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: list object has no element 0 when rendering '{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{% if states.sensor.weatheralerts_1.attributes.alerts[0].NWSheadline != "null" %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].NWSheadline | regex_replace('\[\'','') | regex_replace('\'\]','') }}<br>
{% endif %}
<br>{{ states.sensor.weatheralerts_1.attributes.alerts[0].description | regex_replace('\n\n','<p>') | regex_replace('\n',' ') | regex_replace('\*','\n*') | regex_replace('<p>','\n\n') }}</ul><br>
{% if states.sensor.weatheralerts_1.attributes.alerts[0].instruction != None %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].instruction | regex_replace('\n\n','<p>') | regex_replace('\n',' ') | regex_replace('\*','\n*') | regex_replace('<p>','\n\n') }}<br>
{% endif %}
<br>Where : {{ state_attr('sensor.weatheralerts_1', 'friendly_name') }}
<br>Effective: {{ states.sensor.weatheralerts_1.attributes.alerts[0].effective }}
{%- if states.sensor.weatheralerts_1.attributes.alerts[0].ends != None %}
<br>Ends: {{ states.sensor.weatheralerts_1.attributes.alerts[0].ends }}
{%- endif %}
<br>Expires: {{ states.sensor.weatheralerts_1.attributes.alerts[0].expires }}
{% else %}
None
{% endif %}'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: list object has no element 0 when rendering '{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
Attention!!! Weather alert for {{ state_attr('sensor.weatheralerts_1', 'friendly_name') }}. A {{ states.sensor.weatheralerts_1.attributes.alerts[0].title }}. {{ states.sensor.weatheralerts_1.attributes.alerts[0].NWSheadline | regex_replace('\[\'','') | regex_replace('\'\]','') | capitalize }}.
{% else %}
None
{% endif %}'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: list object has no element 0 when rendering '{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].description | regex_replace('\n\n','<p>') | regex_replace('\n',' ') | regex_replace('\*','\n*') | regex_replace('<p>','\n\n') }}
{% if states.sensor.weatheralerts_1.attributes.alerts[0].instruction != None %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].instruction | regex_replace('\n\n','<p>') | regex_replace('\n',' ') | regex_replace('\*','\n*') | regex_replace('<p>','\n\n') }}
{% endif %}
{% else %}
None
{% endif %}'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: list object has no element 0') while processing template 'Template("{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].id }}
{% else %}
None
{% endif %}")' for attribute 'alert_id' in entity 'sensor.weatheralerts_1_alert_1'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: list object has no element 0') while processing template 'Template("{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].event }}
{% else %}
None
{% endif %}")' for attribute 'alert_event' in entity 'sensor.weatheralerts_1_alert_1'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: list object has no element 0') while processing template 'Template("{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].area }}
{% else %}
None
{% endif %}")' for attribute 'alert_area' in entity 'sensor.weatheralerts_1_alert_1'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: list object has no element 0') while processing template 'Template("{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].NWSheadline | regex_replace('\[\'','') | regex_replace('\'\]','') }}
{% else %}
None
{% endif %}")' for attribute 'alert_NWSheadline' in entity 'sensor.weatheralerts_1_alert_1'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: list object has no element 0') while processing template 'Template("{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].description }}
{% else %}
None
{% endif %}")' for attribute 'alert_description' in entity 'sensor.weatheralerts_1_alert_1'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: list object has no element 0') while processing template 'Template("{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].messageType }}
{% else %}
None
{% endif %}")' for attribute 'alert_messageType' in entity 'sensor.weatheralerts_1_alert_1'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: list object has no element 0') while processing template 'Template("{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].status }}
{% else %}
None
{% endif %}")' for attribute 'alert_status' in entity 'sensor.weatheralerts_1_alert_1'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: list object has no element 0') while processing template 'Template("{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].category }}
{% else %}
None
{% endif %}")' for attribute 'alert_category' in entity 'sensor.weatheralerts_1_alert_1'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: list object has no element 0') while processing template 'Template("{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].urgency }}
{% else %}
None
{% endif %}")' for attribute 'alert_urgency' in entity 'sensor.weatheralerts_1_alert_1'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: list object has no element 0') while processing template 'Template("{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].severity }}
{% else %}
None
{% endif %}")' for attribute 'alert_severity' in entity 'sensor.weatheralerts_1_alert_1'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: list object has no element 0') while processing template 'Template("{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].certainty }}
{% else %}
None
{% endif %}")' for attribute 'alert_certainty' in entity 'sensor.weatheralerts_1_alert_1'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: list object has no element 0') while processing template 'Template("{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].response }}
{% else %}
None
{% endif %}")' for attribute 'alert_response' in entity 'sensor.weatheralerts_1_alert_1'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: list object has no element 0') while processing template 'Template("{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].instruction }}
{% else %}
None
{% endif %}")' for attribute 'alert_instruction' in entity 'sensor.weatheralerts_1_alert_1'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: list object has no element 0') while processing template 'Template("{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].sent }}
{% else %}
None
{% endif %}")' for attribute 'alert_sent' in entity 'sensor.weatheralerts_1_alert_1'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: list object has no element 0') while processing template 'Template("{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].effective }}
{% else %}
None
{% endif %}")' for attribute 'alert_effective' in entity 'sensor.weatheralerts_1_alert_1'
2022-07-12 20:30:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: list object has no element 0') while processing template 'Template("{% if not is_state('sensor.weatheralerts_1', 'unavailable') and not is_state('sensor.weatheralerts_1', 'unknown') and is_state('sensor.weatheralerts_1_alert_1', 'on') or (is_number(states('sensor.weatheralerts_1')) and (states('sensor.weatheralerts_1')|int > 0)) %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].onset }}
{% else %}
None

I’m working on an update that will do away with the need for this complex yaml package. The weatheralerts yaml package is a piece of work that only Rube Goldberg would be proud of, and has gotten way out of control in complexity. Continuing to add more logic to catch every possible scenario that might result in an accidental processing of a blank alert array is not worth the effort since most, if not all, of these template sensors will be removed in the next release.

My recommendation is to use the Home Assistant logger integration to filter out the offending template errors until a new weatheralerts release is ready. If there isn’t a logger section in your Home Assistant configuration.yaml file, add the following code to filter out the weatheralerts template errors:

logger:
  filters:
    homeassistant.helpers.template_entity:
      - "weatheralerts"
    homeassistant.helpers.template:
      - "weatheralerts"

There is just one note I’ll make about using the logger filters for this use case…If you make any custom changes to any of the weatheralerts yaml package files and make any mistakes or have any formatting errors, the yaml package will stop working and you won’t get any hints in the log file about why it isn’t working until you remove those filters and restart Home Assistant.

For a little background on the yaml package, the main purpose for the package was to smooth out the number of alert notifications and prevent or at least greatly reduce excessive unnecessary weather alert notifications. Due to the National Weather Service alert API outages and erratic behavior at random times, I needed a way to hold and track previous alerts when the alert API wasn’t responding or wasn’t providing an accurate/full response. Previously, anytime the API had an outage, or was just experiencing some slowness, or if an alert was temporarily removed from the feed, the weather alerts would trigger notifications repeatedly for the same alert. Each little problem was solved by adding some layers of complexity onto something that started very simple, until it grew into the monstrosity it is now.

It will be fixed and greatly simplified, but I don’t have a timeframe on that right now.