Problem adding Delay to download videos from Ring Doorbell

Hi!

I am using the Ring integration in order to see the last motion video from my Ring Doorbell and Stick Up cameras.

At the moment, I have it set up so that when motion is triggered, the last video is downloaded using the downloader service.

Since Ring takes around 1 minute for the last minute to be available, a motion trigger only downloads the previous motion, not the current one. I wanted to add a delay to the downloader action, but with that line present, the configuration.yaml is valid but restarting the home assistant fails with this error message coming up in the notifications:

 - alias: 'Save Front Door video'
    trigger:
      platform: state
      entity_id: sensor.front_door_last_motion
      delay: '00:01:30'
    action:
      service: downloader.download_file
      data:
        url: "{{ state_attr('camera.front_door', 'video_url') }}"
        filename: "FrontDoor-{{now().year}}-{{now().month}}.{{now().day}}-{{now().hour}}.{{now().minute}}.mp4"

The error message is:
Invalid config for [automation]: [delay] is an invalid option for [automation]. Check: automation->delay. (See /config/configuration.yaml, line 12).

What am I doing wrong here, guys?

Appreciate all the help!
Thanks!

Delay goes in action…

  - alias: 'Save Front Door video'
    trigger:
      platform: state
      entity_id: sensor.front_door_last_motion
    action:
      - delay: "00:01:30"
      - service: downloader.download_file
        data:
          url: "{{ state_attr('camera.front_door', 'video_url') }}"
          filename: "FrontDoor-{{now().year}}-{{now().month}}.{{now().day}}-{{now().hour}}.{{now().minute}}.mp4"
1 Like

Thank you for the quick reply!

Issue resolved. Had the code as you mentioned, but stupidly a different syntax error threw me off, causing a different error that I believed it was this same one.

Everything works as intended now!

For future reference, if anyone wishes to automatically download ring doorbell videos from two cameras following a motion trigger but wish to add a delay to download the correct video, here’s the working portion of the configuration yaml file for future reference:

automation: 
  - alias: 'Save Backyard videos'
    trigger:
      platform: state
      entity_id: binary_sensor.backyard_motion
      to: 'on'
    action:
    - delay: "00:02:30"
    - service: downloader.download_file
      data:
        url: "{{ state_attr('camera.backyard', 'video_url') }}"
        filename: "Backyard-{{now().year}}-{{now().month}}.{{now().day}}-{{now().hour}}.{{now().minute}}.mp4"
      
      
  - alias: 'Save Front Door videos'
    trigger:
      platform: state
      entity_id: binary_sensor.front_door_motion
      to: 'on'
    action:
    - delay: "00:02:30"
    - service: downloader.download_file
      data:
        url: "{{ state_attr('camera.front_door', 'video_url') }}"
        filename: "Backyard-{{now().year}}-{{now().month}}.{{now().day}}-{{now().hour}}.{{now().minute}}.mp4"
      
1 Like

@AgainstGreaterOdds do you or anyone know why I get this error or what it means?

invalid url for dictionary value @ data[‘url’]

I used similar code.

alias: Save the video when the doorbell is pushed
trigger:
  - platform: state
    entity_id: binary_sensor.front_door_bell_ding
    to: 'on'
  - platform: state
    entity_id: binary_sensor.front_door_bell_motion
action:
  - delay:
      hours: 0
      minutes: 0
      seconds: 10
      milliseconds: 0
  - service: downloader.download_file
    data:
      url: "{{ state_attr(''camera.front_door_bell_rightside_door'', ''Video_url'') }}"
      filename: >-
        Backyard-{{now().year}}-{{now().month}}.{{now().day}}-{{now().hour}}.{{now().minute}}.mp4

Ignore that, novice error. Speeling name of Entity.

  - service: downloader.download_file
    data:
      url: '{{ state_attr(''camera.front_door_bell'', ''video_url'') }}'
      filename: >-
        {{now().year}}{{now().month}}{{now().day}}_{{now().hour}}{{now().minute}}_FrontDoor.mp4