Home Assistant · Integrations
Run a local LLM in Home Assistant with Ollama
Connect Home Assistant to a local Ollama server, pick a model that supports tools, expose the right entities, and fix the 'unexpected error' people hit most.
Home Assistant can use a large language model running on your own hardware, through Ollama, as its conversation agent. Nothing goes to a cloud AI service. To set it up, install Ollama on a computer with enough memory for the model, make it reachable on your network, pull a model that supports tools, and add the Ollama integration in Home Assistant with Control Home Assistant set to Assist. Then expose only a handful of entities (Home Assistant’s docs suggest fewer than 25 for local models), and turn on Prefer handling commands locally so simple commands never wait for the model.
The most common failure, “Unexpected error during intent recognition”, almost always means the model you picked doesn’t support tools, or has thinking turned on when it can’t think. The fix is in the troubleshooting section below.
What you need
- Home Assistant with an administrator account. The Ollama integration has been part of Home Assistant since 2024.4.
- A computer to run Ollama. Ollama runs on macOS, Linux and Windows. Home Assistant’s docs describe it as “an external Ollama server”, so plan on a separate machine, such as a desktop with a graphics card or a mini PC with plenty of RAM. The model has to fit in memory: in the GPU’s memory for speed, or in system RAM if you accept slower replies.
- A model that supports tools. Home Assistant’s docs are blunt: “Only models that support Tools may control Home Assistant.” Ollama’s model library has a tools filter.
Step 1: Install Ollama and open it to your network
Install Ollama from ollama.com/download on the machine that will run the model. Out of the box, Ollama only listens on the machine itself. Its FAQ says it “binds 127.0.0.1 port 11434 by default”, so Home Assistant can’t reach it yet. Change the bind address with the OLLAMA_HOST environment variable:
Linux (systemd service): run systemctl edit ollama.service and add:
[Service]
Environment="OLLAMA_HOST=0.0.0.0:11434"
Then reload and restart:
systemctl daemon-reload
systemctl restart ollama
macOS (Ollama app): run launchctl setenv OLLAMA_HOST "0.0.0.0:11434" and restart the Ollama app.
Windows: quit Ollama from the taskbar, add a user environment variable named OLLAMA_HOST with the value 0.0.0.0:11434, then start Ollama again from the Start menu.
0.0.0.0 means “listen on every network interface”. Treat the open server as usable by anything on your network. Keep port 11434 off the internet, and if your network has a guest Wi-Fi, keep the Ollama machine off it.
Give the Ollama machine a fixed IP address (a DHCP reservation in your router), so Home Assistant doesn’t lose it after a reboot.
Step 2: Pick and pull a model
Pick a model from Ollama’s tools list that fits your hardware, then pull it on the Ollama machine:
ollama pull qwen3:8b
That’s an example, not a lab-tested recommendation. In Home Assistant’s issue tracker and forum, users report working setups with the Qwen 3 and Llama 3.2 families, and failures with models that aren’t tagged for tools in Ollama’s library, such as the standard Gemma 3 and DeepSeek-R1 uploads. Two things to keep in mind from Home Assistant’s docs:
- “Smaller models are more likely to make mistakes than larger models.”
- Small models “may not reliably maintain a conversation” with control turned on (more on a workaround below).
Home Assistant can also download the model for you during setup, but pulling it first lets you check that it runs at all.
Step 3: Add the Ollama integration
- In Home Assistant, go to Settings > Devices & services, select Add integration, and choose Ollama.
- Enter the server URL, for example
http://192.168.1.50:11434. The API key is optional and only needed if your Ollama server requires one. - Choose the model.
- Open the integration’s options and set Control Home Assistant to Assist. Without it, the model can chat but can’t see or control anything.
The other options, from Home Assistant’s docs:
| Option | What it does | Starting point |
|---|---|---|
| Instructions | The prompt the model gets, written as a Home Assistant template. | Keep the default at first. |
| Context window size | How many tokens the model can take in. Home Assistant defaults to 8K, more than Ollama’s own default (4,096 tokens, per Ollama’s FAQ). More entities need a bigger window; a bigger window uses more RAM. | 8K |
| Max history messages | How many messages of a conversation to keep. 0 means no limit. | Leave the default. |
| Keep alive | How long the model stays in memory after a message. -1 (the default) keeps it loaded. | -1 if the machine is dedicated, so replies don’t wait for a reload. |
| Think before responding | Lets models that support it reason before answering. Off by default. | Leave it off (see troubleshooting). |
Step 4: Expose fewer entities than you think
The model can only see and control entities exposed to Assist. Go to Settings > Voice assistants, open the Expose tab, and keep the list short. Home Assistant’s Ollama docs recommend “exposing fewer than 25 entities” when you experiment with local models. Every exposed entity goes into the prompt, so a long list makes replies slower and mistakes more likely.
Start with the lights and plugs you actually ask about, a temperature sensor or two, and nothing that locks, unlocks or opens. Give the exposed entities clear names and aliases (“Porch lights”, not “Switch 3 Plug 1”). The model only knows what the names tell it.
Step 5: Build an assistant that prefers local commands
- Go to Settings > Voice assistants and select Add assistant.
- Under Conversation agent, select your Ollama agent.
- Turn on Prefer handling commands locally.
With that option on, Home Assistant tries its own built-in and custom sentences first. Home Assistant’s docs explain that “if the intent can be answered by Home Assistant it will”: fast, without the model. Only requests it doesn’t understand go to Ollama. “Turn off the porch lights” stays instant; “Is it warm enough outside to leave the tree lights on?” goes to the model.
For a fully local voice pipeline, pair this with local speech-to-text (Speech-to-Phrase or Whisper) and Piper for text-to-speech. Home Assistant’s local voice guide walks through those apps.
The two-agent trick for small models
Home Assistant’s docs suggest a workaround if a small model loses track of conversations with control on: add the Ollama integration twice with the same model. Leave Control Home Assistant off on the first one and use it for chat. Turn it on for the second and use that one for your voice assistant. One model, two jobs, no extra memory for a second model.
Troubleshooting
“Unexpected error during intent recognition”
This message hides the real error. Look in Settings > System > Logs, or open your assistant under Settings > Voice assistants, then the three-dot menu, then Debug. You’ll usually find one of these:
- “does not support tools”: the model’s Ollama upload has no tool support, so Ollama rejects Home Assistant’s request. Users in issue #154192 and on the community forum fixed it by switching to a model listed under Ollama’s tools filter. Commenters in that issue point out that Home Assistant only reads the capability flags Ollama publishes for each model. It’s confusing because the same model often works with control off, as the reporter of issue #140441 found with Gemma 3.
- “does not support thinking”: Think before responding is on for a model that can’t reason. Turn it off in the integration’s options. That’s how one forum user fixed it.
It answers but won’t control anything
Check three things in order: Control Home Assistant is set to Assist in the Ollama options, the device is exposed under Settings > Voice assistants > Expose, and the name you’re using matches the entity’s name or an alias.
Replies are slow
On the Ollama machine, run ollama ps. Per Ollama’s FAQ, the Processor column shows “100% GPU”, “100% CPU”, or a split. Anything other than 100% GPU means part of the model is running in system memory, which is slower. Try a smaller model, a smaller context window, or fewer exposed entities. If the first reply after a quiet spell is the slow one, set Keep alive to -1 so the model stays loaded.
Simple commands go to the model anyway
Make sure Prefer handling commands locally is on for the assistant you’re actually using. Some users in Home Assistant’s issue tracker report that certain state questions still reach the model with an LLM agent configured, so a question like “what’s the porch temperature?” may be slower than “turn on the porch lights”.
Local or cloud?
Ollama keeps everything on your network, and once the hardware is paid for, there are no API bills. The trade-off is speed and accuracy on modest hardware. Cloud models through the OpenAI, Google Gemini and Anthropic integrations are generally faster, but each needs an API key, and Home Assistant’s docs call OpenAI and Anthropic paid services. If you’d rather let an AI app control Home Assistant from the outside, see our guide to Home Assistant’s built-in MCP server. Our AI in Home Assistant guide compares every option.
How pages like this are made: How we work.
Sources
- Home Assistant docs: Ollama integration
- Home Assistant docs: Exposing entities to Assist
- Home Assistant docs: Create a personality with AI (prefer handling commands locally)
- Home Assistant docs: Set up a fully local voice assistant
- Ollama docs: FAQ (network access, context length, keep alive)
- Ollama: models that support tools
- Home Assistant core issue #154192: model 'does not support tools'
- Home Assistant core issue #140441: Gemma 3 works without control, fails with Assist
- Home Assistant core issue #142637: prefer local and LLM agents
- Home Assistant Community: Local AI voice assistant intent error
- Home Assistant Community: Llama3.2 'Unexpected error during intent recognition'



