mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-14 04:46:49 +00:00
Merge pull request #3890 from arsaboo/current
Added instructions to save Ring video file using automation
This commit is contained in:
commit
b60cc24526
@ -32,19 +32,30 @@ Configuration variables:
|
|||||||
|
|
||||||
Currently it supports doorbell and stickup cameras.
|
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
|
||||||
|
|
||||||
- Add to the `configuration.yaml` the `downloader` and `python_scripts`. Visit the component page for further details.
|
|
||||||
|
|
||||||
```json
|
|
||||||
python_script:
|
|
||||||
downloader:
|
downloader:
|
||||||
download_dir: downloads
|
download_dir: downloads
|
||||||
```
|
```
|
||||||
- Create a file `ring_downloader.py` in the folder `<config>/python_scripts` and give it this content:
|
Then you can use the following `action` in your automation (this will save the video file under `<config>/downloads/ring_<camera_name>/`):
|
||||||
|
|
||||||
|
```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}}"
|
||||||
|
```
|
||||||
|
|
||||||
|
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
|
```python
|
||||||
# obtain ring doorbell camera object
|
# obtain ring doorbell camera object
|
||||||
@ -57,15 +68,9 @@ subdir_name = 'ring_{}'.format(ring_cam.attributes.get('friendly_name'))
|
|||||||
data = {
|
data = {
|
||||||
'url': ring_cam.attributes.get('video_url'),
|
'url': ring_cam.attributes.get('video_url'),
|
||||||
'subdir': subdir_name,
|
'subdir': subdir_name,
|
||||||
|
'filename': ring_cam.attributes.get('friendly_name')
|
||||||
}
|
}
|
||||||
|
|
||||||
# call downloader component to save the video
|
# call downloader component to save the video
|
||||||
hass.services.call('downloader', 'download_file', data)
|
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.
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user