Ring Doorbell Download

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?

yeah, I see now that I moved away from downloading the video and playing that back.

The way I have set it up now is that i use the camerastream from the Ring integration. (I dont really use it, since it’s a battery one, so its slow to upload/download to HA, quicker to press the notification from the Ring app and open it there)

OK, thanks!

Not sure if it’s worth to anyone, but after reading this thread, I’ve combined most of the ideas to come up with the following (thanks everyone for your contributions).

Basically, I download everytime a new video is generated, this way I don’t need to add a delay.

alias: Download Ring Videos
description: ''
trigger:
  - platform: state
    entity_id:
      - camera.front_door
    attribute: last_video_id
condition: []
action:
  - service: downloader.download_file
    data:
      url: '{{ states.camera.front_door.attributes.video_url }}'
      subdir: >-
        {{state_attr("camera.front_door", "friendly_name")}}/{{
        now().strftime("%Y-%m") }}
      filename: >-
        {{ state_attr('camera.front_door', 'friendly_name') }}-{{
        now().strftime("%Y-%m-%d-%H-%M-%S") }}.mp4
mode: single

Hope this helps anyone looking at this thread in the future.

5 Likes

The integration works great I do have a question is there a way to map in the downloader nas storage network drive not my local home assistant drive even with the Python script

1 Like

is there any way to download the videos to the network storage, now i can use my NAS to save all the footage automagical,
especially after the last release for HA we can now add all the nas locally

Did we ever find the answer to this question?

I currently have one doorbell and two cameras, with a Home Premium subscription covering them all and also automations in HA (using the method posted below by @prageeth, based on the last_video_id attribute) to grab videos from them as they are produced. Those videos them get copied out of HA and added to my photo/video collection in OneDrive. That all works nicely.

If I cancel my subscription, will the ability to download videos in HA stop working?

I guess I can cancel my plan and find out! But if anyone knows…

Thanks,
Steve.