diff --git a/packages/security/security.yaml b/packages/security/security.yaml index 7759cfd..0fb3a17 100644 --- a/packages/security/security.yaml +++ b/packages/security/security.yaml @@ -144,6 +144,13 @@ input_button: shell_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 script: @@ -501,7 +508,38 @@ automation: entity_id: binary_sensor.doorbell_alarm_local to: 'on' action: - - service: notify.everyone - data: - title: 'Doorbell' - message: 'Home Doorbell Rang' + - service: rest_command.doorbell_start_event + response_variable: event_data + + - if: "{{ event_data['status'] == 200 }}" + then: + - service: notify.everyone + data: + title: 'Doorbell' + 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'] }}"