Folder Watcher Firing Multiple Times

Trying to use Folder Watcher to Telegram me files uploaded to FTP. It’s working but it’s firing the automation multiple times for the same file. Any ideas? For every single image the camera uploads I get up to ten copies sent to my phone!

EDIT: That was just for a test file - I was manually dropping a file in the dir to see if it got sent. I thought that if I tried my camera’s motion detection it might work but it literally sent me hundreds of the same message, to the point where it completely crashed my HA. Is this a bug?!


1 Like

I have the same problem. My camera saves a video in a folder. Folder whatcher fires trigger multiple times because the video takes several seconds saving in the folder. Is there any way to fires trigger when the file is completely created in the folder? Not several times while the video grows in size while it is being created in the folder. How can I know when the video is completely created/saved? Thank you
(Sorry for my bad english)

1 Like

Yes, I have a similar task. The xiaomi camera can save files to smb folder. The watch folder responds immediately, and the telegram sends the file immediately, leaving no time for it to load. Setting delays does not solve the problem, because The camera loads files in a large stream. And each time automation to the next file is triggered, without having to load the previous one.

  - event_data:
      event_type: created
    event_type: folder_watcher
    platform: event
  condition: []
  - delay: '60'
  - data_template:
      file: '{{}}'
      message: '{{}}'
      timeout: 10
    service: telegram_bot.send_video

Аннотация 2020-04-21 221846

I solved mine. Check this post.

It was just very, very picky over how the YAML had to be. To the point where making a small change via the GUI caused the issue.

I had the same issue. I think when you FTP, the folder monitor recognizes the small changes in file size as it’s uploading, so fires a bunch of ‘modified’ events.
I have Reolink cameras, and they have the option of overwriting a single file or two files. Using two files, it FTPs the file to a ‘.tmp’ then when the FTP is complete it executes a ‘delete’ and ‘move’ to replace the ‘.jpg’.
By setting folder monitor to only monitor’.jpg’ with ‘patters’ (from the HA docs) and then in my automation specifying “event_data: event_type: moved”, I was able to fire a single event after the new jpg was in place.