Ring Doorbell Download

Hey Guys,

I have the ring doorbell setup and under entites I can see the video_url and its works to get my last video.

Can someone please share there config for an automation to save this video. The instructions I dont understand.

I am guessing something like this?

Im not sure what you are using for a trigger so this is another guess…

- alias: "download ring video"
  trigger:
    - platform: state
      entity_id: binary_sensor.ring_front_door_motion
      from: 'off'
      to: 'on'
  action:
  - service: downloader.download_file
    data_template:
      url: ""
      subdir: ""
      filename: ""

Im not sure what to put for the bottom 3?

Thanks

I guess it should be something like:

automation:
  - alias: 'Doorbell Motion'
    trigger:
      - platform: state
        entity_id: binary_sensor.ring_front_door_motion
        from: 'off'
        to: 'on'
    action:
      - service: downloader.download_file
        data_template:
          url: "states.camera.front_door.attributes.video_url"
          subdir: "downloads"
          filename: "last.mpg"
          overwrite: true

but I’m still trying to figure out myself (well, this is actually if you want to download only the last video recorded)

I want to download the last video every time a new video is created. I was thinking after it sees motion it would kick the script off and save that url. then I can just create a rsync script to save every created video off to my nas…Thanks for the help btw

So, it works but… when the binary_sensor.ring_front_door_motion goes “on”, the last recorded video it’s not the one it is recording in that moment, but previous one it has been already sent to the ring servers. Probably I have to add a delay between the trigger and the download.
Anyway, in my configuration file I have:

downloader:
  download_dir: downloads

This tells to the downloader component to download files into /config/downloads (I am using HA on Hassio, if you are using it on a different platform the “downloads” dir will be inside your HA root dir).
And this is my ring.yaml package:

############################################################
#
# Ring
#
############################################################
ring:
  username: !secret ring_user
  password: !secret ring_password

sensor:
  - platform: ring
binary_sensor:
  - platform: ring
camera:
  - platform: ring

automation:
  - alias: 'Doorbell Motion'
    trigger:
      - platform: state
        entity_id: binary_sensor.ring_front_door_motion
        from: 'off'
        to: 'on'
    action:
      - service: downloader.download_file
        data_template:
          url: "{{ states.camera.front_door.attributes.video_url }}"
          filename: "last.mpg"
          overwrite: true

  - alias: 'Doorbell Ding'
    trigger:
      - platform: state
        entity_id: binary_sensor.ring_front_door_ding
        from: 'off'
        to: 'on'
    action:
      - service: hassio.addon_stdin
        data:
          addon: local_audio_player
          input: "http://192.168.1.100:8123/local/doorbell-1.mp3"

I’m triggering it via the last_activity recording_status attribute and it seems to work

Thought I haven’t yet figured out how to display/view the video.

I use to save the file in the www folder, which is accessible from the web frontend. So you can play the video from there. I actually don’t do it on my hassio because ffmpeg platform keeps freezing the raspberry pi. Anyway it’s something like this @hastarin :

camera:
  - platform: ffmpeg
    name: last_ring_video
    input: http://192.168.1.100:8123/local/last.mpg
1 Like

Excuse my ignorance, however are we required to have a monthly subscription with Ring.com in order to be able to store the latest video on our local HAAS? Or is it possible to use the camera as live feed? Cheers!

Digging up an old thread, here is an AppDaemon version of the automation/app

Doorbell Video:
  class: ring_doorbell_video_download
  module: ring_doorbell_video_download
  ring_camera: camera.front_door
  ## Custom subdir or use 'dynamic' to use the date (yyyy-mm-dd)
  subdir: doorbell


import appdaemon.plugins.hass.hassapi as hass


class ring_doorbell_video_download(hass.Hass):

    def initialize(self):
        self.ring_camera = self.args["ring_camera"]
        self.subdir_name = self.args["subdir"]

        self.log("Doorbell Video download setup for {}".format(self.ring_camera))
        self.listen_state(self.video_event, self.ring_camera, attribute="video_url")

    def video_event(self, entity, attribute, old, new, kwargs):
        
        if old != new:

            if self.subdir_name == "dynamic":
                subdir_name = "{}".format(self.date())
            else:
                subdir_name = self.subdir_name

            url = self.get_state(self.ring_camera, attribute="video_url")
            filename = '{}_{}.mp4'.format(self.ring_camera, self.datetime())
            filename = filename.replace(":", "-")
            filename = filename.replace(" ", "_")

            if url:
                self.call_service("downloader/download_file", 
                    url=url,
                    subdir=subdir_name,
                    filename=filename)

                self.log("Doorbell Video Downloaded", "INFO")
            else:
                self.log("No URL Provided for Doorbell Video", "WARNING")


    def log_notify(self, msg, level):
        self.log(msg, level)
        self.call_service("notify/notify", message=msg)


@kylerw You said digging up an old thread. Can you point me to that thread or explain what goes where? Do I need to put

python_script:

in my configuration.yaml

and create a python script in the python_scripts folder that contains that script. what is used to trigger that script an automation? And does that automation go in the automation.yaml file?

Hello,

I did the setup of my doorbell as described here https://www.home-assistant.io/components/camera.ring/ using the python script.

I can call the script using services/python_script.ring but it won’t download my mp4 file to /config/downloads.

My 30 days subscription is over, before I could see my video within Hassio but I am not sure if I do need any subscription?

Hope someone can help me solve this problem.

Hello,
Did you get clarity on where to put this code? I would like to try it also.

In case someone is looking for this still and finds this thread.The documentation here isn’t bad:

I also have it working via a telegram, here:

This documentation from the Ring Integration works! It seems to be the easiest working option to download videos from ring at the moment.

Does anyone know how to use the Delay function properly, so that when motion is triggered, the Downloader process waits 1 or 2 minutes until the motion video is ready?

Simply adding the delay: 60 option to the config makes the config file error out during restart and it does not work.

I too have gotten the downloader working pretty well, and I can see all the processed motion videos in my downloads folder, however I haven’t really figured out how to put it to any significant use from within Home Assistant.

Has anyone done anything significant with this integration?

I created a Camera instance like this:

camera:
  - platform: ffmpeg
    name: last_doorbell_video
    input: http://homeassistant:8123/local/downloads/Front_Door/video.mp4

But my automation has “overwrite: true” so “video.mp4” is always going to be the newest and I can then show that in a lovelace card

Sorry to jump on old thread,

I’m using the ring with automation, But when the motion is detected, it is downloading the old video from the last motion & not the new one.

service: downloader.download_file
data:
  url: '{{ state_attr(''camera.front_door'', ''video_url'') }}'
  subdir: >-
    {{state_attr("camera.front_door", "friendly_name")}}/{{
    now().strftime("%m.%Y") }}
  filename: >-
    {{ state_attr('camera.front_door', 'friendly_name') }} - {{
    now().strftime("%d-%m-%Y- %H.%M.%S") }}.mp4

I have just had the same thing. You need to add a delay to allow the video to finish recording, process and upload. Add the following before service:

delay: “00:01:30”

…your delay may be different though.

how do you view the video in HA?

picture-entity

type: picture-entity
entity: camera.front_door
camera_view: live
image: /local/downloads/thumbnail.jpeg

thanks!

Is that taking the video from the cloud not the downloaded location though?