2020-12-05 02:06:20 +01:00
|
|
|
# Notification examples
|
|
|
|
|
2020-12-13 16:50:06 +01:00
|
|
|
Here are some examples of notifications for the HomeAssistant android companion app:
|
2020-12-05 02:06:20 +01:00
|
|
|
```yaml
|
|
|
|
automation:
|
|
|
|
|
|
|
|
- alias: When a person enters a zone named yard
|
|
|
|
trigger:
|
|
|
|
platform: mqtt
|
|
|
|
topic: frigate/events
|
|
|
|
conditions:
|
2020-12-12 17:36:35 +01:00
|
|
|
- "{{ trigger.payload_json['after']['label'] == 'person' }}"
|
|
|
|
- "{{ 'yard' in trigger.payload_json['after']['entered_zones'] }}"
|
2020-12-05 02:06:20 +01:00
|
|
|
action:
|
|
|
|
- service: notify.mobile_app_pixel_3
|
|
|
|
data_template:
|
2020-12-12 17:36:35 +01:00
|
|
|
message: "A {{trigger.payload_json['after']['label']}} has entered the yard."
|
2020-12-05 02:06:20 +01:00
|
|
|
data:
|
2020-12-12 17:36:35 +01:00
|
|
|
image: "https://url.com/api/frigate/notifications/{{trigger.payload_json['after']['id']}}.jpg"
|
|
|
|
tag: "{{trigger.payload_json['after']['id']}}"
|
2020-12-05 02:06:20 +01:00
|
|
|
|
|
|
|
- alias: When a person leaves a zone named yard
|
|
|
|
trigger:
|
|
|
|
platform: mqtt
|
|
|
|
topic: frigate/events
|
|
|
|
conditions:
|
2020-12-12 17:36:35 +01:00
|
|
|
- "{{ trigger.payload_json['after']['label'] == 'person' }}"
|
|
|
|
- "{{ 'yard' in trigger.payload_json['before']['current_zones'] }}"
|
|
|
|
- "{{ not 'yard' in trigger.payload_json['after']['current_zones'] }}"
|
2020-12-05 02:06:20 +01:00
|
|
|
action:
|
|
|
|
- service: notify.mobile_app_pixel_3
|
|
|
|
data_template:
|
2020-12-12 17:36:35 +01:00
|
|
|
message: "A {{trigger.payload_json['after']['label']}} has left the yard."
|
2020-12-05 02:06:20 +01:00
|
|
|
data:
|
2021-01-16 18:38:19 +01:00
|
|
|
image: "https://url.com/api/frigate/notifications/{{trigger.payload_json['after']['id']}}/thumbnail.jpg"
|
2020-12-12 17:36:35 +01:00
|
|
|
tag: "{{trigger.payload_json['after']['id']}}"
|
2020-12-05 02:06:20 +01:00
|
|
|
|
|
|
|
- alias: Notify for dogs in the front with a high top score
|
|
|
|
trigger:
|
|
|
|
platform: mqtt
|
|
|
|
topic: frigate/events
|
|
|
|
conditions:
|
2020-12-12 17:36:35 +01:00
|
|
|
- "{{ trigger.payload_json['after']['label'] == 'dog' }}"
|
|
|
|
- "{{ trigger.payload_json['after']['camera'] == 'front' }}"
|
|
|
|
- "{{ trigger.payload_json['after']['top_score'] > 0.98 }}"
|
2020-12-05 02:06:20 +01:00
|
|
|
action:
|
|
|
|
- service: notify.mobile_app_pixel_3
|
|
|
|
data_template:
|
|
|
|
message: 'High confidence dog detection.'
|
|
|
|
data:
|
2021-01-16 18:38:19 +01:00
|
|
|
image: "https://url.com/api/frigate/notifications/{{trigger.payload_json['after']['id']}}/thumbnail.jpg"
|
2020-12-12 17:36:35 +01:00
|
|
|
tag: "{{trigger.payload_json['after']['id']}}"
|
|
|
|
```
|
2020-12-13 16:50:06 +01:00
|
|
|
|
|
|
|
If you are using telegram, you can fetch the image directly from Frigate:
|
|
|
|
```yaml
|
|
|
|
automation:
|
|
|
|
- alias: Notify of events
|
|
|
|
trigger:
|
|
|
|
platform: mqtt
|
|
|
|
topic: frigate/events
|
|
|
|
action:
|
|
|
|
- service: notify.telegram_full
|
|
|
|
data_template:
|
|
|
|
message: 'A {{trigger.payload_json["after"]["label"]}} was detected.'
|
|
|
|
data:
|
|
|
|
photo:
|
|
|
|
# this url should work for addon users
|
2021-01-16 18:38:19 +01:00
|
|
|
- url: 'http://ccab4aaf-frigate:5000/api/events/{{trigger.payload_json["after"]["id"]}}/thumbnail.jpg'
|
2020-12-13 16:50:06 +01:00
|
|
|
caption : 'A {{trigger.payload_json["after"]["label"]}} was detected on {{ trigger.payload_json["after"]["camera"] }} camera'
|
|
|
|
```
|