Catch exception common during startup.
parent
399fda079f
commit
e5c8dd03e1
|
@ -55,8 +55,13 @@ def _check_template(hass, value_template):
|
||||||
"""Check if result of template is true."""
|
"""Check if result of template is true."""
|
||||||
try:
|
try:
|
||||||
value = template.render(hass, value_template, {})
|
value = template.render(hass, value_template, {})
|
||||||
except TemplateError:
|
except TemplateError as ex:
|
||||||
_LOGGER.exception('Error parsing template')
|
if ex.args and ex.args[0].startswith(
|
||||||
|
"UndefinedError: 'None' has no attribute"):
|
||||||
|
# Common during HA startup - so just a warning
|
||||||
|
_LOGGER.warning(ex)
|
||||||
|
else:
|
||||||
|
_LOGGER.error(ex)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return value.lower() == 'true'
|
return value.lower() == 'true'
|
||||||
|
|
Loading…
Reference in New Issue