Introducing HA Configuration Agent - AI-powered Home Assistant configuration assistant with approval workflow

:robot: AI Configuration Agent - Your Natural Language Config Assistant

Transform Home Assistant configuration with conversational AI

I’m excited to share a new add-on I’ve been working on that brings AI-powered configuration management to Home Assistant. Instead of manually editing YAML files, you can now describe what you want in plain English and let an AI agent handle the technical details.

What Does It Do?

The AI Configuration Agent is a Home Assistant add-on that uses OpenAI’s Agent SDK to understand your configuration requests and safely modify your Home Assistant setup. Think of it as having an expert assistant who knows YAML, understands Home Assistant conventions, and can explain or modify your configuration on demand. Not only can it modify the YAML configuration files but it can also modify Dashboards and other entities configured in the UI.

Ask it things like:

  • “Rename everything with Mary/mary to Ludell/ludell”
  • “Add an automation to turn off all lights at midnight”
  • “Show me all automations that use the motion sensor in the living room”
  • “Create a script that announces when someone arrives home”
  • “Explain what my existing bedroom automation does”
  • “Add a notification when the front door is left open for 5 minutes”

The agent analyzes your request, reads your current configuration, generates the necessary changes, and shows you a beautiful diff for approval before applying anything.

:dart: Key Features

:speech_balloon: Natural Language Interface

No more memorizing YAML syntax or Home Assistant conventions. Just describe what you want in plain language through a clean web interface.

:lock: Review & Approve Workflow

Every configuration change is presented with a side-by-side diff showing exactly what will change. You approve or reject before anything touches your files.

:shield: Safety First

  • Automatic backups before every change
  • YAML syntax validation
  • Home Assistant configuration validation (check_config)
  • Atomic file writes (never corrupt files)
  • Rollback on validation failure
  • Path traversal protection
  • AppArmor sandboxing

:wrench: Preserves Your Formatting

Uses ruamel.yaml to maintain comments, formatting, and structure in your existing files. Changes are surgical - only modifying what’s necessary.

:globe_with_meridians: Works With Any OpenAI-Compatible API

  • Default: OpenAI GPT-5
  • Custom endpoint support (OpenRouter, Anthropic, Azure, local models via Ollama)
  • Configurable model selection

:rocket: Installation

Requirements

  • Home Assistant OS, Supervised, or Container
  • OpenAI API key (or compatible endpoint)

Steps

  1. Add the repository
  • Go to SettingsAdd-onsAdd-on Store⋮ MenuRepositories
  • Add: https://github.com/yinzara/ha-config-ai-agent
  1. Install the add-on
  • Find “AI Configuration Agent” in your add-on store
  • Click Install
  1. Configure
  • Open the add-on configuration tab
  • Add your OpenAI API key
  • (Optional) Customize model and endpoint
  • Click Save
  1. Start
  • Go to the Info tab
  • Click Start
  • Enable Start on boot (recommended)
  1. Access
  • Click Open Web UI or find it in your sidebar

:gear: Configuration Options

openai_api_url: "https://api.openai.com/v1"  # API endpoint
openai_api_key: "sk-..."                      # Your API key
openai_model: "gpt-4o"                        # Model to use
log_level: "info"                             # Logging verbosity
max_backups: 10                               # Backup retention
auto_approve: false                           # NEVER enable unless testing

Using Alternative Providers

OpenRouter (100+ models):

openai_api_url: "https://openrouter.ai/api/v1"
openai_api_key: "sk-or-v1-..."
openai_model: "google/gemini-2.5-flash"

Local Ollama:

openai_api_url: "http://your-ollama-server:11434/v1"
openai_api_key: "ollama"
openai_model: "llama3.1:70b"

Azure OpenAI:

openai_api_url: "https://your-resource.openai.azure.com/openai/deployments/your-deployment"
openai_api_key: "your-azure-key"
openai_model: "gpt-4"

:bulb: Example Use Cases

1. Creating Automations

You: "Create an automation that turns on the porch light at sunset and turns it off at 11 PM"

Agent: *Reads configuration.yaml and automations.yaml*
       *Generates new automation with proper triggers and actions*
       *Shows diff with added YAML*

You: *Approves*

Agent: ✅ Automation added successfully! Would you like me to explain how it works?

2. Debugging Configurations

You: "Why isn't my bedroom motion automation working?"

Agent: *Reads automations.yaml*
       I found your bedroom automation. I notice a few issues:
       1. The entity_id has a typo: 'binary_sensor.bedroom_motion_senson' should be 'sensor'
       2. The automation is currently disabled
       
       Would you like me to fix these issues?

3. Batch Operations

You: "Add a notification to all my door automations when I'm away"

Agent: *Analyzes all automations*
       I found 3 door-related automations. I'll add a condition to check if you're away
       and include a notification action to each. Here are the changes...

4. Learning Home Assistant

You: "Explain what template sensors are and show me examples from my config"

Agent: *Educational explanation + examples from your actual configuration*

:closed_lock_with_key: Security Considerations

  • Authentication: Uses Home Assistant’s built-in Ingress authentication
  • Sandboxing: AppArmor profile restricts file system and network access
  • Validation: All changes validated before applying
  • Backups: Automatic timestamped backups (configurable retention)
  • Approval Required: No changes happen without explicit user approval
  • Secrets Detection: Warns about hardcoded passwords/tokens in AI-generated configs
  • Path Protection: Prevents directory traversal attacks
  • Read-only by default: Analyzer agent cannot modify files

Important: Your OpenAI API key is stored in the add-on configuration (not accessible to the AI agent). API calls are made server-side. Your configuration never leaves your network except as LLM prompts.

:handshake: Contributing

This add-on is open source! Contributions welcome:

:books: Documentation

:question: FAQ

Q: Does this replace manual YAML editing? A: No! It’s a helper tool. You can always edit files manually. The add-on is best for routine tasks, learning, or when you want to move fast.

Q: What if the AI makes a mistake? A: You review every change before it’s applied. If something goes wrong after approval, automatic backups make rollback easy.

Q: How much does it cost? A: The add-on is free. You pay for OpenAI API usage (~$0.01-0.10 per request depending on model). Or use free alternatives like local Ollama models.

Q: Can I use this without internet? A: Yes, if you use a local model via Ollama or similar. The add-on itself runs entirely locally.

Q: Will this work with my custom components? A: The AI understands standard Home Assistant conventions. Custom component support depends on how well-documented they are in the training data.

Q: What about secrets.yaml? A: The agent can read secrets.yaml (with permission) but is trained to suggest !secret references instead of hardcoding sensitive values.

:pray: Acknowledgments

Built with:

Inspired by the amazing Home Assistant community and the need to make configuration more accessible to everyone.

:speech_balloon: Feedback & Support

I’d love to hear your thoughts, use cases, and suggestions!

  • This Thread: Share your experience below
  • GitHub Issues: For bugs and feature requests

Try it out and let me know what you think. I’m especially interested in hearing about:

  • Creative use cases I didn’t anticipate
  • Configuration patterns that work particularly well (or don’t)
  • Ideas for future agent capabilities
  • Integration suggestions

Screenshots



Happy automating! :house::sparkles:

9 Likes

Does this work independently of one’s Assist configuration? In other words, do I have to be using an LLM (or even the same LLM) with my voice assistants?

This add on is completely distinct from Assist and can use any LLM you would like (it doesn’t have to be supported by Assist). I like to use OpenRouter and then choose my model. I found google/gemini-flash-2.5 to be the fastest and least expensive.

Ah… sorry. Now I’ve read the docs I see this is not a voice thing - requests are typed.

Any chance we could have the docs from the add-on page on GitHub?

Sorry I’m confused what you’re asking.

Would you want to make requests to modify home assistant with your voice?

Github has the docs from the add on in the ha-config-ai-agent directory’s README.md and DOCS.md

What would you like from those docs added to the primary repository README.md

That was the first impression I got from this thread - you must admit that’s what the description sounds like. But no I wouldn’t, very dangerous! :grin:

Found the docs now, thanks.

“that were trained to the AI model months ago and may or may not be valid today.”

