Skip to content

magnusoverli/opencode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

221 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ OpenCode

AI-Powered Configuration Assistant for Home Assistant

Version Project Stage License Maintenance

Stable Build Beta Build

Transform your Home Assistant configuration with the power of AI

Installation โ€ข Features โ€ข Documentation โ€ข Support


โœจ About

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).

๐ŸŽฏ Key Features

๐Ÿค– AI-Powered Editing

Use natural language to modify your Home Assistant configuration. No more searching documentation - just ask!

๐ŸŽจ Modern Web Terminal

Beautiful terminal with 10 professionally designed themes, accessible directly from your HA sidebar.

๐Ÿ”Œ Provider Agnostic

Works with 75+ AI providers: Anthropic, OpenAI, Google, Groq, Ollama, and many more.

๐Ÿ”ง Deep MCP Integration

33 tools, 13 resources, and 6 guided prompts for comprehensive Home Assistant interaction.

๐Ÿ’ก Intelligent LSP Support

Smart YAML editing with entity autocomplete, live hover information, deprecation warnings, and go-to-definition support.

๐Ÿ›ก๏ธ Safe Config Writing

Validated config pipeline with automatic backup/restore. Multi-layered checks are designed to prevent AI-written config from breaking your HA instance.

๐Ÿ—๏ธ hab CLI Integration

Includes the Home Assistant Builder CLI by @balloob โ€” a CLI purpose-built for AI agents to manage Home Assistant via REST and WebSocket APIs. Enables dashboard CRUD, area/floor management, helper creation, backup/restore, and bulk admin operations that would otherwise require direct API calls or UI interaction.


๐ŸŒŸ What is OpenCode?

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

๐ŸŽญ Supported AI Providers

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
๐ŸŒˆ Google 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

๐ŸŽ Free Tier - OpenCode Zen

Start immediately with OpenCode Zen - no API keys or subscriptions required! Get access to curated models optimized for coding tasks, perfect for trying 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.


๐Ÿ“ฆ Installation

Quick Install

  1. Add this repository to Home Assistant:

    Add Repository

    Or add manually

    Go to Settings โ†’ Add-ons โ†’ Add-on Store โ†’ โ‹ฎ โ†’ Repositories

    Add: https://github.com/magnusoverli/opencode

  2. Install the add-on:

    • Find "OpenCode" in the add-on store
    • Click Install
  3. Start using it:

    • Start the add-on
    • Click Open Web UI (or use the sidebar)
    • Run opencode and use /connect to configure your AI provider

๐Ÿ›ก๏ธ Safety & Validation

This add-on has read/write access to your Home Assistant configuration directory.

It also mounts Home Assistant add-on development folders (/addons and /addon_configs) so OpenCode can help with custom add-ons. Treat /addon_configs as sensitive because it may contain configuration data for other add-ons.

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

๐Ÿ“š Documentation

Comprehensive documentation is available covering all features:


๐ŸŽฏ Quick Start Examples

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"

๐Ÿค Support

Need help? We've got you covered:

๐Ÿ’ฌ Discord

Join OpenCode Discord

Community support & discussions

๐Ÿ“– Documentation

OpenCode Docs

Comprehensive guides & tutorials

๐Ÿ› Issues

GitHub Issues

Bug reports & feature requests


๐ŸŒŸ Contributing

We love contributions! Here's how you can help:

  1. ๐Ÿด Fork the repository
  2. ๐Ÿ”ง Create your feature branch (git checkout -b feature/amazing-feature)
  3. ๐Ÿ’พ Commit your changes (git commit -m 'Add amazing feature')
  4. ๐Ÿ“ค Push to the branch (git push origin feature/amazing-feature)
  5. ๐ŸŽ‰ Open a Pull Request

Contributions of all kinds are welcome โ€” feel free to open a PR!


๐Ÿ‘ Authors & Contributors

Magnus Overli
Magnus Overli

Creator & Maintainer
Teeflo
Teeflo

ARM64 fixes, README, icons & logo
Paulus Schoutsen
Paulus Schoutsen

hab CLI โ€” admin backbone

All Contributors

See the contributors page for the full list of amazing people who have helped make this project better!


๐Ÿ“œ License

This is free and unencumbered software released into the public domain - see the UNLICENSE file for details.


โญ If you find OpenCode helpful, please star this repository!

Made with โค๏ธ for the Home Assistant community

Installation โ€ข Features โ€ข Documentation โ€ข Support

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors