From e5c8dd03e1f1076958e2fb31f23bb9ac4af28741 Mon Sep 17 00:00:00 2001 From: pavoni Date: Mon, 14 Mar 2016 10:10:38 +0000 Subject: [PATCH] Catch exception common during startup. --- homeassistant/components/automation/template.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/automation/template.py b/homeassistant/components/automation/template.py index aae892ea80d..1d17246c012 100644 --- a/homeassistant/components/automation/template.py +++ b/homeassistant/components/automation/template.py @@ -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'