2020-06-12 12:48:13 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.2881955472] Error handling message: Unknown error
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/connection.py", line 95, in async_handle
handler(self.hass, self, schema(msg))
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 265, in handle_render_template
state_listener()
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 253, in state_listener
msg["id"], {"result": template.async_render(variables)}
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 228, in async_render
return compiled.render(kwargs).strip()
File "/usr/local/lib/python3.7/site-packages/jinja2/environment.py", line 1090, in render
self.environment.handle_exception()
File "/usr/local/lib/python3.7/site-packages/jinja2/environment.py", line 832, in handle_exception
reraise(*rewrite_traceback_stack(source=source))
File "/usr/local/lib/python3.7/site-packages/jinja2/_compat.py", line 28, in reraise
raise value.with_traceback(tb)
File "<template>", line 4, in top-level template code
TypeError: 'NoneType' object is not iterable
why even bother logging this without source of the error, or a direct link to the websocket_api.http.connection.2881955472 which, as far as I know is untracable either?
btw, I think (hope) to have found the culprits for the earlier attributes error, a set of rather complex template sensors:
Try checking your Lovelace config as well. I use my card-templater custom card in several parts of mine and found I had a few uses of attributes that I needed to replace with state_attr to make the errors go away.
Stop looking at the top of the error. Look bottom up always. It’s a stack. This is how errors work in python.
Your issue is that you’re iterating through an object that doesn’t exist on startup. So look at for loops with at least 4 lines where the 4th line is performing the iteration.
Since upgrade to ver. 111 the history cards behave strange. Eg. If I add a history card for a binary sensor it shows me the correct history status:
Then, if I refresh the webpage (SHIFT+click on refresh) the history card will transform into:
Basically the active (green) status is gone (all active statuses are gone).
This is happening in latest version of Firefox 77.0.1, but also in other browsers eg. Opera/Chrome.
{% set player = 'sensor.plex' %}
{% if states(player) != '0' %}
{%- for attr in states[player].attributes %}
{%- if not attr in ['friendly_name','unit_of_measurement','icon','entity_picture'] %}
{{attr}} is watching {{states[player].attributes[attr]}}
{%- endif %}
{%- endfor %}
{% else %} Watching Plex: {{states(player)}}
{% endif%}
hmm, only other for I can find (with a non existing attributes.source for now, thank goodness) is this:
{% set km = states('input_number.quakes_near')|float %}
{% set location = states('input_select.quakes_near') %}
{% set ns = namespace(count=0) %}
{% for s in states.geo_location|selectattr('attributes.source','eq','usgs_earthquakes_feed') %}
{% if distance(s.entity_id,location) < km %}
{% set ns.count = ns.count + 1 %}
{%- endif %}
{% endfor %}
{{ns.count}}
should there be a guard here too? which isn’t too obvious using a for loop…(sorry for misusing this thread, promise to take a next one to a dedicated one, apologies)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/connection.py", line 95, in async_handle
handler(self.hass, self, schema(msg))
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 265, in handle_render_template
state_listener()
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 253, in state_listener
msg["id"], {"result": template.async_render(variables)}
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 230, in async_render
raise TemplateError(err)
homeassistant.exceptions.TemplateError: UndefinedError: 'None' has no attribute 'attributes'
2020-06-12 15:13:58 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.139625112648272] Error handling message: Unknown error
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 228, in async_render
return compiled.render(kwargs).strip()
File "/usr/local/lib/python3.7/site-packages/jinja2/environment.py", line 1090, in render
self.environment.handle_exception()
File "/usr/local/lib/python3.7/site-packages/jinja2/environment.py", line 832, in handle_exception
reraise(*rewrite_traceback_stack(source=source))
File "/usr/local/lib/python3.7/site-packages/jinja2/_compat.py", line 28, in reraise
raise value.with_traceback(tb)
File "<template>", line 3, in top-level template code
File "/usr/local/lib/python3.7/site-packages/jinja2/sandbox.py", line 407, in getattr
value = getattr(obj, attribute)
jinja2.exceptions.UndefinedError: 'None' has no attribute 'attributes'
Are you using any package, like “My Garden Irrigation” ?
It’s very difficult to find an issue like this without having more details…
I’ve tried both of those in the Developer Tools > Template. I don’t have any of the entities you use in them, so if these were causing the errors then I would expect to have errors in the log, but they both worked (the first one returned blank and the second returned 0). However, you might be able to make the first one a bit safer, by changing:
{% if states(player) != '0' %}
to
{% if states(player) not in ['0', 'unavailable', 'unknown'] %}
This would specifically catch if the Plex sensor is unavailable or the state is unknown.
Stale bot closes issues that did not receive any response, to prevent that from happening in the future make sure to respond when it comments or just report on every update whether it was fixed or not. This is standard for all issues, I know it may not make sense but sometimes issues do get fixed over time and users forget to report back so stale bot needs to account for that.
Its a completely separate integration from xiaomi_aqara so it will be new entities.