Help with Wait for trigger and folder watcher Automation


Here is my automation that is not quite working

- alias: Cameras Notify when new video clip recorded
  initial_state: 'on'
  mode: single
  max_exceeded: silent
  - platform: state
    entity_id: binary_sensor.person_in_driveway
    to: 'on' 
  - wait_for_trigger:
      - platform: event
        event_type: folder_watcher
          event_type: modified
      seconds: 30
    continue_on_timeout: false
  - service: notify.paul_and_tracy_iphone
      message: "Person in the Driveway (Video)"
          url: '/media/local/camera_video/{{ }}'
          hide-thumbnail: false
  - delay:
      seconds: 20

What I am trying to do: I have a camera that does image processing. In another automation, every time there is motion detected, 3 things happen.

  • Image processing
  • image snapshot
  • stream record

If there is a person detected during image processing, a sensor turns on “person detected”

I send a notification with the image processed image. The snapshot image is there for times when there was motion, but not a person. I may want to review that, but I dont want a notification. All of that works great.

I just started captuing short video clips and wanted to try sending myself a video clip as well, with the plan of maybe eventually sending video instead of the image, but only when there is a person. I have been successful at sending the video, but not succesful at limiting it to person only. It’s about the timing. Typically when the person has been detected the video is still recording. I had tried earlier using the folder watcher as the trigger, and waiting for the person detection, but the person detection had already happened by the time the folder watch was “modified”

The automation above fails with the following error:
Cameras Notify when new video clip recorded: Error executing script. Unexpected error for call_service at pos 2: Error rendering data template: UndefinedError: ‘dict object’ has no attribute ‘event’

I think I get why, I think folder watcher does not work where I have it as “trigger_id”.

I’m just looking for thoughts on how to make this work or other ways that might work better? Thanks in advance for any assistance