This automation blueprint creates a camera snapshot if motion is detected, or if a binary sensor’s state turns ‘off’ to ‘on’, and sends a notification to your device with the picture when certain conditions are met.
Inspired by vorion’s Send camera snapshot notification on motion blueprint but with Conditions and Binary Sensors! Clicking the notification will navigate to dashboard URL.
To Notify Multiple Devices
Highly requested is the ability to notify multiple devices, but that wasn’t really easy to do as the service is setup for a single/specific device. However, I came across something called a Notification Group
. Try making a group of devices and using that group as a device to notify!
notify:
- name: ALL_DEVICES
platform: group
services:
- service: mobile_app_iphone_one
- service: mobile_app_iphone_two
- service: mobile_app_ipad_one
- service: mobile_app_pixel_4_xl
Now, you can send notifications to everyone in the group using:
automation:
- alias: "Notify Mobile app group"
trigger:
...
action:
- service: notify.ALL_DEVICES
data:
message: "Something happened at home!"
Changes:
Binary Sensor Trigger:
v1.1 - Conditions no longer required!
v1.2 - Clicking the notification will navigate to dashboard URL (Tested on Android, iOS not confirmed)
v1.3 - Added option to save camera snapshot with conditions
v1.4 - Added option to add additional actions. Useful to send notifications to more devices!
v1.42 - Added time
variable and added to default message.
v1.5 - Added option to add an addition action BEFORE everything else. Useful to turn on a light before the snapshot! Added option to set delay before sending another notification.
v1.5.1 - Added option to allow for the notification to device to be optional.
Major Rewrite in V2
v2.0
BREAKING CHANGES - Notification Delay (changed to number selector), implementation also changed. Delay is in seconds and will not block the rest of the automation from running, just the notification.
No longer need to mark device as iOS, it should use the right parameters for each device type.
Ability to set much more notification parameters, like the icon, color, channel, group, sticky, sound and volume! Some settings are exclusive to Android or iOS.
Most importantly, move snapshot image to /media
from /www/tmp
for better security, no longer exposing snapshot to rest of internet. Double check your File Path
parameter
v2.2
FIXED Notification Groups. Unable to use a device selector, so you must enter the created group’s name you used, for example, all_devices, or notify.all_devices. This will overwrite the individual device previously selected.
EXPERIMENTAL: Android TV support. I believe I added the code for TV support but since I have a Google TV, I can’t install Home Assistant on that, so I cannot test this. Please give me feedback. I use Notifications for Android TV which can be installed on an Android Device to relay the notification to the Google TV. Works if only using a single device selected in the blueprint, as long as the app is also on that device!
EXPERIMENTAL: Notification Actions support. Currently added support for a single URI action. I am testing with a door lock/unlock script for more advanced actions.
2.2.2
FIXED: Simplified iOS Critical Notification
2.2.3
ADDED: Collapsible input options
2.2.7
CHANGED: Default of Save Archive Files?
to false.
FIXED: Bug that didn’t attach image to notification in the Custom Triggers
automation (I JUST noticed this with this particular automation, for those who were using this one with this bug, it may now be fixed).
ADDED: Option to set conditions to run the automation entirely (useful if you just want to capture and save snaps in particular conditions).
2.2.8
ADDED:
- Delay option between taking snapshot and sending snapshot, titled
Send Snapshot Delay
. - Option to Change Automation Mode, titled
Mode Select
. Default is Parallel so the automation will run actions guaranteed, but there are some cases when you don’t want that.
2.3
ADDED:
- Additional triggers to original Binary Sensor blueprint.
Want to Add:
Nothing Yet
Also combined niemyjski’s Save a camera snapshot with archive when motion is detected blueprint with conditions. Useful to save your snapshots and make a picture entity to display the last snapshot taken.
Example:
*Note - If you save snapshot to /media, which is recommended, create a Local File Camera entity in your
configuration.yaml
file.
camera:
- platform: local_file
file_path: /media/front_porch/last_motion.jpg # match your 'File Path' location from the Blueprint
name: Front Porch Last Motion
Otherwise, if save your snapshot in the /www
folder, point to /local
to show your snapshot, but this will host the image to the internet with no authentication, so not recommended.
Card:
type: picture-entity
show_state: true
show_name: true
camera_view: auto
entity: binary_sensor.front_porch_sensor_motion
image: /media/front_porch/last_motion.jpg # Optional: match your 'File Path' location from the Blueprint
camera_image: camera.front_porch_last_motion # match your Camera ID when using local file camera entity
name: Front Porch Last Motion
tap_action:
action: call-service
service: camera.snapshot
data:
entity_id: camera.192_168_86_168_2
filename: /media/front_porch/last_motion.jpg # match your 'File Path' location from the Blueprint
hold_action:
action: more-info
state_filter:
'on': brightness(100%)
'off': brightness(100%)
The Blueprint:
Binary Sensor Trigger:
Custom Triggers: