# Asking about Events

<figure><img src="/files/YkhDN1yBh1rcglGFEkMj" alt=""><figcaption><p>Asking Assist about remembered events</p></figcaption></figure>

### Adding Events to the Timeline

The easiest way to automatically add events to the timeline, is to use the [official blueprint](/getting-started/setup/blueprint.md). In your own automations, set `remember` to `true`. If you want to add custom events, use the [`remember` action](/getting-started/usage/create-event.md).

### The Conversation Integration

{% hint style="info" %}
This guide has been tested with [OpenAI Conversation](https://www.home-assistant.io/integrations/openai_conversation/), but should work with [Google Generative AI](https://www.home-assistant.io/integrations/google_generative_ai_conversation/) and [Anthropic Conversation](https://www.home-assistant.io/integrations/anthropic/) as well.
{% endhint %}

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

<details>

<summary>Why do I need to create this script?</summary>

Exposing calendar entities to Assist only exposes their current state (on or off) and the title of the next event. Since all events on the timeline are in the past, a script is needed to return the events.

</details>

1. Create a new script with the code below.
2. Expose the script to assist. Follow [this guide](https://www.home-assistant.io/voice_control/voice_remote_expose_devices/) to learn how to expose entities to assist.
3. Set up an assist pipeline in Home Assistant:
   1. Go to [Settings > Voice Assistants](https://my.home-assistant.io/redirect/voice_assistants)
   2. 'Add Assistant'
   3. Give it a name and select your conversation integration as the 'Conversation Agent'
   4. (optional) If you want to be able to talk to your Assistant, add a TTS and STT configuration

{% hint style="info" %}
This script will return events from the past day. To return more, change `timedelta(days=1)` to e.g. `timedelta(days=7)`.&#x20;

Note that processing many events can lead to high token usage.
{% endhint %}

{% code title="script.get\_camera\_events" %}

````yaml
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: {}
````

{% endcode %}

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'.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://llmvision.gitbook.io/getting-started/setup/asking-about-events.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
