From a27073be100a2fdd6a8e155e14b7074d18ae68f0 Mon Sep 17 00:00:00 2001 From: arsaboo Date: Sat, 4 Nov 2017 09:34:54 -0400 Subject: [PATCH 1/3] Added instructions to save video file using automation. --- source/_components/camera.ring.markdown | 35 ++++++++++++++----------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/source/_components/camera.ring.markdown b/source/_components/camera.ring.markdown index c383381eaf7..d495c74efce 100644 --- a/source/_components/camera.ring.markdown +++ b/source/_components/camera.ring.markdown @@ -32,19 +32,30 @@ Configuration variables: Currently it supports doorbell and stickup cameras. +## {% linkable_title Saving the videos captured by your Ring Door Bell %} -## {% linkable_title Saving locally the videos captured by your Ring Door Bell %} +You can save locally the latest video captured by your Ring Door Bell using the [downloader](/components/downloader) along with either an [automation](/components/automation) or [python_script](/components/python_script). First, enable the [downloader](/components/downloader) component in your configuration by adding the following to your `configuration.yaml`. -You can save locally the latest video captured by your Ring Door Bell by enabling the [downloader](/components/downloader) and the [python_scripts](/components/python_script) components. - - - Add to the `configuration.yaml` the `downloader` and `python_scripts`. Visit the component page for further details. - -```json -python_script: +```yaml downloader: download_dir: downloads ``` - - Create a file `ring_downloader.py` in the folder `/python_scripts` and give it this content: +Then you can use the following `action` in your automation (this will save the video file under `/downloads/ring_/`): + +```yaml +action: + - service: downloader.download_file + data_template: + url: "{{ states.camera.front_door.attributes.video_url }}" + subdir: "{{'ring_{}'.format(states.camera.front_door.attributes.friendly_name}}" + filename: "{{states.camera.front_door.attributes.friendly_name}}" +``` + +If you want to use `python_script`, enable it your `configuration.yaml` file first: +```yaml +python_script: +``` +You can then use the following `python_script` to save the video file: ```python # obtain ring doorbell camera object @@ -57,15 +68,9 @@ subdir_name = 'ring_{}'.format(ring_cam.attributes.get('friendly_name')) data = { 'url': ring_cam.attributes.get('video_url'), 'subdir': subdir_name, + 'filename': ring_cam.attributes.get('friendly_name') } # call downloader component to save the video hass.services.call('downloader', 'download_file', data) ``` - - - Start Home Assistant - - Call the server `python_script/ring_downloader` - -You should be able to see a video file saved under `//ring_/`. - -You can also automate the process by integrating it with the (automation)[/components/automation) component. From 51ba0eed98e26cf252df6ed3789e5cf2ace5180a Mon Sep 17 00:00:00 2001 From: arsaboo Date: Sat, 4 Nov 2017 12:59:30 -0400 Subject: [PATCH 2/3] Added missing parentheses --- source/_components/camera.ring.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_components/camera.ring.markdown b/source/_components/camera.ring.markdown index d495c74efce..a667b4950f2 100644 --- a/source/_components/camera.ring.markdown +++ b/source/_components/camera.ring.markdown @@ -47,7 +47,7 @@ action: - service: downloader.download_file data_template: url: "{{ states.camera.front_door.attributes.video_url }}" - subdir: "{{'ring_{}'.format(states.camera.front_door.attributes.friendly_name}}" + subdir: "{{'ring_{}'.format(states.camera.front_door.attributes.friendly_name)}}" filename: "{{states.camera.front_door.attributes.friendly_name}}" ``` From 47c0165359ce924620daa3e699e79df81fd2b787 Mon Sep 17 00:00:00 2001 From: arsaboo Date: Sat, 4 Nov 2017 13:23:56 -0400 Subject: [PATCH 3/3] Simplified automation --- source/_components/camera.ring.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_components/camera.ring.markdown b/source/_components/camera.ring.markdown index a667b4950f2..854c77f5519 100644 --- a/source/_components/camera.ring.markdown +++ b/source/_components/camera.ring.markdown @@ -47,7 +47,7 @@ action: - service: downloader.download_file data_template: url: "{{ states.camera.front_door.attributes.video_url }}" - subdir: "{{'ring_{}'.format(states.camera.front_door.attributes.friendly_name)}}" + subdir: "{{states.camera.front_door.attributes.friendly_name}}" filename: "{{states.camera.front_door.attributes.friendly_name}}" ```