Post

Home Assistant + AI - Smarter Camera Alerts

Home Assistant + AI - Smarter Camera Alerts

It started with a message from a fellow Home Assistant user struggling with a blueprint. They shared a screenshot of their goal: an automation that snaps a photo when motion is detected and sends it—complete with an AI-generated description—as a mobile notification. I’d only used notifications for simple things, like knowing when a door was left open or the laundry was finished, but I really liked the idea of combining AI with real-time alerts. It didn’t take long to get it working, and I realized it was too useful not to share. So in this post, I’ll walk you through the exact setup, step by step.

Automation Requirements

The main goal of the automation is to send a notification to the phone using the Companion App.

  1. Triggered by the camera detecting motion
  2. Use LLM Vision to analyze the image
  3. Attach the image to the notification
  4. Action to open the camera dashboard
  5. Save the images for 7 days for review

Installing LLM Vision

LLM Vision is a Home Assistant integration available through HACS that uses AI to analyze an image.

To install LLM Vision:

  1. Open HACS
  2. Search for LLM Vision and open it
  3. Click DOWNLOAD
  4. Click DOWNLOAD again on the confirmation popup

After it is downloaded, a restart of Home Assistant is required. Click Settings and use the notification from LLM Vision to restart Home Assistant.

Now we need to add the LLM Vision integration.

  1. Click Settings
  2. Click Devices & Services
  3. Click ADD INTEGRATION
  4. Type LLM Vision into the Search for a brand name box
  5. Click LLM Vision
  6. Choose a provider. I used OpenAI.
  7. Follow the steps required for your provider
  8. Click FINISH

After you have the integration installed, you can add additional entries if you’d like to try other LLM providers.

Now that we have LLM Vision installed, let’s add the LLM Vision Timeline.

  1. Click Add entry
  2. Select Timeline and click Submit
  3. Set 7 days for the Auto delete events after (days)
  4. Click Submit

The LLM Vision Timeline creates a calendar with information about the events. It will automatically delete entries and associated images after the auto-delete period.

Test LLM Vision

Now that we have LLM Vision installed, let’s run a quick test.

  1. Click Developer Tools > ACTIONS
  2. In the Action box, type LLM and select LLM Vision: Image Analyzer
  3. Select the Provider
  4. In the Prompt box, type Describe this image in a few sentences to be used in a mobile notification triggered by motion detected.
  5. Check the Image Entity box and select a camera entity
  6. Set Max tokens to 100
  7. Set Temperature to 0.2
  8. Click PERFORM ACTION

After the image is analyzed by the LLM, the results will be shown below in the Response area.

LLM Vision Test Response Test Response

If you click GO TO YAML MODE, you’ll see the simple YAML that performs this action:

1
2
3
4
5
6
7
8
9
10
11
action: llmvision.image_analyzer
data:
  provider: 01JQ97M2HWGQR20830PGFWDRY7
  message: >-
    Describe this image in a few sentences to be used in a mobile notification
    triggered by motion detected.
  image_entity:
    - camera.front_door
  include_filename: true
  max_tokens: 100
  temperature: 0.2

Creating the Initial Automation

Now that we have LLM Vision installed and tested, we can create the automation. This initial automation will be triggered by motion detected by the camera.

Let’s create the trigger. I’m using the Person Detected entity from my UniFi G4 Doorbell.

  1. Click Settings > Automations & Scenes
  2. Click Create automation
  3. Click Create new automation
  4. Click Add trigger
  5. Click Entity > State
  6. In the Entity box, select the motion entity
  7. Set From to off or clear (depending on your entity)
  8. Set To to on or detected

Next, let’s create the actions.

The first action is to send the camera image to LLM Vision to get a message based on the image analysis.

  1. Click Add action
  2. Type LLM Vision into the search box and select LLM Vision: Image Analyzer
  3. Select your provider
  4. Type your prompt into the Prompt box
    • Example: Write a short, natural-sounding description of a person detected at the front door, based on an image. The description should highlight observable traits like clothing, hair color, accessories, and approximate age or gender, suitable for a smart home notification. Keep the response under 100 tokens.
  5. Check Remember and toggle the switch to update the timeline
  6. Check Image Entity and select your camera
  7. Check Title and toggle the switch to generate a title
  8. In the Response variable box, type llm_response
  9. Check Expose image and toggle the switch to save the key frame image

Expose image saves the image in /config/www/llmvision/

Next, we’ll send the notification using the LLM Vision response and attach the image.

  1. Click Add action
  2. Type Notify into the search box and select **Notifications: Send notification via mobile_app_**

Since we’re using Jinja templates, we need to switch to YAML. Click the ellipsis and choose Edit in YAML.

If you type {{ in the Message box, it will automatically switch to the YAML editor.

Type in the following YAML, replacing <your_device>:

1
2
3
4
5
6
7
8
9
action: notify.mobile_app_<your_device>
metadata: {}
data:
  title: "{{ llm_response.title }}"
  message: "{{ llm_response.response_text }}"
  data:
    image: "{{ llm_response.key_frame.replace('/config/www', '/local') }}"

If you don’t want to use the LLM-generated title, here are two alternatives:

  • Device name: title: "{{ device_attr(device_id(trigger.entity_id), 'name') }}"
  • Entity name: title: "{{ state_attr(trigger.entity_id, 'friendly_name') }}"

Click Save to save your automation and test it out.

Implementing an Actionable Notification

Now that the notification works, let’s add an action to open a camera dashboard.

Update the notification YAML to include the actions dictionary:

1
2
3
4
5
6
7
8
9
10
11
12
13
action: notify.mobile_app_<your_device>
metadata: {}
data:
  title: "{{ llm_response.title }}"
  message: "{{ llm_response.response_text }}"
  data:
    image: "{{ llm_response.key_frame.replace('/config/www', '/local') }}"
    actions:
      - action: uri
        title: Open Cameras
        uri: homeassistant://navigate/mobile/cameras

Replace /mobile/cameras with your actual camera dashboard path.

Click Save and test it out.

Android supports uri: "entityId:<your_camera_entity>" to open the camera feed directly.

iOS supports displaying the camera feed directly in the notification. Replace image with entity_id: camera.<your_camera>. This shows the live feed instead of the snapshot.

iOS notifications iOS Notification

If your camera is in a busy area, consider adding a Delay action at the end of the automation to prevent repeated notifications.

LLM Vision Timeline Card

To complete the setup, let’s add the LLM Vision Timeline card to a dashboard.

First, install the card from HACS.

If you can’t find the LLM Vision Card in HACS, add the custom repository manually. You can find it here: LLM Vision Timeline Card

  1. Open HACS
  2. Search for LLM Vision Card
  3. Select it
  4. Click Download

After downloading, add it to a dashboard. This is a YAML-only card, so here is some example YAML:

1
2
3
4
type: custom:llmvision-card
calendar_entity: calendar.llm_vision_timeline
number_of_events: 4
refresh_interval: 10

Adjust the settings to suit your preferences.

Timeline Card LLM Vision Timeline Card

When you click on an event in the timeline card, it will display the image and details associated with that event.

Timeline Card Details LLM Vision Timeline Card Details

Conclusion

This was a fun little project. Not only did I get to help a fellow Home Assistant user, but I also explored some features I hadn’t tried before. Integrating LLM Vision adds a layer of intelligence and usefulness to camera notifications.

By combining image snapshots, AI-generated descriptions, and actionable alerts, you can create a smart, context-aware notification system that actually tells you what’s happening—without having to open the camera feed every time.

If you’re looking for a weekend project to level up your smart home, this is a great place to start.

This post is licensed under CC BY-SA 4.0 by the author.