I finished the sentence for you.
HA is updated on a major rev monthly, and on a minor rev weekly.
Maybe suggest that if you are using this your HA should stay several months behind the current rev to give you a better chance that the suggestions will work.

I’m not sure that’s really necessary. Home Assistant doesn’t change the overall configuration syntax and available services very often. Additionally everyone should be aware of knowledge cut off dates on models and their inability to know things past those dates.

I’d beg to differ. There is zero valid training data on anything post 2024.11 and a ton of changes (including templates) happened this year. Unless you are building your own training data for fine tuning… I’d be concerned.

I suspect it does t know anything about labels() or label_entities() . And ignores floors() syntax as well. (all added since that time) You also need to do a bunch of work to stop it from putting python native code in HA sandbox templates… Have you done that work?

I can appreciate the hey we’re going to change this check before you go but I have big reservations that it’s doing things right…

:slight_smile: If you would like to propose a PR changing documentation to better reflect knowledge cut-off I’d be happy to review it. My system prompt is shared and configurable in the add on so if you don’t like what I choose, you can feel free to modify it to your hearts content.

So say they decide to deprecate some of the legacy functions that were around and will no longer be accepted. The AI will continue to source from the forums and redit and you tubes and wherever else to code your stuff, and it will just no longer work. How tightly are you limiting the knowledge base parameters for your AI queries? Because if you have less that like 500 words telling it to ignore it’s prior training, use only info in all the specific URL’s listed in the HA Docs website and the HA Developers website, then this will be VERY hit and miss.

The main thing I ended up using this add on for was mass refactors like for example when people move in or out of the house and I want to reassign devices and rename a bunch of entities/areas/devices. This worked really well! I’m not sure it’s going to be great at every task you put to it but it was very helpful to me. I found Google’s Gemini Flash to be the best model for speed and accuracy and tool usage.

Seems to know something

How would it rename gui based helpers, correct illegal references in helpers after refactoring, change template helpers, modify gui based dashboards, etc? Or is this only useful for people who use only yaml configuration?

Can it also assign or change things like labels, categories, rooms etc. that are only available from the gui?

My current approach is to only use yaml if it cannot be done in the GUI.

Yes, this has access not only to YAML but to anything in your Lovelace Dashboard configuration (UI), entities, devices or areas. That generally will cover most things. If you want it to handle more than that I’d also accept a PR or if you can tell me what else it doesn’t support that you’ve tried I can see about enhancing it myself.

That’s new even two months ago most models missed this.

How exactly are those GUI based things changed? If it modifies storage then it will most definitely be able to brick HA.

For the UI based changes it accesses everything through the web socket API.

For the config file based changes it modifies storage but backs up the files before hand and then runs a “Check Configuration” before it quick reload/restarts HA and if it fails rolls back all the files that were changed.

1 Like

OK. Installation and configuration very easy - good docs.

Using gpt-4o I’ve had mixed results.

  • Using your question “Show me all automations that use the motion sensor in the living room”, it finds 19 files, then exceeds the token limit and errors out.

  • In answer to the question “Show me the automations that use the living room movement sensor” it finds no files, and replies that "there are no automations currently using the “living_room_movement_sensor”.

  • With the question “Show me the automations that use the entity binary_sensor.living_room_motion_sensor_motion” it finds two files (correctly) and gives a neat summary of each. Sometimes it gives the yaml, sometimes not.

So even very minor variations in the question can produce very different results.

This is not your add-on, of course - it’s in the nature of LLMs. I would like to experiment further with a much more extensive prompt (it’s just the default at the moment), but first reaction is that it might be useful as a tool for documenting my system; I wouldn’t use it to change anything, for reasons others have gone into.

One observation - if you navigate away from the web UI to another dashboard, then come back, its contents have been cleared. Is there any way of keeping a history?

I did try to use gpt-5-mini, but according to the error message my organisation must be verified to use that model. This involves submitting biometric ID. Well, that’s not going to happen.

Edit: A couple of hours of experimentation cost me $2.39

YOU MONSTER HOW COULD YOU!

I wanted to make this sort of addon!

1 Like