{
"url": "http(s)://<HOME_ASSISTANT_URL>/api/frigate/notifications/",
"css": "../css/hasspyfrigate.css",
"title": "HassPyFrigate - Nicer Frigate Notifications",
"id": "none",
"camera": "",
"bbox": "1",
"event": "false",
"debug": "false"
}
Add the following to your configuration.yaml in Home Assistant:
rest_command:
hasspyfrigate:
url: http(s)://<HASSPYFRIGATE_URL/cgi-bin/hasspyrest.py
method: POST
headers:
accept: "application/json, text/html"
user-agent: "Mozilla/5.0 {{ useragent }}"
payload: '{
"table": "events",
"debug": "1",
"function": "INSERT",
"columns" : {
"event_id": "{{event_id}}",
"url": "{{url}}",
"camera": "{{camera}}",
"type": "{{type}}",
"bbox": "{{bbox}}"
}
}'
content_type: "application/json; charset=utf-8"
Click on "Event Viewer" to view HassPyFrigate Event Viewer The following Automation will send an actionable notification to the android companion app (Should work with iOS as well) Include the following in your automations.yaml file in Home Assistant
- id: 'hasspyfrigate'
alias: HassPyFrigate
description: Object Detection Alerts Using HassPyFrigate
trigger:
- platform: mqtt
topic: frigate/events
condition:
- condition: template
value_template: '{{ trigger.payload_json["type"] == "end" }}'
- condition: template
value_template: "{{ trigger.payload_json[\"after\"][\"label\"] == \"person\" or\n\
\ trigger.payload_json[\"after\"][\"label\"] == \"bird\" or\n trigger.payload_json[\"\
after\"][\"label\"] == \"dog\" or\n trigger.payload_json[\"after\"][\"label\"\
] == \"cat\" or\n trigger.payload_json[\"after\"][\"label\"] == \"bear\" or\n\
\ trigger.payload_json[\"after\"][\"label\"] == \"horse\" \n}}"
action:
- service: notify.mobile_app_sg20plus
data:
message: '{{ trigger.payload_json["after"]["label"] | title }} Detected'
data:
notification_icon: mdi:cctv
ttl: 0
priority: high
sticky: true
actions:
- action: URI
title: Event Viewer
uri: http(s)://<HOME_ASSISTANT_URL/cgi-bin/hasspyfrigate.py?id={{trigger.payload_json['after']['id']}}&camera={{trigger.payload_json['after']['camera']}}&bbox=true
image: /api/frigate/notifications/{{trigger.payload_json['after']['id']}}/snapshot.jpg?bbox=1
tag: '{{trigger.payload_json["after"]["id"]}}'
alert_once: true
- service: rest_command.hasspyfrigate
data:
event_id: '{{trigger.payload_json[''after''][''id'']}}'
camera: '{{trigger.payload_json[''after''][''camera'']}}'
type: '{{ trigger.payload_json[''after''][''label''] | title }}'
bbox: 1
mode: single