Ollama

The Ollama integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] lets you run AI locally, on your own hardware. Ollama is a server that runs AI models on a computer in your home, instead of in a cloud service. The integration connects Home Assistant to your Ollama server and adds conversation agentsSoftware that Home Assistant uses to understand a request and decide what to do. Home Assistant has a built-in conversation agent. Integrations can add others, including ones that use AI. Conversation agents that use AI can also use AI tools. Each assistant uses a conversation agent. [Learn more] and AI tasks that use its models.

  • A conversation agent lets you talk to the model with AssistThe voice assistant built into Home Assistant. You can use Assist by talking or typing in the Home Assistant web interface and in the Home Assistant Companion app. You can also use it by talking through a voice satellite. You can set up several assistants, each with its own language and conversation agent. [Learn more]. With the Device control set of AI toolsA function that conversation agents and AI apps can use to read information, control entities, or manage Home Assistant. AI tools are grouped into sets. Each set provides different functionality. Some sets only work for administrators. [Learn more], it can also give you information about your devices and control them. It can only reach the entitiesAn entity represents a sensor, actor, or function in Home Assistant. Entities are used to monitor physical properties or to control other entities. An entity is usually part of a device or a service. [Learn more] that you expose to Assist.
  • An AI task lets your automations and scripts use the model to generate data. For example, it can return the data in a structure that you define. If your model supports images, it can also describe a camera image. AI tasks only accept images as attachments.

When you talk to an Ollama conversation agent through an assistantA configuration of Assist with its own name, language, and conversation agent. An assistant can also use speech-to-text to understand spoken commands and text-to-speech to reply out loud., Home Assistant first checks your sentence triggers. If one of them matches, the sentence trigger answers, and the conversation agent doesn’t get the sentence. Sentence triggers don’t run when you call the conversation agent directly, for example with the conversation.process action. They also don’t run when you answer a follow-up question from the conversation agent.

Prerequisites

  1. Install the Ollama server on a computer in your network. This computer runs the AI models. Ollama is available for macOS, Linux, and Windows. For the steps, refer to the Ollama download instructions.
  2. Make the Ollama server accessible over your network, so that Home Assistant can reach it. For the steps, refer to How can I expose Ollama on my network? in the Ollama FAQ.

Configuration

To add the Ollama service to your Home Assistant instance, use this My button:

Manual configuration steps

If the above My button doesn’t work, you can also perform the following steps manually:

URL

The URL of your Ollama server, such as http://192.168.1.10:11434.

API key

The API key for your Ollama server. Leave it empty if your Ollama server doesn’t require authentication.

Configuration options

The integration adds conversation agentsSoftware that Home Assistant uses to understand a request and decide what to do. Home Assistant has a built-in conversation agent. Integrations can add others, including ones that use AI. Conversation agents that use AI can also use AI tools. Each assistant uses a conversation agent. [Learn more] and AI tasks as separate entries on the integration page. When you set up the integration, it doesn’t add any of them yet.

  • To add one, go to Settings > Devices & services, select Ollama, and then select Add conversation agent or Add AI task.
  • To change one later, select Reconfigure conversation agent or Reconfigure AI task in its row.

If the model isn’t on your Ollama server yet, Home Assistant downloads it when you save the conversation agent or AI task. The Downloading model screen shows that the download is in progress. Depending on the size of the model, this can take a long time.

Conversation agents and AI tasks have the following options. Instructions and AI tools are only available for conversation agents.

Name

The name of the conversation agent or AI task. You set it when you add it. To change it later, select the three dots menu in its row, and then select Rename. The default is Ollama Conversation for a conversation agent and Ollama AI Task for an AI task.

Model

The Ollama model to use. The list shows the models that are already on your Ollama server first, marked (downloaded), followed by other models from the Ollama library. You can also enter the name and tag of any other model. The default is qwen3:4b-instruct.

Instructions

Instructions for the AI on how it should respond to your requests. It is written using Home Assistant Templating. Only available for conversation agents.

AI tools

Device control only reaches the entities that you expose to Assist. Home Assistant reaches everything, and it only works for administrators, not for voice satellites. For details, refer to Sets of AI tools. Only models that support tools can use AI tools. For details, refer to Controlling Home Assistant. Only available for conversation agents.

Context window size

The number of tokens that the model can take as input. For a conversation agent with Device control, this includes your exposed entities. The default is 8192, and the minimum is 2048. A larger value supports homes with more exposed entities. A smaller value uses less memory on your Ollama server. Choose a value that your model supports.

Max history messages

The maximum number of messages to keep for each conversation. Older messages are dropped. The default is 20. Enter 0 to keep all messages.

Keep alive

The number of seconds that Ollama keeps the model in memory after a message. Enter -1 to keep it in memory, or 0 to unload it right away. The default is -1.

Think before responding

If turned on, the model thinks about its answer before it responds. This takes longer, but it can give better answers. Not all models support thinking. For a conversation agent, select Show details in the Assist dialog to see what the model thought. Turned off by default.

Controlling Home Assistant

If you want to experiment with local LLMs using Home Assistant, we recommend exposing fewer than 25 entities. Note that smaller models are more likely to make mistakes than larger models.

Only models that support Tools may control Home Assistant.

Smaller models may not reliably maintain a conversation when a set of tools is selected in AI tools. However, you may use multiple Ollama configurations that share the same model, but use different prompts:

  • Add the Ollama integration without selecting anything in AI tools. You can use this conversation agent to have a conversation.
  • Add an additional Ollama integration, using the same model, and select a set of tools in AI tools. You can use this conversation agent to control Home Assistant.