Add Doorbell Snapshot Service

This commit is contained in:
2024-03-30 08:21:35 -07:00
parent 98abb037a9
commit f9b63a427a

View File

@@ -144,6 +144,13 @@ input_button:
shell_command: shell_command:
doorbell_camera_set_online: !secret doorbell_camera_online_command doorbell_camera_set_online: !secret doorbell_camera_online_command
# -----------------------------------------------------------------------------
# Doorbell Event Start Command
rest_command:
doorbell_start_event:
url: !secret frigate_doorbell_event_url
method: post
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Security Scripts # Security Scripts
script: script:
@@ -501,7 +508,38 @@ automation:
entity_id: binary_sensor.doorbell_alarm_local entity_id: binary_sensor.doorbell_alarm_local
to: 'on' to: 'on'
action: action:
- service: rest_command.doorbell_start_event
response_variable: event_data
- if: "{{ event_data['status'] == 200 }}"
then:
- service: notify.everyone - service: notify.everyone
data: data:
title: 'Doorbell' title: 'Doorbell'
message: 'Home Doorbell Rang' message: 'Home Doorbell Rang'
data:
image: "/api/frigate/notifications/{{ event_data['content']['event_id'] }}/thumbnail.jpg"
clickAction: "https://hass.kraussnet.com/api/frigate/notifications/{{ event_data['content']['event_id'] }}/snapshot.jpg"
ttl: 0
priority: high
actions:
- action: URI
title: View Clip
uri: "https://hass.kraussnet.com/api/frigate/notifications/{{ event_data['content']['event_id'] }}/clip.mp4"
- action: URI
title: View Snapshot
uri: "https://hass.kraussnet.com/api/frigate/notifications/{{ event_data['content']['event_id'] }}/snapshot.jpg"
- service: persistent_notification.create
data:
notification_id: "camera-{{ event_data['content']['event_id'] }}"
title: "Doorbell Rang"
message: >-
![image](/api/frigate/notifications/{{ event_data['content']['event_id'] }}/snapshot.jpg)
[View Clip](/api/frigate/notifications/{{ event_data['content']['event_id'] }}/clip.mp4)
else:
- service: notify.everyone
data:
title: "Doorbell"
message: "Home Doorbell Rang but could not create event: {{ event_data['content']['message'] }}"