I am struggling with templates in my automation. The following automation throws the error below.
HASS log:
2017-06-18 12:19:30 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/template.py", line 101, in async_render
return self._compiled.render(kwargs).strip()
File "/srv/homeassistant/lib/python3.4/site-packages/jinja2/environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "/srv/homeassistant/lib/python3.4/site-packages/jinja2/environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "/srv/homeassistant/lib/python3.4/site-packages/jinja2/_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "<template>", line 1, in top-level template code
File "/srv/homeassistant/lib/python3.4/site-packages/jinja2/sandbox.py", line 385, in getattr
value = getattr(obj, attribute)
jinja2.exceptions.UndefinedError: 'trigger' is undefined
Also, be careful that you don’t have any odd characters in there. No tabs (spaces only)… that kind of thing. Your text editor likely has a setting for this. If you use Notepad++, take a look at