From cea0596cf5421c6faa3e01c311d2ec84bf033e33 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Thu, 25 Jul 2024 07:14:22 -0600 Subject: [PATCH] Docs updates (#12607) --- docs/docs/guides/ha_notifications.md | 44 +++++----------------------- docs/docs/integrations/api.md | 12 ++++++-- docs/docs/integrations/mqtt.md | 3 +- 3 files changed, 19 insertions(+), 40 deletions(-) diff --git a/docs/docs/guides/ha_notifications.md b/docs/docs/guides/ha_notifications.md index cf3e03349..cc729af04 100644 --- a/docs/docs/guides/ha_notifications.md +++ b/docs/docs/guides/ha_notifications.md @@ -5,7 +5,7 @@ title: Home Assistant notifications The best way to get started with notifications for Frigate is to use the [Blueprint](https://community.home-assistant.io/t/frigate-mobile-app-notifications-2-0/559732). You can use the yaml generated from the Blueprint as a starting point and customize from there. -It is generally recommended to trigger notifications based on the `frigate/events` mqtt topic. This provides the event_id needed to fetch [thumbnails/snapshots/clips](../integrations/home-assistant.md#notification-api) and other useful information to customize when and where you want to receive alerts. The data is published in the form of a change feed, which means you can reference the "previous state" of the object in the `before` section and the "current state" of the object in the `after` section. You can see an example [here](../integrations/mqtt.md#frigateevents). +It is generally recommended to trigger notifications based on the `frigate/reviews` mqtt topic. This provides the event_id(s) needed to fetch [thumbnails/snapshots/clips](../integrations/home-assistant.md#notification-api) and other useful information to customize when and where you want to receive alerts. The data is published in the form of a change feed, which means you can reference the "previous state" of the object in the `before` section and the "current state" of the object in the `after` section. You can see an example [here](../integrations/mqtt.md#frigateevents). Here is a simple example of a notification automation of events which will update the existing notification for each change. This means the image you see in the notification will update as Frigate finds a "better" image. @@ -17,7 +17,7 @@ automation: topic: frigate/events action: - service: notify.mobile_app_pixel_3 - data_template: + data: message: 'A {{trigger.payload_json["after"]["label"]}} was detected.' data: image: 'https://your.public.hass.address.com/api/frigate/notifications/{{trigger.payload_json["after"]["id"]}}/thumbnail.jpg?format=android' @@ -33,48 +33,18 @@ automation: description: "" trigger: - platform: mqtt - topic: frigate/events - payload: new - value_template: "{{ value_json.type }}" + topic: frigate/reviews + payload: alert + value_template: "{{ value_json['after']['severity'] }}" action: - service: notify.mobile_app_iphone data: - message: 'A {{trigger.payload_json["after"]["label"]}} was detected.' + message: 'A {{trigger.payload_json["after"]["data"]["objects"] | sort | join(", ") | title}} was detected.' data: image: >- - https://your.public.hass.address.com/api/frigate/notifications/{{trigger.payload_json["after"]["id"]}}/thumbnail.jpg + https://your.public.hass.address.com/api/frigate/notifications/{{trigger.payload_json["after"]["data"]["detections"][0]}}/thumbnail.jpg tag: '{{trigger.payload_json["after"]["id"]}}' when: '{{trigger.payload_json["after"]["start_time"]|int}}' entity_id: camera.{{trigger.payload_json["after"]["camera"] | replace("-","_") | lower}} mode: single ``` - -## Conditions - -Conditions with the `before` and `after` values allow a high degree of customization for automations. - -When a person enters a zone named yard - -```yaml -condition: - - "{{ trigger.payload_json['after']['label'] == 'person' }}" - - "{{ 'yard' in trigger.payload_json['after']['entered_zones'] }}" -``` - -When a person leaves a zone named yard - -```yaml -condition: - - "{{ trigger.payload_json['after']['label'] == 'person' }}" - - "{{ 'yard' in trigger.payload_json['before']['current_zones'] }}" - - "{{ not 'yard' in trigger.payload_json['after']['current_zones'] }}" -``` - -Notify for dogs in the front with a high top score - -```yaml -condition: - - "{{ trigger.payload_json['after']['label'] == 'dog' }}" - - "{{ trigger.payload_json['after']['camera'] == 'front' }}" - - "{{ trigger.payload_json['after']['top_score'] > 0.98 }}" -``` diff --git a/docs/docs/integrations/api.md b/docs/docs/integrations/api.md index b324aae36..a0208bc01 100644 --- a/docs/docs/integrations/api.md +++ b/docs/docs/integrations/api.md @@ -381,9 +381,13 @@ List of frames in the preview cache for the time range. Previews are only kept i Specific preview frame from preview cache. -### `GET //start//end//preview.gif` +### `GET //start//end//preview` -Gif made from preview video / frames during this time range +Looping image made from preview video / frames during this time range. + +| param | Type | Description | +| --------- | ---- | -------------------------------- | +| `format` | str | Format of preview [`gif`, `mp4`] | ## Recordings @@ -455,6 +459,10 @@ Reviews from the database. Accepts the following query string parameters: | `limit` | int | Limit the number of events returned | | `severity` | str | Limit items to severity (alert, detection, significant_motion) | +### `GET /api/review/` + +Get review with `id` from the database. + ### `GET /api/review/summary` Summary of reviews for the last 30 days. Accepts the following query string parameters: diff --git a/docs/docs/integrations/mqtt.md b/docs/docs/integrations/mqtt.md index dcac518a1..6c9d112fa 100644 --- a/docs/docs/integrations/mqtt.md +++ b/docs/docs/integrations/mqtt.md @@ -138,13 +138,14 @@ Message published for each changed review item. The first message is published w "person", "car" ], - "sub_labels": [], + "sub_labels": ["Bob"], "zones": [ "front_yard" ], "audio": [] } } +} ``` ### `frigate/stats`