Smart home, built right.

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.

By the TechnoGecko Team· · Updated · 8 min read

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

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:

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

  1. In Home Assistant, go to Settings > Devices & services, select Add integration, and choose Ollama.
  2. 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.
  3. Choose the model.
  4. 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:

OptionWhat it doesStarting point
InstructionsThe prompt the model gets, written as a Home Assistant template.Keep the default at first.
Context window sizeHow 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 messagesHow many messages of a conversation to keep. 0 means no limit.Leave the default.
Keep aliveHow 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 respondingLets 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

  1. Go to Settings > Voice assistants and select Add assistant.
  2. Under Conversation agent, select your Ollama agent.
  3. 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:

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

Related

The short list

New guides and explainers when we publish them. No product spam. The form is not connected yet. Use the RSS feed.