Merge pull request #1541 from balloob/catch_template_exceptions

Catch template automation exception common during startup.
pull/1487/merge
Paulus Schoutsen 2016-03-14 07:43:59 -07:00
commit fb3586c18f
1 changed files with 7 additions and 2 deletions

View File

@ -55,8 +55,13 @@ def _check_template(hass, value_template):
"""Check if result of template is true."""
try:
value = template.render(hass, value_template, {})
except TemplateError:
_LOGGER.exception('Error parsing template')
except TemplateError as ex:
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 value.lower() == 'true'