Docs updates (#12607)

This commit is contained in:
Nicolas Mowen 2024-07-25 07:14:22 -06:00 committed by GitHub
parent 51a1526146
commit cea0596cf5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 40 deletions

View File

@ -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. 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. 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 topic: frigate/events
action: action:
- service: notify.mobile_app_pixel_3 - service: notify.mobile_app_pixel_3
data_template: data:
message: 'A {{trigger.payload_json["after"]["label"]}} was detected.' message: 'A {{trigger.payload_json["after"]["label"]}} was detected.'
data: data:
image: 'https://your.public.hass.address.com/api/frigate/notifications/{{trigger.payload_json["after"]["id"]}}/thumbnail.jpg?format=android' 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: "" description: ""
trigger: trigger:
- platform: mqtt - platform: mqtt
topic: frigate/events topic: frigate/reviews
payload: new payload: alert
value_template: "{{ value_json.type }}" value_template: "{{ value_json['after']['severity'] }}"
action: action:
- service: notify.mobile_app_iphone - service: notify.mobile_app_iphone
data: data:
message: 'A {{trigger.payload_json["after"]["label"]}} was detected.' message: 'A {{trigger.payload_json["after"]["data"]["objects"] | sort | join(", ") | title}} was detected.'
data: data:
image: >- 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"]}}' tag: '{{trigger.payload_json["after"]["id"]}}'
when: '{{trigger.payload_json["after"]["start_time"]|int}}' when: '{{trigger.payload_json["after"]["start_time"]|int}}'
entity_id: camera.{{trigger.payload_json["after"]["camera"] | replace("-","_") | lower}} entity_id: camera.{{trigger.payload_json["after"]["camera"] | replace("-","_") | lower}}
mode: single 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 }}"
```

View File

@ -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. Specific preview frame from preview cache.
### `GET /<camera>/start/<start-timestamp>/end/<end-timestamp>/preview.gif` ### `GET /<camera>/start/<start-timestamp>/end/<end-timestamp>/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 ## Recordings
@ -455,6 +459,10 @@ Reviews from the database. Accepts the following query string parameters:
| `limit` | int | Limit the number of events returned | | `limit` | int | Limit the number of events returned |
| `severity` | str | Limit items to severity (alert, detection, significant_motion) | | `severity` | str | Limit items to severity (alert, detection, significant_motion) |
### `GET /api/review/<id>`
Get review with `id` from the database.
### `GET /api/review/summary` ### `GET /api/review/summary`
Summary of reviews for the last 30 days. Accepts the following query string parameters: Summary of reviews for the last 30 days. Accepts the following query string parameters:

View File

@ -138,13 +138,14 @@ Message published for each changed review item. The first message is published w
"person", "person",
"car" "car"
], ],
"sub_labels": [], "sub_labels": ["Bob"],
"zones": [ "zones": [
"front_yard" "front_yard"
], ],
"audio": [] "audio": []
} }
} }
}
``` ```
### `frigate/stats` ### `frigate/stats`