Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Local LLM Fixed My Smart Home Privacy Problem

· 7 min read · Smart Home

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

If you have a smart home, you’ve probably realized that your voice assistant is always listening. Every command, every question, even background conversations can be sent to the cloud for processing. That was my biggest privacy headache. The fix? Running a local large language model (LLM) on my own hardware to handle voice commands and automations without sending anything to a third-party server. This guide walks you through the exact steps I used to set up a private, offline voice assistant that understands natural language and controls my smart devices.

What You'll Need

  • A computer that can run a local LLM. A desktop with a decent GPU (8GB+ VRAM) is ideal, but a modern CPU with 16GB+ RAM can work for smaller models.
  • Smart home devices that support local control (e.g., Zigbee, Z-Wave, or Wi-Fi devices with a local API). Avoid cloud-only devices unless you’re willing to use a hub that bridges them locally.
  • Home assistant software that supports local voice and LLM integration. The most common choice is Home Assistant, but other platforms like OpenHAB or Node-RED can also work.
  • An LLM runtime. Options include Ollama, LM Studio, or llama.cpp. Ollama is the easiest to set up.
  • A microphone and speaker for voice interaction. A USB mic or a smart speaker that can be flashed with custom firmware (like an Echo Dot with open source firmware) works.
  • Basic comfort with the command line and editing configuration files.

Step-by-Step

  1. Set up your LLM runtime. Install Ollama on your computer by following the instructions at ollama.com. Once installed, download a model that runs well on your hardware. For a GPU with 8GB VRAM, try llama3.2:3b or qwen2.5:3b. For more power, use llama3.1:8b. Run ollama pull llama3.2:3b to fetch it.
  2. Test the LLM locally. Open a terminal and run ollama run llama3.2:3b. Type a simple command like “turn on the living room light” and see if the model responds with something sensible. If it does, you’re ready to connect it to your smart home.
  3. Install Home Assistant. If you don’t already have it, install Home Assistant OS on a Raspberry Pi or run it as a Docker container on your server. Follow the official installation guide for your hardware. Once it’s running, access the web interface at http://localhost:8123.
  4. Add your smart devices to Home Assistant. Use the integrations page to add devices that support local control. For Zigbee devices, use a USB stick like the Conbee II or Sonoff Zigbee 3.0. For Wi-Fi devices, prefer integrations that use local APIs (e.g., Tasmota, ESPHome, or HomeKit Controller). Avoid cloud-only integrations if possible.
  5. Install the local LLM integration. In Home Assistant, go to Settings > Devices & Services > Add Integration and search for “Ollama”. Enter the URL of your Ollama server (e.g., http://localhost:11434) and select the model you downloaded. This integration allows Home Assistant to send prompts to the LLM and receive responses.
  6. Create a voice pipeline. Home Assistant has a built-in voice assistant feature. Go to Settings > Voice Assistants and create a new one. Choose “Local” as the conversation agent, and select your Ollama integration. For speech-to-text, you can use the built-in “Whisper” integration if you have a compatible microphone, or use a local STT engine like faster-whisper. Set up wake word detection if you want hands-free operation.
  7. Write a system prompt. In the voice assistant settings, you can add a system prompt that tells the LLM how to respond. For example: “You are a home automation assistant. When the user asks to control a device, respond with a JSON command that Home Assistant can execute. For example, to turn on a light, say: {"action": "turn_on", "entity": "light.living_room"}.” This is crucial because the LLM needs to output structured commands that Home Assistant can parse.
  8. Test with a voice command. Use the microphone on your computer or a phone with the Home Assistant companion app to say “Turn on the living room light.” The STT will convert it to text, the LLM will generate a response, and Home Assistant will execute the action. If it works, you’re done. If not, move to troubleshooting.
  9. Automate routine tasks. You can also use the LLM to handle more complex requests, like “Set the thermostat to 20 degrees when I get home.” This requires writing custom automations in Home Assistant that use the LLM as a decision engine. Start with simple scripts and expand as you get comfortable.
  10. Disconnect from the cloud. Once everything is working, go through your integrations and remove any cloud dependencies. For example, if you were using a cloud-based voice assistant, disable it. Also, block outbound internet access for your Home Assistant instance at the firewall level to ensure no data leaves your network.

Common Mistakes

  • Using a model that’s too large for your hardware. If the LLM is slow or crashes, try a smaller model. A 3B model is often enough for simple commands.
  • Not setting a clear system prompt. Without a specific prompt, the LLM will just chat, not control devices. Always include instructions for outputting structured commands.
  • Forgetting to enable local control on devices. Some devices have a cloud mode by default. Check the device documentation to ensure it’s set to local mode.
  • Assuming all voice assistants are cloud-based. Many people think they need a cloud service for voice recognition. Local STT with Whisper works well and is private.
  • Skipping the firewall block. If you don’t block outbound traffic, some devices or integrations may still phone home. Use a firewall like pfsense or a simple iptables rule.

Tips

  • Start with a small model. A 3B model runs fast on a CPU and is enough for basic commands. You can upgrade later if needed.
  • Use a dedicated microphone. A far-field mic array like the ReSpeaker 2-Mic or 4-Mic works well with Home Assistant and avoids the poor audio quality of laptop mics.
  • Train your own wake word. Home Assistant supports custom wake words. You can train a wake word using openWakeWord, which runs locally.
  • Back up your configuration. Home Assistant has a built-in backup feature. Use it before making major changes.
  • Monitor performance. If the LLM is slow, consider using a GPU. Even a used GTX 1060 can speed up inference significantly.

Troubleshooting

  • LLM responds but Home Assistant doesn’t execute the command. Check the system prompt. Make sure the LLM is outputting valid JSON. Test the prompt in Ollama directly to see what it returns. Also, verify that the entity names in your Home Assistant match what the LLM is using.
  • Voice recognition is inaccurate. Use a better STT model. The default Whisper small might be inaccurate; try the medium or large model if your hardware can handle it. Also, position the mic closer to you.
  • LLM is too slow. Reduce the model size, enable GPU acceleration, or use a smaller context window. In Ollama, you can set the context length with /set parameter num_ctx 2048.
  • Devices not showing up in Home Assistant. Double-check that your Zigbee stick is properly connected and that the integration is configured. For Wi-Fi devices, ensure they are on the same network and that the integration supports them.
  • Wake word not working. Try a different wake word model. Some are more sensitive than others. Also, ensure your microphone is not muted and that the audio level is adequate.
  • Home Assistant crashes after adding the LLM integration. This is usually a memory issue. Reduce the model size or add more RAM. Check the Home Assistant logs for specific errors.

Frequently Asked Questions

Do I need a powerful GPU to run a local LLM?

Not necessarily. A 3B model can run on a CPU with 16GB RAM, though it will be slower. For better performance, a GPU with 8GB VRAM is recommended, but even a modest GPU helps.

Can I use this with Alexa or Google Home devices?

Most commercial smart speakers are cloud-dependent. You can repurpose some devices by flashing custom firmware (like openHASP or ESPHome) to make them work locally, but it’s not straightforward. A USB mic and speaker is often easier.

Will this work with all my smart devices?

Only devices that support local control. Cloud-only devices like some Wi-Fi plugs and bulbs won’t work without internet. Check the device’s documentation or the Home Assistant community for local integration options.

How much does this cost?

If you already have a computer and smart devices, the software is free. You might need to buy a Zigbee USB stick (around $30) and a microphone (around $20). No ongoing subscription fees.

Is it really private?

Yes, if you block outbound internet access and use local STT and LLM. No audio or text leaves your network. However, keep in mind that the LLM itself is trained on public data, but your conversations are not sent anywhere.

What if I don’t have a Linux machine?

Home Assistant can run on Windows via WSL or Docker. Ollama also supports Windows. The steps are similar, but you may need to adjust paths and commands.