Created
August 6, 2025 00:02
-
-
Save frazhd2/1582994e1de6e6a400f783493556224f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| blueprint: | |
| name: Frigate LLM Notification (v0.5-dev) | |
| author: whag | |
| description: "Basic requirements:<br /> - Home Assistant with an MQTT broker setup. | |
| <br /> - Frigate integration with MQTT setup. <br /> Link: https://github.com/blakeblackshear/frigate-hass-integration | |
| <br /> - LLM Vision integration with provider setup. <br /> Link: https://github.com/valentinfrlch/ha-llmvision | |
| <br /> - Optional Downloader integration. (Ensure the Use Downloader Input is | |
| Set Accordingly) <br /> Link: https://www.home-assistant.io/integrations/downloader/<br | |
| /><br />\nInformation:<br /> - Only suitable for one Frigate camera, use multiple | |
| instances of this automation for multiple cameras if required. <br /> - LLM Vision | |
| requires a provider setup for the automation to function, remember and memory | |
| options are optional. <br /><br /> Description: <br /> Use LLM Vision to analyse | |
| frigate snapshots and clips and send notifications via the Home Assistant companion | |
| app. <br /> Monitors MQTT frigate/reviews topic of types [new] and [end]. <br | |
| /> If you decide to use the Downloader integration for storing the frigate files | |
| locally before sending them to LLM the downloader folder will need maintained | |
| separately (i.e. old files deleted or backed up). This can be achieved automatically | |
| via a shell command or similar <br /> This automation runs in parallel mode. <br | |
| /><br /> Tested on Android only. <br /><br />\nVariables which may be useful for | |
| the custom message and AI prompts\n - {{input_objects}} = Objects required<br | |
| />\n - {{objects}} = Objects found<br />\n - {{input_camera_name}} = Camera | |
| required<br />\n - {{camera_name}} = Camera triggered<br />\n - {{zone_names}} | |
| = Zones required<br />\n - {{before_zones}} = Zones triggered first<br />\n - | |
| {{after_zones}} = Zones triggered last<br />\n - {{detections{0] = Event ID 1 | |
| (i.e.triggering event)<br />\n - {{detections{1] = Event ID 2<br />\n\nVersion: | |
| v 0.5\n" | |
| domain: automation | |
| input: | |
| frigate: | |
| name: Frigate Options | |
| icon: mdi:cctv | |
| description: Frigate options | |
| collapsed: true | |
| input: | |
| in_camera: | |
| name: Frigate Camera | |
| description: Frigate cameras only | |
| selector: | |
| entity: | |
| multiple: false | |
| filter: | |
| - integration: frigate | |
| domain: | |
| - camera | |
| in_severity: | |
| name: Severity | |
| description: Frigate event severity. | |
| default: | |
| - alert | |
| - detection | |
| selector: | |
| select: | |
| options: | |
| - label: Alert | |
| value: alert | |
| - label: Detection | |
| value: detection | |
| multiple: true | |
| sort: false | |
| custom_value: false | |
| in_zones: | |
| name: Frigate Zones | |
| description: Zones required for the alert. Filter will show all frigate | |
| devices(zones and cameras.) | |
| default: [] | |
| selector: | |
| device: | |
| multiple: true | |
| filter: | |
| - integration: frigate | |
| entity: | |
| - domain: | |
| - binary_sensor | |
| in_custom_zones: | |
| name: Custom zones | |
| description: Add any custom zones not shown in the above selector. | |
| default: [] | |
| selector: | |
| text: | |
| multiline: false | |
| multiple: true | |
| in_all_zones: | |
| name: All Zones | |
| description: All zones have to be entered before processing rather than | |
| any. | |
| default: false | |
| selector: | |
| boolean: {} | |
| in_objects: | |
| name: Required Objects | |
| description: Frigate objects required in the selected zones if any. | |
| default: [] | |
| selector: | |
| select: | |
| multiple: true | |
| custom_value: true | |
| options: | |
| - person | |
| - bicycle | |
| - car | |
| - motorcycle | |
| - airplane | |
| - bus | |
| - train | |
| - car | |
| - boat | |
| - traffic light | |
| - fire hydrant | |
| - street sign | |
| - stop sign | |
| - parking meter | |
| - bench | |
| - bird | |
| - cat | |
| - dog | |
| - horse | |
| - sheep | |
| - cow | |
| - elephant | |
| - bear | |
| - zebra | |
| - giraffe | |
| - hat | |
| - backpack | |
| - umbrella | |
| - shoe | |
| - eye glasses | |
| - handbag | |
| - tie | |
| - suitcase | |
| - frisbee | |
| - skis | |
| - snowboard | |
| - sports ball | |
| - kite | |
| - baseball bat | |
| - baseball glove | |
| - skateboard | |
| - surfboard | |
| - tennis racket | |
| - bottle | |
| - plate | |
| - wine glass | |
| - cup | |
| - fork | |
| - knife | |
| - spoon | |
| - bowl | |
| - banana | |
| - apple | |
| - sandwich | |
| - orange | |
| - broccoli | |
| sort: false | |
| in_sub_labels: | |
| name: Sub Labels Required | |
| description: Frigate sub labels required in the selected zones if any. | |
| default: [] | |
| selector: | |
| text: | |
| multiline: false | |
| multiple: true | |
| in_host: | |
| name: Home Assistant IP Address. | |
| description: Home Assistant ip address. | |
| default: http://192.168.1.1:8123 | |
| selector: | |
| text: | |
| multiline: false | |
| multiple: false | |
| llm: | |
| name: LLM Vision Provider / Model | |
| icon: mdi:robot | |
| description: LLM Vision options | |
| collapsed: true | |
| input: | |
| provider_image: | |
| name: Provider For Image Analysis | |
| description: Provider to use for analyse. | |
| selector: | |
| config_entry: | |
| integration: llmvision | |
| model_image: | |
| name: AI Model | |
| description: AI Model | |
| default: gemini-2.0-flash | |
| selector: | |
| select: | |
| options: | |
| - gpt-4o | |
| - gpt-4o-mini | |
| - gpt-4.1 | |
| - claude-3-7-sonnet-latest | |
| - claude-3-5-sonnet-latest | |
| - claude-3-5-haiku-latest | |
| - claude-sonnet-4-20250514 | |
| - claude-opus-4-20250514 | |
| - gemini-1.5-flash | |
| - gemini-1.5-pro | |
| - gemini-2.0-flash | |
| - gemini-2.0-flash-lite | |
| - gemini-2.5-pro | |
| - gemini-2.5-flash | |
| - llama-3.2-90b-vision-preview | |
| - llama-3.2-11b-vision-preview | |
| - Llama-4-Scout-17B-16E-Instruct-FP8 | |
| - Llama-4-Maverick-17B-128E-Instruct-FP8 | |
| - meta-llama/llama-4-maverick-17b-128e-instruct | |
| - meta-llama/llama-4-scout-17b-16e-instruct | |
| multiple: false | |
| custom_value: true | |
| sort: false | |
| provider_clip: | |
| name: Provider For Clip Analysis | |
| description: Provoder to use for the clip analyse. | |
| selector: | |
| config_entry: | |
| integration: llmvision | |
| model_clip: | |
| name: AI Model | |
| description: AI Model | |
| default: gemini-2.0-flash | |
| selector: | |
| select: | |
| options: | |
| - gpt-4o | |
| - gpt-4o-mini | |
| - gpt-4.1 | |
| - claude-3-7-sonnet-latest | |
| - claude-3-5-sonnet-latest | |
| - claude-3-5-haiku-latest | |
| - claude-sonnet-4-20250514 | |
| - claude-opus-4-20250514 | |
| - gemini-1.5-flash | |
| - gemini-1.5-pro | |
| - gemini-2.0-flash | |
| - gemini-2.0-flash-lite | |
| - gemini-2.5-pro | |
| - gemini-2.5-flash | |
| - llama-3.2-90b-vision-preview | |
| - llama-3.2-11b-vision-preview | |
| - Llama-4-Scout-17B-16E-Instruct-FP8 | |
| - Llama-4-Maverick-17B-128E-Instruct-FP8 | |
| multiple: false | |
| custom_value: true | |
| sort: false | |
| image_analyse: | |
| name: Snapshot Analyse | |
| icon: mdi:image | |
| description: Frigate event snapshot analyse options | |
| collapsed: true | |
| input: | |
| in_title_image: | |
| name: No AI Notification Title | |
| description: Notification title for snapshot. If you are using LLM for image | |
| analyse and want a AI generated title ensure [Generate Title] below is | |
| enabled. | |
| default: '{{camera_name}} - {{sub_labels| join('','')|replace(''_'', '' | |
| '')}} Alert' | |
| selector: | |
| text: | |
| multiple: false | |
| multiline: false | |
| in_custom_msg: | |
| name: No AI Notification Message | |
| description: Inital notificaion message if not using LLM Vision for the | |
| snapshot analysis. | |
| default: A {{objects| join(' and a ')|replace('_', ' ')}} was detected in | |
| the {{after_zones| join(' and the ')|replace('_', ' ' )}} | |
| selector: | |
| text: | |
| multiline: true | |
| multiple: false | |
| in_use_llm_image: | |
| name: LLM Vision Snapshot | |
| description: Use LLM Vision for intial snapshot analysis. If off then the | |
| custom message above will be used to generate the notification. | |
| default: true | |
| selector: | |
| boolean: {} | |
| prompt: | |
| name: Prompt | |
| description: Model prompt. | |
| default: Summarise the image in a 1 sentence response, concentrate on the | |
| {{input_objects| join(',')|replace('_', ' ')}} if seen within the {{zone_names| | |
| join(' and ,')|replace('_',' ')}}. Any person approaching the camera should | |
| take priority over all other events. If you see a known person from memory, | |
| mention this in the response. Do not mention the prompt or describe the | |
| environment in your response. The response is an intial alert for a mobile | |
| phone security notification. | |
| selector: | |
| text: | |
| multiline: true | |
| multiple: false | |
| target_width: | |
| name: Pixels | |
| description: Width in pixels to downscale. | |
| default: 1080 | |
| selector: | |
| number: | |
| min: 512.0 | |
| max: 1920.0 | |
| step: 10.0 | |
| mode: slider | |
| tokens: | |
| name: Tokens | |
| description: Maximum number of tokens to generate. | |
| default: 100 | |
| selector: | |
| number: | |
| min: 1.0 | |
| max: 300.0 | |
| step: 1.0 | |
| mode: slider | |
| in_gen_title: | |
| name: Generate Title | |
| description: AI generated notification title. | |
| default: false | |
| selector: | |
| boolean: {} | |
| use_memory: | |
| name: Use Memory | |
| description: Use information stored in memory to provide additional context. | |
| Memory must be setup in LLM Vision. | |
| default: false | |
| selector: | |
| boolean: {} | |
| use_remember: | |
| name: Use Remember | |
| description: Store this event in the timeline. Timeline must be setup in | |
| LLM Vision. | |
| default: false | |
| selector: | |
| boolean: {} | |
| expose_image: | |
| name: Expose Image | |
| description: Save image in llmvision for Timeline. Timeline must be setup | |
| in LLM Vision. | |
| default: false | |
| selector: | |
| boolean: {} | |
| delay_image: | |
| name: Delay Before Image | |
| description: Delay in seconds before processing Frigate snapshot. | |
| default: 2 | |
| selector: | |
| number: | |
| min: 0.0 | |
| max: 60.0 | |
| step: 1.0 | |
| mode: slider | |
| clip_analyse: | |
| name: Review Clip Analyse | |
| icon: mdi:video | |
| collapsed: true | |
| description: Frigate review clip analyse options | |
| input: | |
| in_title_clip: | |
| name: No AI Notification Title | |
| description: Notification title for review clip. If you want a AI generated | |
| title ensure [Generate Title] below is enabled. | |
| default: '{{camera_name}} - {{sub_labels| join('','')|replace(''_'', '' | |
| '')}} Alert Update' | |
| selector: | |
| text: | |
| multiline: false | |
| multiple: false | |
| prompt2: | |
| name: Prompt | |
| description: Model prompt. | |
| default: Analyse the video clip which should contain the following objects | |
| {{input_objects| join(',')|replace('_', ' ')}} The areas of interest are | |
| the {{zone_names| join(' and ,')|replace('_',' ')}} Focus on the objects | |
| referenced previously which are entering the areas of interest and describe | |
| what they are doing. Consider what the {{input_objects|join(',')|replace('_',' | |
| ')}} is doing, why, and what it might do next. Do not mention the prompt | |
| or describe the environment in your response. Your response will be used | |
| for a mobile phone notification message with the clip attached. | |
| selector: | |
| text: | |
| multiline: true | |
| multiple: false | |
| target_width2: | |
| name: Pixels | |
| description: Width in pixels to downscale. | |
| default: 1080 | |
| selector: | |
| number: | |
| min: 512.0 | |
| max: 1920.0 | |
| step: 10.0 | |
| mode: slider | |
| tokens2: | |
| name: Tokens | |
| description: Maximum number of tokens to generate. | |
| default: 100 | |
| selector: | |
| number: | |
| min: 1.0 | |
| max: 300.0 | |
| step: 1.0 | |
| mode: slider | |
| max_frames: | |
| name: Max Frames | |
| description: How many frames to analyse for clip. | |
| default: 3 | |
| selector: | |
| number: | |
| min: 1.0 | |
| max: 10.0 | |
| step: 1.0 | |
| mode: slider | |
| in_gen_title2: | |
| name: Generate Title | |
| description: AI generated clip title. | |
| default: false | |
| selector: | |
| boolean: {} | |
| use_memory2: | |
| name: Use Memory | |
| description: Use information stored in memory to provide additional context. | |
| Memory must be setup in LLM Vision. | |
| default: false | |
| selector: | |
| boolean: {} | |
| use_remember2: | |
| name: Use Remember | |
| description: Store this event in the timeline. Timeline must be setup in | |
| LLM Vision. | |
| default: false | |
| selector: | |
| boolean: {} | |
| expose_clip: | |
| name: Expose Clip | |
| description: Save clip in llmvision for Timeline. Timeline must be setup | |
| in LLM Vision. | |
| default: false | |
| selector: | |
| boolean: {} | |
| delay_clip: | |
| name: Delay Before Clip | |
| description: Time in seconds before processing the Frigate clip. | |
| default: 2 | |
| selector: | |
| number: | |
| min: 0.0 | |
| max: 60.0 | |
| step: 1.0 | |
| mode: slider | |
| frigate_retry_attempts: | |
| name: Frigate Max Retry Amount | |
| description: In the event the frigate clip is not available set the amount | |
| of times to retry fetching the file. | |
| default: 3 | |
| selector: | |
| number: | |
| min: 1.0 | |
| max: 10.0 | |
| step: 1.0 | |
| mode: slider | |
| frigate_retry_seconds: | |
| name: Frigate Max Retry Delay In Seconds | |
| description: Time between retrys | |
| default: 1 | |
| selector: | |
| number: | |
| min: 1.0 | |
| max: 10.0 | |
| step: 1.0 | |
| mode: slider | |
| Downloader: | |
| name: Downloader Options | |
| icon: mdi:download | |
| collapsed: true | |
| input: | |
| in_use_downloader: | |
| name: Use The Downloader Integration | |
| description: Store the image/clip locally using HA Downloader integration, | |
| and use the local files for LLM Vision analysis. If this input is false | |
| this section can be ignored. LLM Vision. | |
| default: false | |
| selector: | |
| boolean: {} | |
| in_downloader: | |
| name: Downloader Directory | |
| description: Downloader integration root directory. | |
| default: downloader | |
| selector: | |
| text: | |
| multiline: false | |
| multiple: false | |
| in_downloader_sub: | |
| name: Downloader Sub Directory | |
| description: Define a sub directory within your downloader root directory. | |
| default: | |
| selector: | |
| text: | |
| multiline: false | |
| multiple: false | |
| download_image_wait: | |
| name: Image Download Max Wait Time | |
| description: Maximum time to wait in seconds for the frigate image to be | |
| downloaded before retrying download. | |
| default: 5 | |
| selector: | |
| number: | |
| min: 1.0 | |
| max: 120.0 | |
| step: 1.0 | |
| mode: slider | |
| download_clip_wait: | |
| name: Clip Download Max Wait Time | |
| description: Maximum time to wait in seconds for the frigate clip to be | |
| downloaded before retrying download. | |
| default: 30 | |
| selector: | |
| number: | |
| min: 1.0 | |
| max: 120.0 | |
| step: 1.0 | |
| mode: slider | |
| notify: | |
| name: Notification Options | |
| icon: mdi:phone | |
| collapsed: true | |
| input: | |
| in_notify_devices: | |
| name: Notify Devices | |
| description: The devices to send the notification to. Multiple devices may | |
| be used. Only works with Home Assistant Companion mobile app. | |
| default: [] | |
| selector: | |
| device: | |
| multiple: true | |
| filter: | |
| - integration: mobile_app | |
| click_action1: | |
| name: Click Action New Event | |
| description: Notification Click Action for New Event Notification . Default | |
| used is a Lovelace URL. | |
| default: /lovelace | |
| selector: | |
| select: | |
| options: | |
| - label: Lovelace URL | |
| value: /Lovelace | |
| - label: View Snapshot | |
| value: '{{image}}' | |
| - label: View Clip | |
| value: '{{video}}' | |
| - label: View Thumbnail | |
| value: '{{thumb}}' | |
| - label: View Snapshot with bounding box | |
| value: '{{image}}?bbox=1' | |
| - label: View Review GIF | |
| value: '{{gif}}' | |
| mode: dropdown | |
| custom_value: true | |
| sort: false | |
| multiple: false | |
| click_action2: | |
| name: Click Action End Event | |
| description: Notification Click Action For End Event Notification . Default | |
| used is a Lovelace URL. | |
| default: /lovelace | |
| selector: | |
| select: | |
| options: | |
| - label: Lovelace URL | |
| value: /Lovelace | |
| - label: View Snapshot | |
| value: '{{image}}' | |
| - label: View Clip | |
| value: '{{video}}' | |
| - label: View Thumbnail | |
| value: '{{thumb}}' | |
| - label: View Snapshot with bounding box | |
| value: '{{image}}?bbox=1' | |
| - label: View Review GIF | |
| value: '{{gif}}' | |
| mode: dropdown | |
| custom_value: true | |
| sort: false | |
| multiple: false | |
| cooldown: | |
| name: Cooldown | |
| description: Time in minutes to wait before running this automation again. | |
| default: 2 | |
| selector: | |
| number: | |
| min: 0.0 | |
| max: 60.0 | |
| step: 1.0 | |
| mode: slider | |
| Actions: | |
| name: Custom Actions | |
| icon: mdi:arrow-all | |
| collapsed: true | |
| input: | |
| in_action1: | |
| name: New Event Custom Actions | |
| description: Custom action to run on new event. | |
| default: [] | |
| selector: | |
| action: {} | |
| in_action2: | |
| name: End Event Custom Actions | |
| description: Custom action to run on end event. | |
| default: [] | |
| selector: | |
| action: {} | |
| Logbook: | |
| name: Logbook | |
| icon: mdi:pen | |
| collapsed: true | |
| input: | |
| in_enable_log: | |
| name: Enable Logbook Event | |
| description: Enable automaton logbook entry. | |
| default: false | |
| selector: | |
| boolean: {} | |
| source_url: https://github.com/willhaggan/HA_Frigate_VLLM_Notification/blob/0.5-dev/Latest.yaml | |
| triggers: | |
| - trigger: mqtt | |
| topic: '{{frigate_topic}}' | |
| payload: new | |
| value_template: '{{value_json[''type'']}}' | |
| id: New event | |
| - trigger: mqtt | |
| topic: '{{frigate_topic}}' | |
| payload: end | |
| value_template: '{{value_json[''type'']}}' | |
| id: End event | |
| conditions: | |
| - condition: template | |
| value_template: '{{camera_match}}' | |
| alias: Valid Camera | |
| - condition: template | |
| value_template: '{{objects_match}}' | |
| alias: Object Matched | |
| - condition: template | |
| value_template: '{{sub_labels_match}}' | |
| alias: Sub Label Matched | |
| - condition: template | |
| value_template: '{{zone_match}}' | |
| alias: Valid Zone | |
| - condition: template | |
| value_template: '{{severity_match}}' | |
| alias: Valid Alert | |
| actions: | |
| - if: | |
| - condition: template | |
| value_template: '{{enable_log}}' | |
| then: | |
| - action: logbook.log | |
| metadata: {} | |
| data: | |
| name: LLM Vision Frigate Notification log | |
| entity_id: '{{this.entity_id}}' | |
| message: '___Event type: {{type}} ___Review id: {{review_id}} ___Input camera: | |
| {{input_camera}} ___Camera triggered: {{input_camera_name}} ___Detections | |
| ID''s: {{detections}} ___Detection 1 ID: {{id}} ___Objects required: {{input_objects}} | |
| ___Objects found: {{objects}} ___Object match: {{objects_match}} ___Sub Labels | |
| required: {{input_sub_labels}} ___Sub Labels found: {{sub_labels}} ___Sub | |
| Labels match: {{sub_labels_match}} ___Zones required: {{zone_names}} ___Zones | |
| triggered before: {{before_zones}} ___Zones triggered after: {{after_zones}} | |
| ___Zone match: {{zone_match}} ___Notify devices: {{notify_names}} ___Downloader | |
| root: {{root_dir}} ___Downloader sub: {{sub_dir}} ___Thumb url {{thumb}} ___Snapshot | |
| url {{image}} ___Clip url {{video}} ___GIF url {{gif}}___' | |
| - alias: Event is new start LLM image analysis and send notification | |
| if: | |
| - condition: trigger | |
| id: | |
| - New event | |
| then: | |
| - delay: | |
| hours: 0 | |
| minutes: 0 | |
| seconds: 2 | |
| milliseconds: 0 | |
| - parallel: | |
| - alias: Run Custom Actions New | |
| choose: | |
| - conditions: '{{action1|length != 0}}' | |
| sequence: !input in_action1 | |
| - alias: Repeat Until file exists or 2 retries | |
| repeat: | |
| sequence: | |
| - alias: Downloader Integration Enabled | |
| if: | |
| - condition: template | |
| value_template: '{{use_downloader}}' | |
| then: | |
| - action: downloader.download_file | |
| continue_on_error: true | |
| metadata: {} | |
| data: | |
| overwrite: true | |
| url: '{{host}}{{image}}' | |
| subdir: '{{sub_dir}}' | |
| filename: '{{id}}_snapshot.jpg' | |
| - alias: Wait for downloader to complete | |
| wait_for_trigger: | |
| - trigger: event | |
| event_type: downloader_download_completed | |
| event_data: | |
| url: '{{host}}{{image}}' | |
| filename: '{{id}}_snapshot.jpg' | |
| id: image_exists | |
| continue_on_timeout: true | |
| timeout: | |
| hours: 0 | |
| minutes: 0 | |
| seconds: !input download_image_wait | |
| milliseconds: 0 | |
| - alias: If Downloader is enabled wait until the image is downloaded then | |
| run LLM Image Analysis, if Downloader disabled continue | |
| if: | |
| - condition: template | |
| value_template: '{{ (wait is defined and wait.trigger.id == "image_exists") | |
| or (use_downloader == false) }}' | |
| then: | |
| - delay: | |
| hours: 0 | |
| minutes: 0 | |
| seconds: !input delay_image | |
| milliseconds: 0 | |
| - variables: | |
| image_file: '{{image_local if use_downloader else image}}' | |
| - if: | |
| - condition: template | |
| value_template: '{{use_llm_image}}' | |
| then: | |
| - action: llmvision.video_analyzer | |
| data: | |
| provider: !input provider_image | |
| model: !input model_image | |
| remember: !input use_remember | |
| expose_images: !input expose_image | |
| use_memory: !input use_memory | |
| image_file: '{{image_file}}' | |
| max_frames: 1 | |
| message: !input prompt | |
| include_filename: false | |
| target_width: !input target_width | |
| max_tokens: !input tokens | |
| generate_title: '{{gen_title}}' | |
| frigate_retry_attempts: !input frigate_retry_attempts | |
| frigate_retry_seconds: !input frigate_retry_seconds | |
| response_variable: response | |
| - delay: | |
| hours: 0 | |
| minutes: 0 | |
| seconds: 5 | |
| milliseconds: 0 | |
| - variables: | |
| title: '{{response.response_title if gen_title else title_image}}' | |
| msg: '{{response.response_text}}' | |
| else: | |
| - variables: | |
| title: '{{title_image}}' | |
| msg: '{{custom_msg}}' | |
| - alias: Send Intial notification to notify devices | |
| repeat: | |
| for_each: '{{notify_names}}' | |
| sequence: | |
| - action: notify.{{ repeat.item }} | |
| data: | |
| title: '{{title}}' | |
| message: '{{msg}}' | |
| data: | |
| image: '{{thumb}}' | |
| entity_id: '{{input_camera}}' | |
| url: !input click_action1 | |
| clickAction: !input click_action1 | |
| group: '{{camera}}-frigate-notification' | |
| tag: '{{id}}' | |
| ttl: 0 | |
| priority: high | |
| - delay: | |
| hours: 0 | |
| minutes: !input cooldown | |
| seconds: 0 | |
| milliseconds: 0 | |
| alias: Cooldown | |
| until: | |
| - condition: template | |
| value_template: '{{ (wait is defined and wait.trigger.id == "image_exists") | |
| or (use_downloader == false) }}' | |
| - alias: Event is end Do LLM video analysis and send notification | |
| if: | |
| - condition: trigger | |
| id: | |
| - End event | |
| then: | |
| - delay: | |
| hours: 0 | |
| minutes: 0 | |
| seconds: 5 | |
| milliseconds: 0 | |
| - parallel: | |
| - alias: Run Custom Actions End | |
| choose: | |
| - conditions: '{{action2|length != 0}}' | |
| sequence: !input in_action2 | |
| - repeat: | |
| sequence: | |
| - alias: Downloader Integration Enabled | |
| if: | |
| - condition: template | |
| value_template: '{{use_downloader}}' | |
| then: | |
| - action: downloader.download_file | |
| continue_on_error: true | |
| metadata: {} | |
| data: | |
| overwrite: true | |
| url: '{{host}}{{video}}' | |
| subdir: '{{sub_dir}}' | |
| filename: '{{id}}_clip.mp4' | |
| - alias: Wait for downloader to complete | |
| wait_for_trigger: | |
| - trigger: event | |
| event_type: downloader_download_completed | |
| event_data: | |
| url: '{{host}}{{video}}' | |
| filename: '{{id}}_clip.mp4' | |
| id: clip_exists | |
| continue_on_timeout: true | |
| timeout: | |
| hours: 0 | |
| minutes: 0 | |
| seconds: !input download_clip_wait | |
| milliseconds: 0 | |
| - delay: | |
| hours: 0 | |
| minutes: 0 | |
| seconds: !input delay_clip | |
| milliseconds: 0 | |
| - variables: | |
| video_file: '{{video_local if use_downloader else video}}' | |
| - alias: If Downloader is enabled wait until the clip is downloaded then run | |
| LLM video Analysis, if Downloader disabled continue | |
| if: | |
| - condition: template | |
| value_template: '{{ (wait is defined and wait.trigger.id == "clip_exists") | |
| or (use_downloader == false) }}' | |
| then: | |
| - action: llmvision.video_analyzer | |
| metadata: {} | |
| data: | |
| provider: !input provider_clip | |
| model: !input model_clip | |
| remember: !input use_remember2 | |
| expose_images: !input expose_clip | |
| use_memory: !input use_memory2 | |
| video_file: '{{video_file}}' | |
| max_frames: !input max_frames | |
| include_filename: false | |
| target_width: !input target_width2 | |
| max_tokens: !input tokens2 | |
| generate_title: '{{gen_title2}}' | |
| message: !input prompt2 | |
| frigate_retry_attempts: !input frigate_retry_attempts | |
| frigate_retry_seconds: !input frigate_retry_seconds | |
| response_variable: response | |
| - delay: | |
| hours: 0 | |
| minutes: 0 | |
| seconds: 1 | |
| milliseconds: 0 | |
| - alias: Update notification to notify devices | |
| repeat: | |
| for_each: '{{notify_names}}' | |
| sequence: | |
| - action: notify.{{ repeat.item }} | |
| data: | |
| title: '{{response.title if gen_title2 else title_clip}}' | |
| message: '{{response.response_text}}' | |
| data: | |
| video: '{{gif}}' | |
| image: '{{gif}}' | |
| entity_id: '{{input_camera}}' | |
| url: !input click_action2 | |
| clickAction: !input click_action2 | |
| group: '{{camera}}-frigate-notification' | |
| tag: '{{id}}' | |
| interruption-level: active | |
| ttl: 0 | |
| priority: high | |
| - delay: | |
| hours: 0 | |
| minutes: !input cooldown | |
| seconds: 0 | |
| milliseconds: 0 | |
| alias: Cooldown | |
| until: | |
| - condition: template | |
| value_template: '{{ (wait is defined and wait.trigger.id == "clip_exists") | |
| or (use_downloader == false) }}' | |
| trigger_variables: | |
| frigate_topic: frigate/reviews | |
| variables: | |
| frigate_topic: frigate/reviews | |
| enable_log: !input in_enable_log | |
| input_camera: !input in_camera | |
| input_objects: !input in_objects | |
| input_sub_labels: !input in_sub_labels | |
| input_zones: !input in_zones | |
| custom_zones: !input in_custom_zones | |
| all_zones: !input in_all_zones | |
| host: !input in_host | |
| use_downloader: !input in_use_downloader | |
| downloader: !input in_downloader | |
| downloader_sub: !input in_downloader_sub | |
| notify_devices: !input in_notify_devices | |
| use_llm_image: !input in_use_llm_image | |
| gen_title: !input in_gen_title | |
| gen_title2: !input in_gen_title2 | |
| event: '{{ trigger.payload_json }}' | |
| type: '{{event[''type'']}}' | |
| review_id: '{{event[''after''][''id'']}}' | |
| input_camera_name: '{{input_camera|expand|map(attribute=''attributes.camera_name'', | |
| default=''none'')|list}}' | |
| camera: '{{event[''after''][''camera'']}}' | |
| camera_name: '{{ camera | replace(''_'', '' '') | title }}' | |
| camera_match: '{{input_camera_name|select(''equalto'', camera)|list|length>0 }}' | |
| detections: '{{ event[''after''][''data''][''detections''] }}' | |
| id: '{{ detections[0] }}' | |
| objects: '{{ event[''after''][''data''][''objects'']}}' | |
| objects_match: '{{input_objects | length == 0 or (input_objects |select(''in'', | |
| objects) |list |length > 0) }}' | |
| sub_labels: '{{ event[''after''][''data''][''sub_labels'']}}' | |
| sub_labels_match: '{{input_sub_labels | length == 0 or (input_sub_labels |select(''in'', | |
| sub_labels) |list |length > 0) }}' | |
| zone_names: '{% set device_zones = input_zones %} {% set zones = device_zones + | |
| custom_zones %} {% set ns = namespace(device_names=[]) %} {% for device_id in | |
| zones %} {% if device_attr(device_id, "name") != None %} {% set device_name = | |
| device_attr(device_id, "name") %} {% set sanitized_name = device_name | lower | |
| | regex_replace("[^a-z0-9_\- ]", "") | replace(" ", "_") | replace("-", "_") %} | |
| {% set ns.device_names = ns.device_names + [sanitized_name] %} {% else%} {% set | |
| ns.device_names = ns.device_names + [device_id | lower | regex_replace("[^a-z0-9_\- | |
| ]", "") | replace(" ", "_") | replace("-", "_")] %} {% endif %} {% endfor %} {{ | |
| ns.device_names }}' | |
| before_zones: '{{ event[''before''][''data''][''zones''] | lower | default([]) }}' | |
| after_zones: '{{ event[''after''][''data''][''zones''] | lower | default([]) }}' | |
| zone_entered: '{{ zone_names | length == 0 or ((zone_names | select(''in'', (before_zones | |
| + after_zones)) |list |length) > 0) }}' | |
| all_zones_entered: '{{true if (zone_names | reject(''in'',(before_zones + after_zones)) | |
| | list | length == 0 and all_zones) or all_zones == false else false }}' | |
| zone_match: '{{zone_entered and all_zones_entered}}' | |
| input_severity: !input in_severity | |
| severity: '{{event[''before''][''severity''] + event[''after''][''severity'']}}' | |
| severity_match: '{{input_severity|select(''in'', severity)|list|length > 0}}' | |
| notify_names: "{% set ns = namespace(device_names=[]) %} {% for device_id in notify_devices%}\n | |
| \ {% set device_name = device_attr(device_id, \"name\") %}\n {% set sanitized_name | |
| = \"mobile_app_\" + device_name | lower | regex_replace(\"[^a-z0-9_\\- ]\", \"\") | |
| | replace(\" \", \"_\") | replace(\"-\", \"_\") %}\n {% set ns.device_names = | |
| ns.device_names + [sanitized_name] %}\n{% endfor %} {{ ns.device_names }}" | |
| root_dir: "{% set dir = downloader|trim %} {%if dir|length > 0%}\n {% if dir[-1] | |
| != \"/\" %}\n {% set dir = dir + \"/\" %}\n {% endif%}\n{% endif%} {{dir}}" | |
| sub_dir: "{% set dir = downloader_sub|trim %} {%if dir|length > 0%}\n {% if dir[-1] | |
| != \"/\" %}\n {% set dir = dir + \"/\" %}\n {% endif%}\n{% endif%} {{dir}}" | |
| video: /api/frigate/notifications/{{id}}/{{camera}}/clip.mp4 | |
| video_local: '{{root_dir}}{{sub_dir}}{{id}}_clip.mp4' | |
| thumb: /api/frigate/notifications/{{id}}/thumbnail.jpg | |
| image: /api/frigate/notifications/{{id}}/snapshot.jpg | |
| image_local: '{{root_dir}}{{sub_dir}}{{id}}_snapshot.jpg' | |
| gif: /api/frigate/notifications/{{review_id}}/review_preview.gif | |
| custom_msg: !input in_custom_msg | |
| title_image: !input in_title_image | |
| title_clip: !input in_title_clip | |
| action1: !input in_action1 | |
| action2: !input in_action2 | |
| mode: parallel | |
| max: 4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment