Ollama
The Ollama integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] adds a conversation agent in Home Assistant powered by a local Ollama
Controlling Home Assistant is an experimental feature that provides the AI access to the Assist API of Home Assistant. You can control what devices and entities it can access from the exposed entities page. The AI is able to provide you information about your devices and control them.
This integration does not integrate with sentence triggers.
This integration requires an external Ollama server, which is available for macOS, Linux, and Windows. Follow the download instructions
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.
Options
Options for Ollama can be set via the user interface, by taking the following steps:
- Browse to your Home Assistant instance.
- Go to Settings > Devices & Services.
- If multiple instances of Ollama are configured, choose the instance you want to configure.
- Select the integration, then select Configure.
Name of the Ollama modelmistral
or llama2:13b
. Models will be automatically downloaded during setup.
Instructions for the AI on how it should respond to your requests. It is written using Home Assistant Templating.
If the model is allowed to interact with Home Assistant. It can only control or provide information about entities that are exposed to it. This feature is considered experimental and see Controlling Home Assistant below for details on model limitations.
The context window size is the number of tokens the model can take as input. Home Assistant defaults to 8k, which is larger than the default value in Ollama Server (2k), and you may adjust it based on the maximum context size of the specific model used. A larger value will better support larger homes with more entities, and smaller values may lower Ollama server RAM usage.
Maximum number of messages to keep for each conversation (0 = no limit). Limiting this value will cause older messages in a conversation to be dropped.
Controlling Home Assistant
If you want to experiment with local LLMs using Home Assistant, we currently recommend using the llama3.1:8b
model and exposing fewer than 25 entities. Note that smaller models are more likely to make mistakes than larger models.
Only models that support Tools
Smaller models may not reliably maintain a conversation
- Add the Ollama integration without enabling control of Home Assistant. You can use this conversation agent to have a conversation.
- Add an additional Ollama integration, using the same model, enabling control of Home Assistant. You can use this conversation agent to control Home Assistant.