Skip to content

Instantly share code, notes, and snippets.

@alyssadev
Created February 13, 2025 15:08
Show Gist options
  • Save alyssadev/73d81d8f94f899e8e0c7b1fb9e739d27 to your computer and use it in GitHub Desktop.
Save alyssadev/73d81d8f94f899e8e0c7b1fb9e739d27 to your computer and use it in GitHub Desktop.
blueprint:
name: Send a camera snapshot when motion is detected
description: >
This automation blueprint creates a camera snapshot if motion is detected
and sends a notification to your phone with the picture.
based on https://community.home-assistant.io/t/send-camera-snapshot-notification-on-motion/254565
domain: automation
input:
motion_sensor:
name: Motion sensor
description: The sensor wich triggers the snapshot creation
selector:
entity:
domain: binary_sensor
device_class: motion
camera:
name: Camera
description: The camera which creates the snapshot
selector:
entity:
domain: camera
trigger:
platform: state
entity_id: !input motion_sensor
from: "off"
to: "on"
variables:
motion_sensor: !input motion_sensor
motion_sensor_name: "{{ states[motion_sensor].name }}"
camera: !input camera
snapshot_create_file_path: "/config/www/tmp/snapshot_{{ states[camera].object_id }}.jpg"
snapshot_access_file_path: "{{ snapshot_create_file_path | replace('/config/www','/local') }}"
action:
- service: camera.snapshot
entity_id: !input camera
data:
filename: "{{ snapshot_create_file_path }}"
- action: telegram_bot.send_photo
metadata: {}
data:
caption: Motion detected
file: "{{ snapshot_access_file_path }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment