custom-components / weatheralerts

A sensor that gives you weather alerts from alerts.weather.gov.
MIT License
127 stars 15 forks source link

Huge number of errors in Home Assistant log when there are no active alerts for my area #65

Open wtstreetglow opened 2 years ago

wtstreetglow commented 2 years ago

Version of the custom_component

v0.1.2

Describe the bug Huge number of errors in Home Assistant log when there are no active alerts for my area. Just checking to make sure this is working properly. I have been getting alerts and this was the first instance I have seen in my area with no alerts. (First few days of having this installed, we had a air quality alerts). When this alert went away and our area had no alerts, the errors were produced in the log. Is there a way to supress these if this is not really a fixable situation?

Log

2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: list object has no element 0 when rendering '{% if (states('sensor.weatheralerts') != 'unavailable') and (state_attr('sensor.weatheralerts', 'alerts')[0] != null) or ((states('sensor.weatheralerts') == 'unavailable') and (as_timestamp(state_attr('sensor.weatheralerts', 'alerts')[0].endsExpires) - as_timestamp(now()) > 0)) %}
on
{% else %}
off
{% endif %}'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: list object has no element 0') while processing template 'Template("{% if (states('sensor.weatheralerts') != 'unavailable') and (state_attr('sensor.weatheralerts', 'alerts')[0] != null) or ((states('sensor.weatheralerts') == 'unavailable') and (as_timestamp(state_attr('sensor.weatheralerts', 'alerts')[0].endsExpires) - as_timestamp(now()) > 0)) %}
on
{% else %}
off
{% endif %}")' for attribute '_attr_native_value' in entity 'sensor.weatheralerts_alert_1'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].id }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].id }}
{% else %}
None
{% endif %}")' for attribute 'alert_id' in entity 'sensor.weatheralerts_alert_1'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].event }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].event }}
{% else %}
None
{% endif %}")' for attribute 'alert_event' in entity 'sensor.weatheralerts_alert_1'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].area }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].area }}
{% else %}
None
{% endif %}")' for attribute 'alert_area' in entity 'sensor.weatheralerts_alert_1'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].NWSheadline | regex_replace('\[\'','') | regex_replace('\'\]','') }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].NWSheadline | regex_replace('\[\'','') | regex_replace('\'\]','') }}
{% else %}
None
{% endif %}")' for attribute 'alert_NWSheadline' in entity 'sensor.weatheralerts_alert_1'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].description }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].description }}
{% else %}
None
{% endif %}")' for attribute 'alert_description' in entity 'sensor.weatheralerts_alert_1'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].messageType }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].messageType }}
{% else %}
None
{% endif %}")' for attribute 'alert_messageType' in entity 'sensor.weatheralerts_alert_1'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].status }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].status }}
{% else %}
None
{% endif %}")' for attribute 'alert_status' in entity 'sensor.weatheralerts_alert_1'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].category }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].category }}
{% else %}
None
{% endif %}")' for attribute 'alert_category' in entity 'sensor.weatheralerts_alert_1'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].urgency }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].urgency }}
{% else %}
None
{% endif %}")' for attribute 'alert_urgency' in entity 'sensor.weatheralerts_alert_1'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].severity }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].severity }}
{% else %}
None
{% endif %}")' for attribute 'alert_severity' in entity 'sensor.weatheralerts_alert_1'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].certainty }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].certainty }}
{% else %}
None
{% endif %}")' for attribute 'alert_certainty' in entity 'sensor.weatheralerts_alert_1'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].response }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].response }}
{% else %}
None
{% endif %}")' for attribute 'alert_response' in entity 'sensor.weatheralerts_alert_1'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].instruction }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].instruction }}
{% else %}
None
{% endif %}")' for attribute 'alert_instruction' in entity 'sensor.weatheralerts_alert_1'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].sent }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].sent }}
{% else %}
None
{% endif %}")' for attribute 'alert_sent' in entity 'sensor.weatheralerts_alert_1'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].effective }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].effective }}
{% else %}
None
{% endif %}")' for attribute 'alert_effective' in entity 'sensor.weatheralerts_alert_1'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].onset }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].onset }}
{% else %}
None
{% endif %}")' for attribute 'alert_onset' in entity 'sensor.weatheralerts_alert_1'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].expires }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].expires }}
{% else %}
None
{% endif %}")' for attribute 'alert_expires' in entity 'sensor.weatheralerts_alert_1'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].title }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].title }}
{% else %}
None
{% endif %}")' for attribute 'alert_title' in entity 'sensor.weatheralerts_alert_1'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].title }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].title }}
{% else %}
None
{% endif %}")' for attribute 'display_title' in entity 'sensor.weatheralerts_alert_1'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].zoneid }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].zoneid }}
{% else %}
None
{% endif %}")' for attribute 'alert_zoneid' in entity 'sensor.weatheralerts_alert_1'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{% if states.sensor.weatheralerts.attributes.alerts[0].NWSheadline != "null" %}
{{ states.sensor.weatheralerts.attributes.alerts[0].NWSheadline | regex_replace('\[\'','') | regex_replace('\'\]','') }}<br>
{% endif %}
<br>{{ states.sensor.weatheralerts.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.attributes.alerts[0].instruction != None %}
{{ states.sensor.weatheralerts.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', 'friendly_name') }}
<br>Effective: {{ states.sensor.weatheralerts.attributes.alerts[0].effective }}
{%- if states.sensor.weatheralerts.attributes.alerts[0].ends != None %}
<br>Ends: {{ states.sensor.weatheralerts.attributes.alerts[0].ends }}
{%- endif %}
<br>Expires: {{ states.sensor.weatheralerts.attributes.alerts[0].expires }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{% if states.sensor.weatheralerts.attributes.alerts[0].NWSheadline != "null" %}
{{ states.sensor.weatheralerts.attributes.alerts[0].NWSheadline | regex_replace('\[\'','') | regex_replace('\'\]','') }}<br>
{% endif %}
<br>{{ states.sensor.weatheralerts.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.attributes.alerts[0].instruction != None %}
{{ states.sensor.weatheralerts.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', 'friendly_name') }}
<br>Effective: {{ states.sensor.weatheralerts.attributes.alerts[0].effective }}
{%- if states.sensor.weatheralerts.attributes.alerts[0].ends != None %}
<br>Ends: {{ states.sensor.weatheralerts.attributes.alerts[0].ends }}
{%- endif %}
<br>Expires: {{ states.sensor.weatheralerts.attributes.alerts[0].expires }}
{% else %}
None
{% endif %}")' for attribute 'display_message' in entity 'sensor.weatheralerts_alert_1'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
Attention!!! Weather alert for {{ state_attr('sensor.weatheralerts', 'friendly_name') }}. A {{ states.sensor.weatheralerts.attributes.alerts[0].title }}. {{ states.sensor.weatheralerts.attributes.alerts[0].NWSheadline | regex_replace('\[\'','') | regex_replace('\'\]','') | capitalize }}.
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
Attention!!! Weather alert for {{ state_attr('sensor.weatheralerts', 'friendly_name') }}. A {{ states.sensor.weatheralerts.attributes.alerts[0].title }}. {{ states.sensor.weatheralerts.attributes.alerts[0].NWSheadline | regex_replace('\[\'','') | regex_replace('\'\]','') | capitalize }}.
{% else %}
None
{% endif %}")' for attribute 'spoken_title' in entity 'sensor.weatheralerts_alert_1'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].description | regex_replace('\n\n','<p>') | regex_replace('\n',' ') | regex_replace('\*','\n*') | regex_replace('<p>','\n\n') }}
{% if states.sensor.weatheralerts.attributes.alerts[0].instruction != None %}
{{ states.sensor.weatheralerts.attributes.alerts[0].instruction | regex_replace('\n\n','<p>') | regex_replace('\n',' ') | regex_replace('\*','\n*') | regex_replace('<p>','\n\n') }}
{% endif %}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 0 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_1') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[0].description | regex_replace('\n\n','<p>') | regex_replace('\n',' ') | regex_replace('\*','\n*') | regex_replace('<p>','\n\n') }}
{% if states.sensor.weatheralerts.attributes.alerts[0].instruction != None %}
{{ states.sensor.weatheralerts.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_alert_1'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: list object has no element 1 when rendering '{% if (states('sensor.weatheralerts') != 'unavailable') and (state_attr('sensor.weatheralerts', 'alerts')[1] != null) or ((states('sensor.weatheralerts') == 'unavailable') and (as_timestamp(state_attr('sensor.weatheralerts', 'alerts')[1].endsExpires) - as_timestamp(now()) > 0)) %}
on
{% else %}
off
{% endif %}'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: list object has no element 1') while processing template 'Template("{% if (states('sensor.weatheralerts') != 'unavailable') and (state_attr('sensor.weatheralerts', 'alerts')[1] != null) or ((states('sensor.weatheralerts') == 'unavailable') and (as_timestamp(state_attr('sensor.weatheralerts', 'alerts')[1].endsExpires) - as_timestamp(now()) > 0)) %}
on
{% else %}
off
{% endif %}")' for attribute '_attr_native_value' in entity 'sensor.weatheralerts_alert_2'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].id }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].id }}
{% else %}
None
{% endif %}")' for attribute 'alert_id' in entity 'sensor.weatheralerts_alert_2'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].event }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].event }}
{% else %}
None
{% endif %}")' for attribute 'alert_event' in entity 'sensor.weatheralerts_alert_2'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].area }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].area }}
{% else %}
None
{% endif %}")' for attribute 'alert_area' in entity 'sensor.weatheralerts_alert_2'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].NWSheadline | regex_replace('\[\'','') | regex_replace('\'\]','') }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].NWSheadline | regex_replace('\[\'','') | regex_replace('\'\]','') }}
{% else %}
None
{% endif %}")' for attribute 'alert_NWSheadline' in entity 'sensor.weatheralerts_alert_2'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].description }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].description }}
{% else %}
None
{% endif %}")' for attribute 'alert_description' in entity 'sensor.weatheralerts_alert_2'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].messageType }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].messageType }}
{% else %}
None
{% endif %}")' for attribute 'alert_messageType' in entity 'sensor.weatheralerts_alert_2'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].status }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].status }}
{% else %}
None
{% endif %}")' for attribute 'alert_status' in entity 'sensor.weatheralerts_alert_2'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].category }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].category }}
{% else %}
None
{% endif %}")' for attribute 'alert_category' in entity 'sensor.weatheralerts_alert_2'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].urgency }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].urgency }}
{% else %}
None
{% endif %}")' for attribute 'alert_urgency' in entity 'sensor.weatheralerts_alert_2'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].severity }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].severity }}
{% else %}
None
{% endif %}")' for attribute 'alert_severity' in entity 'sensor.weatheralerts_alert_2'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].certainty }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].certainty }}
{% else %}
None
{% endif %}")' for attribute 'alert_certainty' in entity 'sensor.weatheralerts_alert_2'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].response }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].response }}
{% else %}
None
{% endif %}")' for attribute 'alert_response' in entity 'sensor.weatheralerts_alert_2'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].instruction }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].instruction }}
{% else %}
None
{% endif %}")' for attribute 'alert_instruction' in entity 'sensor.weatheralerts_alert_2'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].sent }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].sent }}
{% else %}
None
{% endif %}")' for attribute 'alert_sent' in entity 'sensor.weatheralerts_alert_2'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].effective }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].effective }}
{% else %}
None
{% endif %}")' for attribute 'alert_effective' in entity 'sensor.weatheralerts_alert_2'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].onset }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].onset }}
{% else %}
None
{% endif %}")' for attribute 'alert_onset' in entity 'sensor.weatheralerts_alert_2'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].expires }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].expires }}
{% else %}
None
{% endif %}")' for attribute 'alert_expires' in entity 'sensor.weatheralerts_alert_2'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].title }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].title }}
{% else %}
None
{% endif %}")' for attribute 'alert_title' in entity 'sensor.weatheralerts_alert_2'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].title }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].title }}
{% else %}
None
{% endif %}")' for attribute 'display_title' in entity 'sensor.weatheralerts_alert_2'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].zoneid }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].zoneid }}
{% else %}
None
{% endif %}")' for attribute 'alert_zoneid' in entity 'sensor.weatheralerts_alert_2'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{% if states.sensor.weatheralerts.attributes.alerts[1].NWSheadline != "null" %}
{{ states.sensor.weatheralerts.attributes.alerts[1].NWSheadline | regex_replace('\[\'','') | regex_replace('\'\]','') }}<br>
{% endif %}
<br>{{ states.sensor.weatheralerts.attributes.alerts[1].description | regex_replace('\n\n','<p>') | regex_replace('\n',' ') | regex_replace('\*','\n*') | regex_replace('<p>','\n\n') }}</ul><br>
{% if states.sensor.weatheralerts.attributes.alerts[1].instruction != None %}
{{ states.sensor.weatheralerts.attributes.alerts[1].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', 'friendly_name') }}
<br>Effective: {{ states.sensor.weatheralerts.attributes.alerts[1].effective }}
{%- if states.sensor.weatheralerts.attributes.alerts[1].ends != None %}
<br>Ends: {{ states.sensor.weatheralerts.attributes.alerts[1].ends }}
{%- endif %}
<br>Expires: {{ states.sensor.weatheralerts.attributes.alerts[1].expires }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{% if states.sensor.weatheralerts.attributes.alerts[1].NWSheadline != "null" %}
{{ states.sensor.weatheralerts.attributes.alerts[1].NWSheadline | regex_replace('\[\'','') | regex_replace('\'\]','') }}<br>
{% endif %}
<br>{{ states.sensor.weatheralerts.attributes.alerts[1].description | regex_replace('\n\n','<p>') | regex_replace('\n',' ') | regex_replace('\*','\n*') | regex_replace('<p>','\n\n') }}</ul><br>
{% if states.sensor.weatheralerts.attributes.alerts[1].instruction != None %}
{{ states.sensor.weatheralerts.attributes.alerts[1].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', 'friendly_name') }}
<br>Effective: {{ states.sensor.weatheralerts.attributes.alerts[1].effective }}
{%- if states.sensor.weatheralerts.attributes.alerts[1].ends != None %}
<br>Ends: {{ states.sensor.weatheralerts.attributes.alerts[1].ends }}
{%- endif %}
<br>Expires: {{ states.sensor.weatheralerts.attributes.alerts[1].expires }}
{% else %}
None
{% endif %}")' for attribute 'display_message' in entity 'sensor.weatheralerts_alert_2'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
Attention!!! Weather alert for {{ state_attr('sensor.weatheralerts', 'friendly_name') }}. A {{ states.sensor.weatheralerts.attributes.alerts[1].title }}. {{ states.sensor.weatheralerts.attributes.alerts[1].NWSheadline | regex_replace('\[\'','') | regex_replace('\'\]','') | capitalize }}.
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
Attention!!! Weather alert for {{ state_attr('sensor.weatheralerts', 'friendly_name') }}. A {{ states.sensor.weatheralerts.attributes.alerts[1].title }}. {{ states.sensor.weatheralerts.attributes.alerts[1].NWSheadline | regex_replace('\[\'','') | regex_replace('\'\]','') | capitalize }}.
{% else %}
None
{% endif %}")' for attribute 'spoken_title' in entity 'sensor.weatheralerts_alert_2'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].description | regex_replace('\n\n','<p>') | regex_replace('\n',' ') | regex_replace('\*','\n*') | regex_replace('<p>','\n\n') }}
{% if states.sensor.weatheralerts.attributes.alerts[1].instruction != None %}
{{ states.sensor.weatheralerts.attributes.alerts[1].instruction | regex_replace('\n\n','<p>') | regex_replace('\n',' ') | regex_replace('\*','\n*') | regex_replace('<p>','\n\n') }}
{% endif %}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 1 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_2') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[1].description | regex_replace('\n\n','<p>') | regex_replace('\n',' ') | regex_replace('\*','\n*') | regex_replace('<p>','\n\n') }}
{% if states.sensor.weatheralerts.attributes.alerts[1].instruction != None %}
{{ states.sensor.weatheralerts.attributes.alerts[1].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_alert_2'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: list object has no element 2 when rendering '{% if (states('sensor.weatheralerts') != 'unavailable') and (state_attr('sensor.weatheralerts', 'alerts')[2] != null) or ((states('sensor.weatheralerts') == 'unavailable') and (as_timestamp(state_attr('sensor.weatheralerts', 'alerts')[2].endsExpires) - as_timestamp(now()) > 0)) %}
on
{% else %}
off
{% endif %}'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: list object has no element 2') while processing template 'Template("{% if (states('sensor.weatheralerts') != 'unavailable') and (state_attr('sensor.weatheralerts', 'alerts')[2] != null) or ((states('sensor.weatheralerts') == 'unavailable') and (as_timestamp(state_attr('sensor.weatheralerts', 'alerts')[2].endsExpires) - as_timestamp(now()) > 0)) %}
on
{% else %}
off
{% endif %}")' for attribute '_attr_native_value' in entity 'sensor.weatheralerts_alert_3'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].id }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].id }}
{% else %}
None
{% endif %}")' for attribute 'alert_id' in entity 'sensor.weatheralerts_alert_3'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].event }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].event }}
{% else %}
None
{% endif %}")' for attribute 'alert_event' in entity 'sensor.weatheralerts_alert_3'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].area }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].area }}
{% else %}
None
{% endif %}")' for attribute 'alert_area' in entity 'sensor.weatheralerts_alert_3'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].NWSheadline | regex_replace('\[\'','') | regex_replace('\'\]','') }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].NWSheadline | regex_replace('\[\'','') | regex_replace('\'\]','') }}
{% else %}
None
{% endif %}")' for attribute 'alert_NWSheadline' in entity 'sensor.weatheralerts_alert_3'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].description }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].description }}
{% else %}
None
{% endif %}")' for attribute 'alert_description' in entity 'sensor.weatheralerts_alert_3'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].messageType }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].messageType }}
{% else %}
None
{% endif %}")' for attribute 'alert_messageType' in entity 'sensor.weatheralerts_alert_3'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].status }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].status }}
{% else %}
None
{% endif %}")' for attribute 'alert_status' in entity 'sensor.weatheralerts_alert_3'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].category }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].category }}
{% else %}
None
{% endif %}")' for attribute 'alert_category' in entity 'sensor.weatheralerts_alert_3'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].urgency }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].urgency }}
{% else %}
None
{% endif %}")' for attribute 'alert_urgency' in entity 'sensor.weatheralerts_alert_3'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].severity }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].severity }}
{% else %}
None
{% endif %}")' for attribute 'alert_severity' in entity 'sensor.weatheralerts_alert_3'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].certainty }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].certainty }}
{% else %}
None
{% endif %}")' for attribute 'alert_certainty' in entity 'sensor.weatheralerts_alert_3'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].response }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].response }}
{% else %}
None
{% endif %}")' for attribute 'alert_response' in entity 'sensor.weatheralerts_alert_3'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].instruction }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].instruction }}
{% else %}
None
{% endif %}")' for attribute 'alert_instruction' in entity 'sensor.weatheralerts_alert_3'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].sent }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].sent }}
{% else %}
None
{% endif %}")' for attribute 'alert_sent' in entity 'sensor.weatheralerts_alert_3'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].effective }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].effective }}
{% else %}
None
{% endif %}")' for attribute 'alert_effective' in entity 'sensor.weatheralerts_alert_3'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].onset }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].onset }}
{% else %}
None
{% endif %}")' for attribute 'alert_onset' in entity 'sensor.weatheralerts_alert_3'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].expires }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].expires }}
{% else %}
None
{% endif %}")' for attribute 'alert_expires' in entity 'sensor.weatheralerts_alert_3'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].title }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].title }}
{% else %}
None
{% endif %}")' for attribute 'alert_title' in entity 'sensor.weatheralerts_alert_3'
2022-06-23 12:54:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].title }}
{% else %}
None
{% endif %}' but no default was specified') while processing template 'Template("{% if states('sensor.weatheralerts')|int > 2 or (states('sensor.weatheralerts') == "unavailable" and states('sensor.weatheralerts_alert_3') == "on") %}
{{ states.sensor.weatheralerts.attributes.alerts[2].title }}
{% else %}
wtstreetglow commented 2 years ago

I started a topic involving this on the home assistant forum at: https://community.home-assistant.io/t/hoping-to-get-some-guidance-on-making-my-logs-a-little-less-chatty-for-certain-error-issues/433778

jlverhagen commented 2 years ago

It looks like you probably have an outdated weatheralerts yaml package file installed. The yaml package files don't update automatically with the integration so you'll have to download and install the updated weatheralerts_1.yaml file manually. If you haven't made any custom modifications to your local weatheralerts_1.yaml file, simply download the new file and copy it over the existing file. If you did make any modifications to the yaml package, backup your existing file so you can copy your modifications from the backed up file into the new package file.

If you are still encountering log spamming from weatheralerts after installing the updated yaml package, post those log snippets and I'll see what I can do to make them unnecessary warnings and errors go away or minimize them as much as possible.

wtstreetglow commented 2 years ago

Thank you for your response here @jlverhagen. I believe Home Assistant may have been just having a bad day the day this happened. After a restart, all of these log issues went away. I installed the package around a week or so ago using weatheralerts_1 as the file for my package directory.

I follow you on the weatheralerts_1 not updating automatically and will keep that in mind for the future if I run into any issues. And thank you for the reminder of copying modifications over in case I had made any.

Thank you all for what you have built here, it is really great!

I will close this for now because everything seems to have cleared itself up. Thank you again @jlverhagen

wtstreetglow commented 2 years ago

Ok. Just to make sure I have done everything properly. I started over with "weatheralerts" on my home assistant installation. (including using the updated package file "weatheralerts_1.yaml" from the github). A few days have passed and the original log errors seem to have come back. Should I send you my "weatheralerts_1.yaml" also? I will be posting the logs shortly.

Thank you @jlverhagen for any help you can provide.

wtstreetglow commented 2 years ago

I just caught another possible issue on my end. The sensor were called weatheralerts_1 but my actual file yaml file was still "weatheralerts.yaml". Maybe this could have been causing my log issues (I don't think so though. I have now renamed the yaml to "weatheralerts_1.yaml". Lets see if the log get filled again over the next few days. Previous to this change (I'm not sure the change matters). The logs are below: LOGS.txt

I have also attached the weatheralerts_1.yaml (wasn't sure if you needed it) It begins at the line:

2022-07-06 20:00:15 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 }} weatheralerts_1.txt

wtstreetglow commented 2 years ago

Just dropping back in here to see if anyone can help with the above. I have begun a home assistant thread about this at the address linked below:

https://community.home-assistant.io/t/can-someone-lend-me-a-hand-on-helping-me-possibly-fix-some-template-errors-showing-in-my-logs-im-not-really-sure-how-to-fix-these-im-somewhat-new-to-home-assistant/439690

@jlverhagen just dropping back in here to leave the above link.

jlverhagen commented 2 years ago

It does look like one of the checks that were added earlier this year isn't fully working as intended and resulting in these errors. An additional logic check or a change to the existing checks would be needed to possibly eliminate the errors. I know the logged errors are a nuisance. My official recommendation, for now, is to add a logger filter to your Home Assistant configuration.yaml file to filter these errors from going into your log file.

If you don't have a logger: section in your configuration.yaml file, add this to your configuration.yaml:

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

If you already have a logger: section, just add the filters to the existing logger section in the configuration.yaml file. These filters will prevent the weatheralerts template related errors from being logged to the log file.

The current yaml package will be mostly, if not completely, deprecated and not needed with the next release. Much of the info in the yaml package template sensors is being moved into the integration and included in the main weather alert sensor. And some of the logic and template sensor data will be moved directly into the automations, and the automations will be turned into blueprints.

The main sticking point to getting the next release finished is finding a way to accurately track alerts and which specific alerts have triggered notifications to prevent repeat notifications for the same alerts when the National Weather Service weather alerts API decides it wants to be flaky for a little while.

wtstreetglow commented 2 years ago

Thank you for your response @jlverhagen What you have given me is very helpful. I understand on things taken time to correct so no issues there. It was just making hard for me to track down things I could possibly fix with such a large amount of entries existing within the logs.

I do have a logger section but didn't know what to put in there just yet, I am still very new to home assistant. Thank you for this again.

Wow, that's awesome with regards to the yaml package. You are very talented. Thank you for what you have created for others. It is nice to be able to hear speech about the nws alerts using the google homes I have through the house.

Ahh, I understand with regards to duplicate notifications. Yeah, I've noticed that a few times in the last bit. I couldn't figure out if the NWS was just changing the alert slightly and reposting or if it was duplicates due to flakiness.

Thank you again @jlverhagen for your help here. If you want to close this, that's no problem or if it helps you remember stuff we can leave it open. Thank you again @jlverhagen!

wtstreetglow commented 2 years ago

Hello @jlverhagen

Just wanted to see if you could help me a bit more with the logger and removing the errors showing.

I have the following in my logger

  default: error
  logs:
    homeassistant.core: warning
    homeassistant.loader: error
    homeassistant.components.recorder: error # to spot db issues
    homeassistant.config_entries: error
    homeassistant.setup: error
    homeassistant.components.roku: critical
    homeassistant.helpers.entity: critical
    homeassistant.components.automation: error
    homeassistant.components.waze_travel_time: error
    homeassistant.components.statistics.sensor: critical
    homeassistant.components.nws: error
    homeassistant.helpers.event: critical
    bellows: error
    zigpy: error
    homeassistant.components.zha.core: error
    # homeassistant.components.hassio: debug
    # homeassistant.components.cast: debug
    # pychromecast: debug
    # homeassistant.components.sonos: debug
    # pysonos: info
  filters:
    homeassistant.helpers.template_entity:
      - "weatheralerts"
    homeassistant.helpers.template:
      - "weatheralerts"
    pychromecast.socket_client:
      - "Heartbeat timeout, resetting connection"
      - "Error reading from socket"
      - "Error communicating with socket, resetting connection"
      - "Failed to connect to service ServiceInfo"

This morning, I got the following error:

Logger: homeassistant.components.template.template_entity Source: components/template/template_entity.py:173 Integration: Template (documentation, issues) First occurred: 2:15:21 AM (92 occurrences) Last logged: 7:15:01 AM

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('\']','') }}
{% endif %}
{{ states.sensor.weatheralerts_1.attributes.alerts[0].description | regex_replace('\n\n','

') | regex_replace('\n',' ') | regex_replace('*','\n') | regex_replace('

','\n\n') }}
{% if states.sensor.weatheralerts_1.attributes.alerts[0].instruction != None %} {{ states.sensor.weatheralerts_1.attributes.alerts[0].instruction | regex_replace('\n\n','

') | regex_replace('\n',' ') | regex_replace('*','\n') | regex_replace('

','\n\n') }}
{% endif %}
Where : {{ state_attr('sensor.weatheralerts_1', 'friendly_name') }}
Effective: {{ states.sensor.weatheralerts_1.attributes.alerts[0].effective }} {%- if states.sensor.weatheralerts_1.attributes.alerts[0].ends != None %}
Ends: {{ states.sensor.weatheralerts_1.attributes.alerts[0].ends }} {%- endif %}
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','

') | regex_replace('\n',' ') | regex_replace('*','\n') | regex_replace('

','\n\n') }} {% if states.sensor.weatheralerts_1.attributes.alerts[0].instruction != None %} {{ states.sensor.weatheralerts_1.attributes.alerts[0].instruction | regex_replace('\n\n','

') | regex_replace('\n',' ') | regex_replace('*','\n') | regex_replace('

','\n\n') }} {% endif %} {% else %} None {% endif %}")' for attribute 'spoken_message' in entity 'sensor.weatheralerts_1_alert_1'

jlverhagen commented 2 years ago

In the filters section in configuration.yaml add this:

    homeassistant.components.template.template_entity:
      - "weatheralerts"

I got the homeassistant.components.template.template_entity part from the Logger: line of the error log you posted. That will be the part of Home Assistant that is catching and logging the error and can be used to filter out errors.

wtstreetglow commented 2 years ago

@jlverhagen Thank you for responding to this and helping me hide some of these. I really do appreciate it.