Folder watcher
The Folder watcher integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] adds Watchdog
It creates event entities for these monitored event types:
closedcreateddeletedmodifiedmoved
Configured folders must be added to allowlist_external_dirs. Note that by default folder monitoring is recursive, meaning that the contents of sub-folders are also monitored.
Configuration
To add the Folder watcher integration to your Home Assistant instance, use this My button:
        Manual configuration steps
      
      
      
      
    
    If the above My button doesn’t work, you can also perform the following steps manually:
- 
Browse to your Home Assistant instance.
 - 
In the bottom right corner, select the
Add Integration button.  - 
From the list, select Folder watcher.
 - 
Follow the instructions on screen to complete the setup.
 
Patterns
Pattern matching using fnmatch*.yaml and *.txt.
Automations
The attributes the event entities contain are:
- 
event_type: matching theevent_typeof the filter (one ofcreated,moved,modified,deleted,closed) - 
path: The full path to the file (e.g. “/hello/world.txt”) - 
file: The name of the file (e.g. “world.txt”) - 
folder: The folder path (e.g. “/hello”) 
When the event_type is moved, the file details are for the source file and destination details are included:
- 
dest_path: The full path to the moved file (e.g. “/hello/world.txt”) - 
dest_file: The name of the moved file (e.g. “world.txt”) - 
dest_folder: The folder moved path (e.g. “/hello”) 
Automations can be triggered on file system events data using a template. The following automation will send a notification with the name and folder of new files added to that folder:
#Send notification for new image (including the image itself)
automation:
  alias: "New file alert"
  triggers:
    - trigger: state
      entity_id: event.created
  actions:
    - action: notify.notify
      data:
        title: New image captured!
        message: "Created {{ trigger.to_state.attributes.file }} in {{ trigger.to_state.attributes.folder }}"
        data:
          file: "{{ trigger.to_state.attributes.file }}"