Is there a way to speed up local polling for a Folder sensor?

Perhaps there’s another way to accomplish what I’m trying to do.

When we press a button on our tablet, it fires a script that tells one of our cameras to capture an image. That image is then saved to a local/images/etc folder for which we have a sensor to provide a count of files in that folder.

There are a few checks along the way:

  1. Is the camera on? If not, don’t try to take a picture, just play a sound to let us know.
  2. Did the camera successfully take a picture, and did the file get saved to the right folder? If so, play a sound.

That’s where we get stuck. The sensor that counts the files has a relatively significant delay, so confirmation that an image was captured takes a while.

What other way could we confirm that a picture was actually saved to the folder? We’re trying to avoid phone notifications, but could resort to that if needed.

Display the latest picture using the camera file platform?

While this could serve a purpose, I’ll expound upon what I’m doing:

  • Wife is pregnant, so she stands at the camera twice per day and snaps a photo using the
    ESP32CAM, which writes the file to /local/images/camera2/baby_bump_time_lapse/

  • Each photo is incremented and named as such baby_bump_01..02..03.... The increment is derived from a file count of that folder.

  • An automation is triggered if the state of the folder sensor increases based upon the count, which is independent of the count in NodeRED.

In NodeRED, I use a node to count the number of results in an array and pass that value, do a little math, and increment the file count when the image is written.

I could probably write some sort of logic that compares values in NodeRED, but I chose to just create a folder sensor in the config.yaml. The NodeRED node is updated when called…but the folder sensor has a delay.

Any ideas?

It sounds like the folder watcher integration is a better option for you than the folder sensor. The sensor polls once a minute, whereas the watcher should be near real-time:

Not sure how the Folder Watcher makes itself evident once it’s configured. It’s not a sensor, right?

Where is the information on the events going?

The documentation for folder_watcher ends with a full yaml example how to trigger action on the events that the integration creates.

I was thinking in terms of sensors. So I’ll need to keep my sensors alive, but this watcher allows me to filter events in NodeRED with the purpose of being a trigger. Brilliant.