Home Assistant and Ollama for the connected home
This page may contain Amazon affiliate links. A purchase after a click can earn the site a commission, at no extra cost to you. The advice stays independent. How affiliation works.
Picture asking the house: “Summarize the downstairs sensors” or “Suggest a movie-night scene,” in ordinary language, with those details staying off a consumer cloud. Home Assistant is the home-automation platform you host yourself (on a mini PC, a NAS, or a Raspberry Pi, depending on the install). It can lean on Ollama, a local engine for large language models, to read text, draft scenes, or help you write automations. This guide stays at household scale. A datacenter contract and a professional uptime promise sit outside it.
On this page
- Roles of Home Assistant and Ollama: what each piece does.
- A typical home layout: one box, or two machines on the home network.
- Connect Ollama step by step: the API, a generic language-model integration, and delay.
- Firewall and guest network: the firewall, guest VLANs, and a closed WAN.
- Careful example scenes: a test lamp before the heat.
- Common errors and fixes: timeouts, browser blocks between origins, the OS firewall, and missing models.
Roles of Home Assistant and Ollama
Home Assistant gathers sensors (temperature, presence, doors), devices that act (lights, blinds), and scenes into deterministic automations: “if motion and it is night, set the hall to 20%.” A language model does not replace those reliable rules. It helps you phrase them, summarize the house in plain language, or draft an automation that you approve in the interface. Try a desk lamp before anything touches the heat or the alarm.
The home network (Wi-Fi and Ethernet inside the house) carries the HTTP calls between Home Assistant and Ollama when the two services run on different machines. HTTP is the ordinary request format web services use with each other.
Roles side by side (Home Assistant alone, and with Ollama on the home network)
| Dimension | Home Assistant alone | With local Ollama |
|---|---|---|
| Real-time reliability | High (YAML, sensor thresholds) | The model writes text. The automations keep the real-time job |
| Everyday language | Thin if you skip cloud assistants | State summaries and scene ideas in your language |
| Privacy | A home network you control, if cloud integrations stay off | Prompts stay in the house when the network is split into segments |
| Delay | Milliseconds from sensor to device | Seconds to tens of seconds, depending on the GGUF model |
For a conversation that has nothing to do with the lights, Open WebUI or the family assistant fit better. The thread on this page is Home Assistant plus the Ollama API.
A typical home layout
Two layouts show up often:
- All in one box: Home Assistant OS or Supervised on a stronger mini PC (32 GB of RAM is the recommendation when several containers run), with Ollama in a container or installed natively. See Docker for Ollama and Open WebUI.
- Split: Home Assistant on a NAS or a dedicated Raspberry Pi, and Ollama on a more powerful mini PC. They talk over the home network.
In both layouts the traffic stays on the home network, as long as you leave the ports closed. If you stack Home Assistant, Ollama, and n8n, read 32 vs 64 GB of RAM.
Hardware that fits
| Piece | Household cue | LocAIhome guide |
|---|---|---|
| Ollama host | A 32 GB mini PC, an SSD, low noise | noise and power around the clock |
| Model | 3B–8B instruct, Q4 | choosing a first model |
| RAM overall | 32 GB is tight if everything shares one machine. 64 GB is comfortable | 32 and 64 GB table |
| Disk | An SSD for GGUF models | model storage |
When a purchase belongs on this page: if Home Assistant already runs on a Raspberry Pi or a light NAS, a second quiet box just for Ollama keeps the Home Assistant host from running out of RAM. The hardware selector starts from boxes you tick (hardware budget, nighttime noise, 24-hour power draw, an editable price per kilowatt-hour) and suggests profiles that match choosing hardware. A single brand is left to you.
Indicative search, October 2026. Check the current price on amazon.ca before you order: quiet 32 GB mini PCs on amazon.ca (Amazon partner link; a commission with no extra cost to you; affiliate disclosure). The link opens a search, and a specific product is left to you. Cross-check the results with the selector and the noise and RAM guides above.
Connect Ollama step by step
1. Check that Ollama answers
On the machine that hosts Ollama:
curl http://127.0.0.1:11434/api/tags
You should see the model list as JSON. If the list is empty, download a model: ollama pull llama3.2:3b (see installing Ollama).
2. Allow the home network if Home Assistant is on another address
By default Ollama often listens only on the local machine. If Home Assistant runs at another address on the same network, set OLLAMA_HOST=0.0.0.0 only on a network you trust, and keep it off the public internet. Restart the Ollama service after the change.
3. The dedicated integration, or a REST call
- Read the Ollama integration documentation on the Home Assistant site. Check the current name under Settings, then Devices & services (integrations get renamed). Pair that with the official integration list and the Home Assistant add-on store on the day you install, rather than a label copied from an old forum post. Add-ons (installable extras in Home Assistant OS) move too.
- Alternative: a REST node, or the generic language-model integration, pointed at
http://OLLAMA_IP:11434/api/generate.
Sample REST body (JSON)
Sample request body. A POST to
/api/generate. It is a sketch for Home Assistant: adapt the entities, the model, and the REST node before you rely on it.
{
"model": "mistral:7b-instruct-q4_K_M",
"prompt": "In one sentence, summarize the living-room lights if they are off.",
"stream": false
}
The response field in the JSON that comes back holds the generated text. Parse it in whatever way your Home Assistant node expects (model, template).
4. Pick a model and time the reply
Trigger an automation by hand. If the reply takes more than 5–10 seconds, switch to a smaller model or check the GPU. See VRAM and model size. Indicative table:
| Model | Typical delay (seconds) | Home Assistant use |
|---|---|---|
| 3B Q4 | 1–4 | Short commands |
| 8B Q4 | 4–12 | Sensor summaries |
| 13B and up | 15–60+ on CPU | Leave this off the real-time path |
Firewall and guest network
Step 5 of the connection:
- Guest VLAN: guest Wi-Fi should be unable to reach port 11434 (Ollama’s default port).
- Leave port forwarding of 11434 off the router. Publishing Ollama on the WAN (the public internet) wants a VPN (an encrypted tunnel) and authentication, and that is a separate project.
- The firewall (the filter on the operating system or the router; logs sometimes say firewall) should allow only trusted addresses: Home Assistant to the Ollama host.
- Privacy when the AI stays home if automations mention who is home or other sensitive details.
Cloud assistants and web search inside Home Assistant
Some Home Assistant “assistant” extensions offer web search. Those queries leave for third-party servers. For a fully local setup, turn those options off and stay with the sensors and states already in Home Assistant, plus Ollama. This is separate from the home-network firewall. Here the risk is a cloud feature you choose to switch on inside Home Assistant.
YAML automations and everyday language
Home Assistant still runs on automations you can trust. Ollama helps you draft or explain them. A cautious workflow:
- Ask the model for a draft automation.
- Paste it into the Home Assistant editor and read every condition.
- Test on something harmless (a desk lamp).
- Save the approved version as YAML. Regenerating it on every run in production is a habit to skip.
Common errors and fixes
| Symptom | Where to look |
|---|---|
| Home Assistant times out talking to Ollama | Wrong address or port, OS firewall, or Ollama stopped |
| Unknown model | ollama pull was never run on the Ollama host |
| Replies that wander | The model lacks instruct tuning, or the prompt is too vague |
| Integration missing | curl works from Home Assistant and the UI still errors: check Home Assistant logs and the Ollama integration page (current name). A browser block between origins fits when curl succeeds and the admin page fails. Check the address, port 11434, OLLAMA_HOST, and the OS firewall |
| Always slow | The model is large for the RAM. See the Mac mini M4 or add RAM |
Check from the Home Assistant machine (replace the address):
curl http://192.168.1.50:11434/api/tags
If curl fails from Home Assistant and succeeds on the Ollama host, the problem is the network: the OS firewall, a wrong address, or a VLAN.
Pair it with n8n
For heavier mail and PDF workflows, n8n and a local model can call the same Ollama API while Home Assistant keeps real-time sensors and devices. Two large models loaded at once will fight over a small pool of RAM.
Cost, and the software you install first
A machine that stays on: the electricity budget and the 3-year comparison. Software on-ramp: install Ollama · a first local AI in 15 minutes · Continue for local coding if you write custom integrations.
Add-ons, and names that change
Home Assistant integration names and add-ons change quickly. Start from the Ollama page (check the current name in the interface), then the integration list and the add-on store on the day you install, plus the community thread for whichever proxy or add-on is maintained that month. In October 2026, prefer official sources or maintained extensions over scripts copied before anyone has checked their security. If you stack Docker containers for Ollama and Home Assistant on the same mini PC, read Docker for Ollama and Open WebUI and 32 vs 64 GB of RAM before you leave an 8B loaded all the time.
Careful example scenes
Test on a lamp first. Before any scene below, try it on a desk lamp or a test outlet with a bulb you can see. Leave the heat, the alarm, and the garage door alone until you have read the YAML line by line.
Morning summary: a scheduled automation reads the “window open” sensors and asks Ollama for one sentence to show on a tablet. Home Assistant still runs the automation. Ollama only writes the sentence. Display alone is a low-stakes entity.
Help writing YAML: you describe, in plain language, “turn on the hall light if there is motion after 10 p.m.” The model proposes a draft. You correct it, then enable it on a hall lamp (low stakes).
Local voice control (if Whisper is already installed): local transcription, then an Ollama request. The chain can use first steps with Whisper and the longer offline Whisper guide. Watch the total delay. Keep commands to lights or media until the chain has earned trust.
Checklist before you connect Ollama to Home Assistant
| Step | Action | LocAIhome guide |
|---|---|---|
| 1 | Ollama answers locally (curl on /api/tags) |
Install Ollama |
| 2 | A 3B–8B instruct model is downloaded | Choose a first model |
| 3 | RAM and VRAM are enough if one host runs everything | VRAM and model size · 32 vs 64 GB |
| 4 | Kilowatt-hours and noise are acceptable around the clock | Mini PC noise · kWh budget |
| 5 | Presence data and children | Privacy when the AI stays home |
| 6 | First test on a lamp, with the heat left alone | The example scenes above |
For the power bill of a small Home Assistant plus Ollama server: electricity for a home AI box, the 3-year cost comparison, and the Mac mini profile if everything runs on Apple. The hardware selector crosses noise, hardware budget, and an editable price per kilowatt-hour. That helps when Home Assistant and Ollama share one quiet box in the living room.
Keep going
- Open WebUI for beginnersA family chat on the same Ollama that Home Assistant uses.
- Docker for Ollama and Open WebUIContainers when Home Assistant and Ollama share a mini PC.
- A private family assistantAccounts and the home network, kept apart from critical automations.
- Privacy when the AI stays homePresence data and sensitive sensors.
- Mini PC comparison, 2026Pick a dedicated Ollama host next to Home Assistant.
- n8n and a local modelHeavier workflows beside Home Assistant.
- A first local AI in 15 minutesProve Ollama works before you buy a host for Home Assistant and a model.
- Images without a cloudComfyUI on its own. Keep it off the same GPU as Home Assistant and Ollama.
- Install OllamaThe engine, before any Home Assistant integration.
Common questions
Does Ollama have to run on the same machine as Home Assistant?
No. Home Assistant can call Ollama over HTTP at the home-network address of the PC or mini PC that hosts Ollama (port 11434 by default).
Which model fits home automation?
A 3B to 8B instruct model (tuned to follow instructions), quantized Q4 in GGUF, keeps the delay short when an automation fires often. See choosing a first model.
Is web search inside Home Assistant assistants local?
Often it is not. Extensions that search the internet send requests to a cloud. Turn them off if you want the stack to stay fully local.
The Ollama integration is missing in Home Assistant. What now?
First confirm that Ollama answers curl at http://IP:11434/api/tags from the Home Assistant machine. Check Settings, then Logs, for network errors. A browser block between origins (the Home Assistant page calling another address on the home network) can stop the assistant even when curl succeeds. Restart Ollama after you set OLLAMA_HOST if Home Assistant is on a different address.
The integration fails in the Home Assistant browser, and curl works. Why?
A browser block between origins: the Home Assistant admin page can refuse an HTTP call to port 11434 on another host on the home network, even when curl from the Home Assistant server succeeds. Check the address and port 11434, the operating-system firewall, and that Ollama listens on the home network (OLLAMA_HOST), not only on 127.0.0.1.
Sources
Narrow it down with the hardware selector · French version of this section