Skip to content

Added instructions to save Ring video file using automation #3890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 18, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 19 additions & 14 deletions source/_components/camera.ring.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.
```yaml
downloader:
download_dir: downloads
```
Then you can use the following `action` in your automation (this will save the video file under `<config>/downloads/ring_<camera_name>/`):

- Add to the `configuration.yaml` the `downloader` and `python_scripts`. Visit the component page for further details.
```yaml
action:
- service: downloader.download_file
data_template:
url: "{{ states.camera.front_door.attributes.video_url }}"
subdir: "{{states.camera.front_door.attributes.friendly_name}}"
filename: "{{states.camera.front_door.attributes.friendly_name}}"
```

```json
If you want to use `python_script`, enable it your `configuration.yaml` file first:
```yaml
python_script:
downloader:
download_dir: downloads
```
- Create a file `ring_downloader.py` in the folder `<config>/python_scripts` and give it this content:
You can then use the following `python_script` to save the video file:

```python
# obtain ring doorbell camera object
Expand All @@ -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 `<config>/<downloader_dir>/ring_<camera_name>/`.

You can also automate the process by integrating it with the (automation)[/components/automation) component.