HI,
Had a bit of a struggle understanding the notify.file myself, I thought it might be of help for others to let you in on how it works for me now.
Challenge: to forward all notifications to the text file created by notify.file,
First create the desired settings for the notify.file to work (thanks @JtotheDub77 and @Tinkerer !):
# https://home-assistant.io/components/notify.file/
- name: filed_notifications
platform: file
filename: filed_notifications.txt
timestamp: True
then, send notifications to this platform, just like any other notify platform.
- service: notify.filed_notifications
data:
message: >
HomeAssistant is back up and running.
I wanted to automate all notifications of platform notify.notify to be sent to this text file:
- alias: 'Forward notifications to notify.notifications'
id: 'Forward notifications to notify.notifications'
initial_state: 'on'
trigger:
platform: event
event_type: call_service
event_data:
domain: notify
service: notify
condition:
action:
service: notify.filed_notifications # thats what the name is set to in notify.file conf
data_template:
message: >
{% set message = trigger.event.data.service_data.message %}
{{ message }}
result:
cool to see the first 2 entries were made without the automation, the last one is done by the posted automation.
Have it displayed in the frontend:
by creating the file.sensor:
- platform: file
file_path: /config/filed_notifications.txt
name: Filed notifications
and add that to a dedicated group.
Next challenge: also add the other notification platforms, and maybe be able to clear it once in a while, like the home-assistant log…
thanx,
Marius