i’m trying to let ha. send a video to my telegram channel but i’m always greeted with an error:
Can't send file with kwargs: {'message': 'Last Ring Video', 'file': 'test.mp4'}
2:41 PM components/telegram_bot/__init__.py (ERROR)
'test.mp4' are not secure to load data from!
2:41 PM components/telegram_bot/__init__.py (WARNING
this is my config:
- id: ring_video_download
alias: Ring Video Download
hide_entity: true
trigger:
- entity_id: binary_sensor.ring_front_door_motion
from: 'off'
to: 'on'
platform: state
condition: []
action:
- service: downloader.download_file
data_template:
url: '{{ states.camera.front_door.attributes.video_url }}'
filename: test.mp4
overwrite: true
- service: notify.oneplus
data:
message: Last Ring Video
data:
video:
- file: test.mp4
So got this all working nicely. Just trying to figure out how long it takes for my doorbell to upload to ring, then making it accessible to home assistant. 1 minute seems too short, but for you it may be perfect. YMMV. Just a case of fiddling with the delay in these automation scripts.
In your config yaml file, don’t forget to add two things.
First, inside your main homeassistant setup :
Then anywhere you like in your config file, allow the downloader component and specify where this downloads to. [Pro-tip: map it to somehting that isn’t your SD card]
downloader:
download_dir: /downloads
First one is a motion detection script:
- alias: Telegram notification -Front door motion
id: telegram_front_door_motion
trigger:
- entity_id: binary_sensor.front_door_motion
from: 'off'
platform: state
to: 'on'
action:
- service: notify.Bergen_telegram
data_template:
message: "Movement detected at the Front Door. I'll send a photo in a bit. You know how slow Ring is."
- delay: 00:02:00
- service: camera.snapshot
data:
entity_id: camera.front_door_2
filename: /downloads/ring/fdoor-snapshot.jpg #/config/www/images/fdoor-snapshot.jpg
- service: telegram_bot.send_photo
data_template:
file: /downloads/ring/fdoor-snapshot.jpg #/config/www/images/fdoor-snapshot.jpg
caption: The perp
target: []
disable_notification: true
timeout: 1000
- service: downloader.download_file
data_template:
url: "{{ states.camera.front_door_2.attributes.video_url }}"
subdir: ring
filename: fdoor_latest.mp4
overwrite: true
- delay: 00:00:05
- service: telegram_bot.send_video
data:
file: /downloads/ring/fdoor_latest.mp4
caption: Here's the video from Ring
target: []
disable_notification: true
timeout: 1000
inline_keyboard:
- Show options:/options
This second one is is a call & command request script - type in /frontdoor_vid in telegram (or add to your options menu) and back comes the last video that was recorded by ring for that device:
- alias: Request Ring Video Download
id: ring_video_download_request
trigger:
- event_type: telegram_callback
event_data:
data: /frontdoor_vid
platform: event
- event_type: telegram_command
event_data:
command: /frontdoor_vid
platform: event
condition: []
action:
- service: downloader.download_file
data_template:
url: "{{ states.camera.front_door_2.attributes.video_url }}"
subdir: ring
filename: fdoor_latest.mp4
overwrite: true
- delay: 00:00:05
- service: telegram_bot.send_video
data:
target: []
callback_query_id: '{{ trigger.event.data.id }}'
file: /downloads/ring/fdoor_latest.mp4
caption: Latest front door video from Ring
disable_notification: true
timeout: 1000
inline_keyboard:
- Show options:/options