Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alias: "Frigate AI Notifications - camera.entity"
- description: ""
- triggers:
- - topic: frigate/events
- payload: "{{ camera }}/new"
- value_template: >-
- {{ value_json['after']['camera'] | lower | replace('-','_') }}/{{
- value_json['type']}}
- id: frigate-event
- trigger: mqtt
- conditions: []
- actions:
- - variables:
- camera_name: "{{ camera | replace('_', ' ') | replace(' cam', '') | title }}"
- object: "{{ trigger.payload_json['after']['label'] }}"
- input_base_url: http://your.ddns:8123
- base_url: "{{ input_base_url.rstrip('/')}}"
- input_local_url: http://your.local.ip:8123
- local_url: "{{ input_local_url.rstrip('/')}}"
- input_labels:
- - person
- - dog
- - cat
- - package
- labels: "{{ input_labels | list | lower }}"
- label: "{{ object | title }}"
- cooldown: 45
- debug: true
- title: ""
- message: A {{ label }} was detected on the {{ camera_name }} camera.
- fps: "{{ states('sensor.' + camera + '_camera_fps')|int(5) }}"
- id: "{{ trigger.payload_json['after']['id'] }}"
- initial_entered_zones: "{{ trigger.payload_json['after']['entered_zones'] |lower}}"
- tap_action: "{{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4"
- icon: >-
- mdi:{{'account-outline' if label == 'Person' else 'dog' if label ==
- 'Dog' else 'cat' if label == 'Cat' else 'car' if label == 'Car' else
- 'home-assistant'}}
- clip_url: "{{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4"
- snapshot_url: "{{base_url}}/api/frigate/notifications/{{id}}/snapshot.jpg"
- update_thumbnail: true
- alert_once: true
- - alias: Notifications enabled for object label
- condition: template
- value_template: "{{ not labels|length or object in labels }}"
- - data_template:
- name: Frigate Notification
- message: |
- DEBUG:
- Info:
- fps: {{fps}},
- frigate event id: {{id}},
- object (formatted): {{object}} ({{label}}),
- Config:
- camera(formatted): {{camera}}({{camera_name}}),
- Base URL: {{base_url}},
- Title: {{title}},
- Message: {{message}},
- Required objects TEST:
- Input: {{input_labels}},
- TEST: {{'PASS' if not labels|length or object in labels else 'FAIL'}}
- action: logbook.log
- - action: notify.mobile_app_phone_name
- data:
- title: "{{title}}"
- message: "{{message}}"
- data:
- tag: "{{ id }}"
- group: "{{ camera }}-frigate-notification"
- notification_icon: "{{icon}}"
- attachment:
- url: /api/frigate/notifications/{{id}}/thumbnail.jpg
- image: /api/frigate/notifications/{{id}}/thumbnail.jpg?format=android
- clickAction: "{{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4"
- push:
- interruption-level: active
- alert_once: "{{alert_once}}"
- actions:
- - action: URI
- title: View Clip
- uri: "{{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4"
- - action: URI
- title: View Summary
- uri: /dashboard-home/event-summaries
- - action: URI
- title: Open Frigate
- uri: http://your.ddns:8971/review
- - repeat:
- sequence:
- - wait_for_trigger:
- - topic: frigate/events
- payload: "{{ id }}"
- value_template: "{{ value_json['after']['id'] }}"
- trigger: mqtt
- timeout:
- minutes: 2
- continue_on_timeout: true
- - variables:
- event: "{{ wait.trigger.payload_json }}"
- new_snapshot: >-
- {{ update_thumbnail and event['before']['snapshot_time'] !=
- event['after']['snapshot_time'] }}
- stationary_moved: >-
- {{ event['after']['position_changes'] >
- event['before']['position_changes'] }}
- sub_label: "{{ event['after']['sub_label']}}"
- sub_label_changed: "{{ sub_label != event['before']['sub_label'] }}"
- update: "{{ alert_once or (new_snapshot and not sub_label_changed) }}"
- title: |
- {% if sub_label %}
- {{sub_label[0]}} was detected on the {{camera_name}} camera.
- {%else%}
- A {{ label }} was detected on the {{ camera_name }} camera.
- {%endif%}
- message: ""
- - data_template:
- name: Frigate Notification
- message: |
- DEBUG (in loop):
- Info:
- Last Zones: {{last_zones}},
- Current zones: {{entered_zones}},
- sublabel: {{sub_label}},
- IOS sound: {{update if not critical else 'yes due critical notifications'}},
- Android Sound: {{'disabled by alert once' if alert_once else 'enabled'}},
- Triggers:
- New Snapshot: {{new_snapshot}},
- Presence Changed: {{presence_changed}},
- stationary moved: {{stationary_moved}},
- entered zones changed: {{entered_zones_changed}},
- sublabel changed: {{sub_label_changed}},
- Conditions:
- Loitering: {{loitering}}
- or
- Presence Entity not home: {{'ON' if presence_entity != '' else 'OFF'}} - {{'PASS' if not home else 'FAIL'}},
- zone filter TEST: {{'ON' if zone_only else 'OFF'}} - {{'PASS' if zone_filter else 'FAIL'}},
- multi-zone filter: {{'OFF' if not zone_only or not zone_multi else 'ON'}} - {{'PASS' if not zone_only or not zone_multi or ( entered_zones|length and zones and zones |reject('in', entered_zones) |list |length == 0 ) else 'FAIL'}},
- state filter TEST: {{'ON' if state_only else 'OFF'}} - {{'PASS' if state_true else 'FAIL'}}
- image: "/api/frigate{{client_id}}/notifications/{{id}}/{{attachment}}.jpg?format=android"
- action: logbook.log
- - alias: Notify on loitering or significant change
- choose:
- - conditions:
- - condition: template
- value_template: "{{new_snapshot or sub_label_changed}}"
- sequence:
- - action: notify.mobile_app_phone_name
- data:
- title: "{{title}}"
- message: "{{message}}"
- data:
- tag: "{{ id }}"
- group: "{{ camera }}-frigate-notification"
- notification_icon: "{{icon}}"
- attachment:
- url: /api/frigate/notifications/{{id}}/thumbnail.jpg
- image: >-
- /api/frigate/notifications/{{id}}/thumbnail.jpg?format=android
- clickAction: >-
- {{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4
- push:
- interruption-level: active
- alert_once: "{{alert_once}}"
- actions:
- - action: URI
- title: View Clip
- uri: >-
- {{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4
- - action: URI
- title: View Summary
- uri: /dashboard-home/event-summaries
- - action: URI
- title: Open Frigate
- uri: http://your.ddns:8971/review
- until:
- - condition: template
- value_template: "{{ not wait.trigger or wait.trigger.payload_json['type'] == 'end' }}"
- - alias: If LLM Vision is Running
- if:
- - condition: state
- entity_id: input_boolean.llm_vision_running
- state: "on"
- then:
- - wait_for_trigger:
- - trigger: state
- entity_id:
- - input_boolean.llm_vision_running
- from: "on"
- to: "off"
- timeout:
- hours: 0
- minutes: 3
- seconds: 0
- milliseconds: 0
- continue_on_timeout: false
- - action: input_boolean.turn_on
- metadata: {}
- data: {}
- target:
- entity_id: input_boolean.llm_vision_running
- - alias: "LLM Vision: Analyze Frigate Clip"
- action: llmvision.video_analyzer
- data:
- remember: true
- provider: llmvision.provider
- frigate_retry_attempts: 15
- frigate_retry_seconds: 60
- max_frames: 20
- include_filename: false
- target_width: 1920
- max_tokens: 500
- temperature: 0.1
- generate_title: true
- expose_images: true
- event_id: "{{id}}"
- message: >-
- Summarize the observed events using clear, neutral third-person
- language. Use the embedded timestamps to determine the correct
- chronological order. Focus only on moving subjects such as people,
- vehicles, packages, pets, lawn equipment, and other active elements.
- Ignore static scenery and objects unless directly interacted with. Only
- include stationary vehicles if clearly identifiable as delivery or
- emergency vehicles—include company names and visible uniform details
- when present. Describe activity specifically along the walkway to the
- back door on the left and the neighbor’s driveway on the right. Do not
- mention timestamps, camera angles, or observers. Present the events as
- if directly witnessed in real time. Avoid introductory or transitional
- phrases like “Here is what happened” or “In this clip,” and do not
- describe events frame by frame. Summarize naturally in a single,
- cohesive narrative. If context strongly suggests a likely outcome (e.g.,
- someone approaching with a package), describe it with confidence. Keep
- the description concise for mobile notifications. Do not mention the
- absence of vehicles, uniforms, or other activity, and do not conclude
- with statements about what was or wasn’t observed.{% if sub_label
- %}These images have already been passed to DeepStack and Double Take and
- {{sub_label[0]}} has been identified, use this knowledge as
- well.{%endif%}
- response_variable: response
- enabled: true
- - action: input_boolean.turn_off
- metadata: {}
- data: {}
- target:
- entity_id: input_boolean.llm_vision_running
- - variables:
- message: "{{response.response_text}}"
- - action: notify.mobile_app_phone_name
- data:
- title: "{{title}}"
- message: "{{message}}"
- data:
- tag: "{{ id }}"
- group: "{{ camera }}-frigate-notification"
- notification_icon: "{{icon}}"
- attachment:
- url: /api/frigate/notifications/{{id}}/thumbnail.jpg
- image: /api/frigate/notifications/{{id}}/thumbnail.jpg?format=android
- clickAction: "{{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4"
- push:
- interruption-level: active
- alert_once: "{{alert_once}}"
- actions:
- - action: URI
- title: View Clip
- uri: "{{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4"
- - action: URI
- title: View Summary
- uri: /dashboard-home/event-summaries
- - action: URI
- title: Open Frigate
- uri: http://your.ddns:8971/review
- trigger_variables:
- input_camera: camera.entity
- camera: "{{ input_camera | replace('camera.', '') }}"
- mode: single
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement