This is the full log, when the automation gets triggered
2018-06-10 18:28:16 INFO (MainThread) [homeassistant.components.automation] Executing Devices disconnected
2018-06-10 18:28:16 INFO (MainThread) [homeassistant.core] Bus:Handling <Event logbook_entry[L]: name=Devices disconnected, message=has been triggered, domain=automation, entity_id=automation.devices_disconnected>
2018-06-10 18:28:16 INFO (MainThread) [homeassistant.helpers.script] Script Devices disconnected: Running script
2018-06-10 18:28:16 INFO (MainThread) [homeassistant.helpers.script] Script Devices disconnected: Executing step call service
2018-06-10 18:28:16 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=notify, service=ha_telegram, service_data=message={{ trigger.to_state.attributes.friendly_name }} is now {{ trigger.to_state.state }} since a few minutes, service_call_id=1972315152-5>
2018-06-10 18:28:16 ERROR (MainThread) [homeassistant.core] Error executing service <ServiceCall notify.ha_telegram: message=<homeassistant.helpers.template.Template object at 0x701bd7f0>>
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/homeassistant/helpers/template.py", line 132, in async_render
return self._compiled.render(kwargs).strip()
File "/usr/lib/python3.6/site-packages/jinja2/asyncsupport.py", line 76, in render
return original_render(self, *args, **kwargs)
File "/usr/lib/python3.6/site-packages/jinja2/environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "/usr/lib/python3.6/site-packages/jinja2/environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/lib/python3.6/site-packages/jinja2/_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "<template>", line 1, in top-level template code
File "/usr/lib/python3.6/site-packages/jinja2/sandbox.py", line 385, in getattr
value = getattr(obj, attribute)
jinja2.exceptions.UndefinedError: 'trigger' is undefined
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/homeassistant/core.py", line 1007, in _event_to_service_call
await service_handler.func(service_call)
File "/usr/lib/python3.6/site-packages/homeassistant/components/notify/__init__.py", line 134, in async_notify_message
kwargs[ATTR_MESSAGE] = message.async_render()
File "/usr/lib/python3.6/site-packages/homeassistant/helpers/template.py", line 134, in async_render
raise TemplateError(err)
homeassistant.exceptions.TemplateError: UndefinedError: 'trigger' is undefined