Asking about Events

LLM Vision can remember events and store them so you can ask about them later.

Asking Assist about remembered events

Prerequisites

Prerequisites: You will need to set up LLM Vision Timeline first.

The easiest way to automatically add events to the timeline, is to use the official blueprint. In your own automations, set remember to true. If you want to add custom events, use the remember action.

The Conversation Integration

This guide has been tested with OpenAI Conversation, but should work with Google Generative AI and Anthropic Conversation as well.

To be able to ask about events in the timeline, you need to install and set up one of the integrations mentioned above.

Allow the Conversation Integration access to Assist

In the conversation integration settings you will need to set 'Control Home Assistant' to 'Assist'. This allows the integration to control devices exposed to assist.

Creating the Script

  1. Create a new script with the code below.

  2. Expose the script to assist. Follow this guide to learn how to expose entities to assist.

  3. Set up an assist pipeline in Home Assistant:

    1. 'Add Assistant'

    2. Give it a name and select your conversation integration as the 'Conversation Agent'

    3. (optional) If you want to be able to talk to your Assistant, add a TTS and STT configuration

script.get_camera_events
sequence:
  - variables:
      result:
        events: >-
          {% set titles = state_attr("calendar.llm_vision_timeline","events")%}
          {% set times = state_attr("calendar.llm_vision_timeline","starts") %}
          {% set summaries = state_attr("calendar.llm_vision_timeline","summaries") %}
          ```csv
          time, title, summary
          {%for i in range(titles|count)%}
          {%if times[i] > now() - timedelta(days=1)%}
          {{times[i]}}, '{{titles[i]}}', '{{summaries[i]}}'
          {%endif%}
          {%endfor%}
          ```
  - stop: stop
    response_variable: result
alias: Get Camera Events
description: Returns all events captured by cameras today.
icon: mdi:timeline
fields: {}

You can now ask Assist about events that happened today.

Troubleshooting

If Assist cannot answer questions about events, you may need to include some additional prompting in the system prompt. Instruct it to 'use the get_camera_events tool when asked about events'.

Last updated

Was this helpful?