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
- 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.
- 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:
-
Browse to your Home Assistant instance.
-
In the bottom right corner, select the
Add Integration button. -
From the list, select Ollama.
-
Follow the instructions on screen to complete the setup.
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.
The name of the conversation agent or AI task. You set it when you add it. To change it later, select the three dots Ollama Conversation for a conversation agent and Ollama AI Task for an AI task.
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 for the AI on how it should respond to your requests. It is written using Home Assistant Templating. Only available for conversation agents.
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 Setting up an Ollama assistant with Device control. Only available for conversation agents.
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.
The maximum number of messages to keep for each conversation. Older messages are dropped. The default is 20. Enter 0 to keep all messages.
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.
Setting up an Ollama assistant with Device control
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], an Ollama conversation agentSoftware 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] can control your devices, tell you their state, and run your exposed scriptsA script is a saved list of steps that runs when you start it, for example, from a dashboard, with Assist, or from an automation. Unlike an automation, a script has no triggers, so it doesn’t start by itself. [Learn more]. For details, refer to Sets of AI tools. 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 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].
Prerequisites:
- An administrator account in Home Assistant.
- The Ollama integration is set up.
- The entities that you want to control are exposed to Assist. Models that run on your own hardware are often smaller than the models of cloud services, and smaller models are more likely to make mistakes. So only expose the entities that you want the assistant to use. For details, refer to Expose (the minimum) entities.
To set up an Ollama assistant with Device control:
- Add a conversation agent for your devices. For the steps, refer to Configuration options.
- Enter a Name. For example, enter
Ollama devices. - Under Model, select a model that supports tools. Only these models can use AI tools. For a list, refer to models with tools in the Ollama library.
- Under AI tools, select Device control.
- Enter a Name. For example, enter
- Optional: some smaller models don’t chat as well when AI tools are selected. If your model is one of them, add a second conversation agent for chatting, in the same way.
- Enter a Name. For example, enter
Ollama chat. - Under Model, select the same model.
- Under AI tools, clear all sets of AI tools.
- Enter a Name. For example, enter
- Create 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. for each conversation agent. For the steps, refer to Creating an assistant with an AI personality.
- Under Conversation agent, select
Ollama devices, orOllama chatfor the second assistant.
- Under Conversation agent, select
- On a dashboard, in the top-right corner, select Assist
. - On a narrow screen, it’s under Menu
. On a computer, you can also press A.
- On a narrow screen, it’s under Menu
- At the top of the dialog, select the name of the assistant, and choose the assistant that uses
Ollama devices.- To chat, choose the assistant that uses
Ollama chatinstead. - The Assist dialog remembers the assistant that you chose last.
- To make this assistant the default, set it as preferred: go to Settings > Voice assistants, select the three dots
menu of the assistant on the Assist card, and then select Set as preferred . Voice satellites that use the preferred assistant then use it too. The Assist dialog uses it when you haven’t chosen an assistant yet.
- To chat, choose the assistant that uses
- Ask the assistant about one of your exposed entities. For example, ask
Is the kitchen light on?- Result: The assistant answers with the state of the entity.