Skip to content

Instantly share code, notes, and snippets.

@zsarnett
Last active May 29, 2023 21:47
Show Gist options
  • Save zsarnett/eb42fc2eb21d46041d5b552ec2eba3fc to your computer and use it in GitHub Desktop.
Save zsarnett/eb42fc2eb21d46041d5b552ec2eba3fc to your computer and use it in GitHub Desktop.
Send Notification with Camera Snapshot when 3D Printer is Finished
blueprint:
name: Send a camera snapshot when OctoPrint Printer is Finsihed
description: >
This automation blueprint creates a camera snapshot if OctoPrint Status turns off
and sends a notification to your phone with the picture.
domain: automation
input:
printer:
name: 3D Printer
description: The Printer Device to monitor
selector:
device:
printer_sensor:
name: Printer Binary Sensor
description: The camera which creates the snapshot
selector:
entity:
domain: binary_sensor
camera:
name: Camera
description: The camera which creates the snapshot
selector:
entity:
domain: camera
notify_device:
name: Device to notify
description: Device needs to run the official Home Assistant app to receive notifications
selector:
device:
integration: mobile_app
notification_title:
name: Notification title
description: "Title of the Notification"
default: "3D Printer Finished"
notification_message:
name: Notification Message
description: "Message body of the Notification"
default: "The 3D Printer has finished its latest job"
trigger:
platform: device
device_id: !input printer
domain: binary_sensor
type: turned_off
entity_id: !input printer_sensor
variables:
printer: !input printer
printer_sensor: !input printer_sensor
printer_name: "{{ states[printer].name }}"
camera: !input camera
notify_device: !input notify_device
notification_title: !input notification_title
notification_message: !input notification_message
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 }}"
- device_id: !input notify_device
domain: mobile_app
type: notify
title: "{{ notification_title }}"
message: "{{ notification_message }}"
data:
image: "{{ snapshot_access_file_path }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment