Transform your Home Assistant configuration with the power of AI
Installation • Features • Documentation • Support
HA OpenCode brings the revolutionary OpenCode AI coding agent directly into your Home Assistant instance. Experience intelligent configuration editing through natural language, advanced YAML assistance, and deep integration via the Model Context Protocol (MCP).
|
Use natural language to modify your Home Assistant configuration. No more searching documentation - just ask! Beautiful terminal with 10 professionally designed themes, accessible directly from your HA sidebar. Works with 75+ AI providers: Anthropic, OpenAI, Google, Groq, Ollama, and many more. |
32 tools, 13 resources, and 6 guided prompts for comprehensive Home Assistant interaction. Smart YAML editing with entity autocomplete, live hover information, deprecation warnings, and go-to-definition support. Validated config pipeline with automatic backup/restore. Multi-layered checks are designed to prevent AI-written config from breaking your HA instance. |
OpenCode is an open-source AI coding agent that transforms how you interact with your codebase. It understands your files, executes commands, and helps you build and maintain software using natural language.
Think of it as your personal expert developer who:
- 📖 Reads and understands your entire configuration
- ✏️ Suggests and implements improvements
- 🐛 Finds and fixes bugs automatically
- 🚀 Implements new features on request
- 💬 Explains complex configurations in plain English
HA OpenCode works with 75+ AI providers. Choose the one that fits your needs:
🔥 Popular Providers (Click to expand)
| Provider | Available Models |
|---|---|
| 🧠 Anthropic | Claude 4 Opus, Claude 4 Sonnet, Claude 3.5 Sonnet, Claude 3.5 Haiku |
| 💎 OpenAI | GPT-4o, GPT-4 Turbo, o1, o1-mini, o3-mini |
| Gemini 2.0 Flash, Gemini 1.5 Pro, Gemini 1.5 Flash | |
| ☁️ AWS Bedrock | Claude, Llama, Mistral (via AWS) |
| 🔷 Azure OpenAI | GPT-4, GPT-4 Turbo (Azure hosted) |
| ⚡ Groq | Llama 3, Mixtral (ultra-fast inference) |
| 🎯 Mistral | Mistral Large, Mistral Medium, Codestral |
| 🦙 Ollama | Local models (Llama, CodeLlama, Mistral, etc.) |
| 🌐 OpenRouter | 100+ models through single API |
| 🤝 Together AI | Llama, Mixtral, and open models |
| 🔥 Fireworks AI | Fast inference for open models |
| 🚀 xAI | Grok models |
| 💫 Deepseek | Deepseek Coder, Deepseek Chat |
Start immediately with OpenCode Zen - no API keys or subscriptions required! Get access to curated models optimized for coding tasks, perfect for trying HA OpenCode or for users who prefer not to manage their own API keys.
Simply run /connect and select OpenCode Zen to get started for free.
-
Add this repository to Home Assistant:
Or add manually
Go to Settings → Add-ons → Add-on Store → ⋮ → Repositories
Add:
https://github.com/magnusoverli/ha_opencode -
Install the add-on:
- Find "HA OpenCode" in the add-on store
- Click Install
-
Start using it:
- Start the add-on
- Click Open Web UI (or use the sidebar)
- Run
opencodeand use/connectto configure your AI provider
This add-on has read/write access to your Home Assistant configuration directory.
HA OpenCode includes a multi-layered validation pipeline designed to prevent AI-written configuration from causing your Home Assistant to fail to start:
- 🔍 Automatic config validation — every config write is validated through HA Core's own check before committing
- ↩️ Automatic backup/restore — if validation fails, the original file is instantly restored
- 🧪 Jinja2 template pre-validation — templates are tested through HA's engine before writing to disk
- 📋 Deprecation scanning — 20+ patterns catch outdated syntax, auto-updated from GitHub
- 🏥 HA Repairs integration — surfaces your installation's active deprecation warnings
⚠️ Structural checks — catches missing triggers, actions, and other required fields
Additional best practices:
- 💾 Always backup your configuration before significant changes
- 👀 Review changes suggested by the AI before accepting them
- 📝 Use version control (git) when possible for easy rollback
Comprehensive documentation is available covering all features:
- 📖 Full Add-on Documentation - Complete guide to all features
- 📝 Changelog - Version history and updates
Once installed and connected to an AI provider, try these commands:
# Create a new automation
"Create an automation that turns on lights when motion is detected"
# Review your configuration
"Check my configuration.yaml for any issues"
# Add sensors
"Add a template sensor to track my total energy usage"
# Get entity information
"What's the current state of all my lights?"
# Troubleshoot
"Why isn't my bedroom motion sensor triggering automations?"
# Analyze history
"Show me temperature trends for the past 24 hours"Need help? We've got you covered:
|
Community support & discussions |
Comprehensive guides & tutorials |
Bug reports & feature requests |
We love contributions! Here's how you can help:
- 🍴 Fork the repository
- 🔧 Create your feature branch (
git checkout -b feature/amazing-feature) - 💾 Commit your changes (
git commit -m 'Add amazing feature') - 📤 Push to the branch (
git push origin feature/amazing-feature) - 🎉 Open a Pull Request
Contributions of all kinds are welcome — feel free to open a PR!
![]() Magnus Overli Creator & Maintainer |
See the contributors page for the full list of amazing people who have helped make this project better! |
This is free and unencumbered software released into the public domain - see the UNLICENSE file for details.
Made with ❤️ for the Home Assistant community
