# Blueprint

A blueprint is a script or automation configuration with certain parts marked as configurable. This makes it easy to share them so you don't have to start from scratch.

## Event Summary

{% hint style="success" %}
Event Summary is updated with every LLM Vision update. To keep your automations compatible and to get new features, you should re-import blueprints after LLM Vision updates. See [Home Assistant docs](https://www.home-assistant.io/docs/automation/using_blueprints/#to-re-import-a-blueprint) for more information.
{% endhint %}

{% hint style="info" %}
You can also enter the following url to import the blueprint:

```url
https://raw.githubusercontent.com/valentinfrlch/ha-llmvision/refs/heads/main/blueprints/event_summary.yaml
```

{% endhint %}

[![Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.](https://my.home-assistant.io/badges/blueprint_import.svg)](https://my.home-assistant.io/redirect/blueprint_import/?blueprint_url=https%3A%2F%2Fraw.githubusercontent.com%2Fvalentinfrlch%2Fha-llmvision%2Frefs%2Fheads%2Fmain%2Fblueprints%2Fevent_summary.yaml)

<details>

<summary>Dependencies</summary>

For this blueprint to work you need these additional integrations installed:

1. [LLM Vision](https://github.com/valentinfrlch/ha-llmvision) which handles processing and communicates with your AI provider of choice.
2. An integration that exposes camera entities and optionally binary sensors for object detection.\
   **Recommended**: Frigate with its [Home Assistant Integration](https://docs.frigate.video/integrations/home-assistant/).

</details>

Say hello to intelligent security event notifications!\
AI understands what happens in the video, decides whether you should be notified and sends you notifications with a preview and summary of what happened.

Customize your notification preferences by choosing to receive all updates or utilizing AI to filter for important events only. This can be configured using the `important` parameter. Using AI will add a slight delay to your notifications (<5 seconds when using OpenAI).

When an event is detected, you'll receive a notification with basic information including the camera name. Event summarization continues in the background and the notification is updated once the summary is available.

<figure><img src="https://2802862115-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFIhUccwfwWnHypSNsrKL%2Fuploads%2FyvE5yoQxHPqMVZOXND8e%2Fnotification_ios.gif?alt=media&#x26;token=a49047d1-bcd3-48e2-b7d9-ec0fbf6dc732" alt="" width="450"><figcaption><p>Notifications are dynamically updated when summary is available</p></figcaption></figure>

Notifications will play a live preview of the camera (iOS only, Android will show a snapshot). If you use Frigate, the [official Frigate integration for Home Assistant](https://docs.frigate.video/integrations/home-assistant/) needs to be installed.

You can customize which dashboard opens in the Home Assistant app when you tap the notification using the `tap_navigate` parameter.

Additionally, a cooldown can be set. This prevents the automation from running too often, which may result in excessive cost from your AI provider.

For additional configuration, see the reference below.

### Configuration Reference

**Run Conditions Section**

| Parameter        | Description                                                   | Default    |
| ---------------- | ------------------------------------------------------------- | ---------- |
| `run_conditions` | All conditions must be true in order for the blueprint to run | \[]        |
| `cooldown`       | Time to wait before running automation again                  | 10 minutes |

**Camera & Sensor Section**

| Parameter           | Description                                         | Default   |
| ------------------- | --------------------------------------------------- | --------- |
| `camera_entities`   | List of camera entities to monitor                  | \[]       |
| `trigger_state`     | Automation starts when camera changes to this state | recording |
| `motion_sensors`    | Set if cameras don't change state (Frigate)         | \[]       |
| <kbd>duration</kbd> | Duration to record for analysis (seconds)           | 5         |
| `max_frames`        | How many frames to analyze                          | 3         |

**AI Section**

| Parameter      | Description                        | Default                                      |
| -------------- | ---------------------------------- | -------------------------------------------- |
| `remember`     | Stores event in Timeline           | false                                        |
| `use_memory`   | Use stored information for context | false                                        |
| `message`      | Model prompt for video analyzer    | Long default prompt about summarizing events |
| `provider`     | Provider to use for analysis       |                                              |
| `model`        | Which model to use                 |                                              |
| `target_width` | Downscale images width             | 1280                                         |
| `max_tokens`   | Maximum tokens to generate         | 20                                           |
| `temperature`  | Randomness level                   | 0.1                                          |

**Notification Section**

| Parameter               | Description                                           | Default                |
| ----------------------- | ----------------------------------------------------- | ---------------------- |
| `notify`                | Send notification to phone                            | true                   |
| `condition_notify`      | Condition to notify device                            | \[]                    |
| `notify_device`         | Devices to send notification to                       | \[]                    |
| `notification_delivery` | Controls how notifications are delivered              | Dynamic                |
| `preview_mode`          | Choose between live preview or snapshot               | Snapshot               |
| `file_path`             | File path for snapshot storage                        | Media Folder - Secured |
| `tap_navigate`          | Dashboard to navigate on notification tap             | /lovelace/0            |
| `delay_notification`    | Time before sending another notification (in seconds) | 60                     |

**Experimental Section**

| Parameter            | Description                             | Default |
| -------------------- | --------------------------------------- | ------- |
| `important`          | Use AI to classify events by importance | false   |
| `additional_actions` | Additional actions after AI analysis    | \[]     |
