I’ve written a component which fires an event file_added
when I add a new file to a folder. The event payload is the file path such that the event is:
<Event file_added[L]: file=/Users/robincole/.homeassistant/images/metro-north copy.jpg>
I can trigger a notification using the config below, but get an error when I try to access the trigger object in my message template:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/robincole/Documents/Github/home-assistant/homeassistant/core.py", line 1006, in _event_to_service_call
await service_handler.func(service_call)
File "/Users/robincole/Documents/Github/home-assistant/homeassistant/components/notify/__init__.py", line 134, in async_notify_message
kwargs[ATTR_MESSAGE] = message.async_render()
File "/Users/robincole/Documents/Github/home-assistant/homeassistant/helpers/template.py", line 133, in async_render
raise TemplateError(err)
homeassistant.exceptions.TemplateError: UndefinedError: 'trigger' is undefined
If anyone has advice on how to access the file path please let me know!
Yes I have read the docs