Using Claude Code to manage your Home Assistant config is pretty amazing

Been running Home Assistant for many years and the yaml configs have gotten… extensive. Recently started using Claude Code directly on my HA OS instance, and now I can just casually modify or improve my automation without having to spend all the time to dig into how/what and clicking through the UI or editing files.

My setup: I SSH into HA, run Claude Code from the terminal, and use Cursor as my editor when I want to look at files. But most of the time I’m just talking to Claude in the terminal.

Here’s the setup if you want to clone it: GitHub - danbuhler/claude-code-ha: Use Claude code in Home Assistant to manage configuration and automations. It has scripts to deal with the reinstall after updates, and helper tools so Claude can control your HA instance via the API.

The other day I plugged in a new light in the living room. Instead of manually digging through the UI, finding the entity, figuring out which automations need updating, etc., I just said:

“I plugged a new light in the living room, can you find it and add it to the necessary automations? Please make suggestions on how it could fit into scenes too.”

And it found it, asked me to confirm by turning it off and on(!!), and then put it in the right room/zone, named it correctly, added it to the standard automations, and suggested some color schemes.

Other things I’ve used it for:

  • “The motion sensor in the hallway is too sensitive at night, can you add a condition so it only triggers above 20% brightness after 11pm?”
  • “Create a new automation that turns on the porch light when the garage door opens after sunset”
  • “Something’s wrong with my thermostat automations, they’re not firing - can you check the logs and fix it?”

I put together some helper CLI tools that let Claude actually query entity states, call services, manage the device registry, etc. Makes it way more useful than just editing yaml blindly.

Works with Claude Code, and the tools themselves can easily be adapted for Cursor or Codex too. The CLAUDE.md file gives it context about your setup and the available commands. It’s fairly minimal right now and I can see this expanding into a mega-prompt or skills for doing everything else.

What’s everyone else doing?

BTW GitHub - danbuhler/claude-code-ha: Use Claude code in Home Assistant to manage configuration and automations. is version 1, submit PR’s if you have better ideas, issues if it’s broken.

4 Likes

I don’t know about “everyone” but personally I’m attempting to be more efficient by not using LLMs. Measuring the Impact of Early-2025 AI on Experienced Open-Source Developer Productivity - METR

It would be interesting to see how much legacy config has been introduced to your system due to outdated training data.

3 Likes

Thanks for sharing. Amazing how much better this works than Claude in the Web VSCode that’s shipped with HA. Saves me a lot of reboot time too! Do you mount the config folder too in Cursor?

1 Like

This no longer holds up. At least for me. It’s so easy to integrate web searches (built into the latest Claude Code versions) or just write a few lines to evoke Firecrawl or Playwright to go find and scrape something. I personally stopped using MCPs for this, mostly drains the context window.

Yes it’s very easy to let something else do the work for you and not learn/understand a single thing.

4 Likes

I actually used it to update a lot of old legacy (hand) coded configs.

As well as migrate things to node-red, and even change from the old Govee integration to the newer MQTT one.

All things I know how to do, but didn’t want to spend all the time doing it manually.

I am surprised by the amount of AI doomerism in this community. AI will be the way we accomplish most tasks in the very near future.

4 Likes

Maybe - when there is actually AI instead of a fancy predictive text tool.

Which Claude package are you using? FREE, PRO or MAX?

Either probably work. I use max though as I use the credits elsewhere.

Ai coding is good enough for Linus Torvalds. Maybe drop him a note on your superior insights.

2 Likes

Nice to see LLM integrations, since they greatly help us overcome the severe challenges native HA coding method have.

FYI that I think Claude Code does not have a Free tier, so for a non-coder, it may not be worth the $20+ month.

To build complex dashboard cards and complex Blueprints (I publish these) I have extensively used free versions of Claude chat, Deepseek, ChatGPT, and Grok… and recently started trying Gemini.

I find each has different ‘super powers’ and problems/limits. But I have found a solid pattern…

Deepseek, while slow, is the least error prone (code is far more often syntax and indentation correct) and most accurate to the outcome desired.

Claude chat is almost as good as DS but far more limited on free usage so I only use it when DS gets stuck

In the past month or two ChatGPT, which was the best for 6 months for me, has become only good for small Q&A for code snippets or dashboard cards but has problems / mistakes outputting large code base (1000+ lines)

Grok was good, now its unusable, I dont even try anymore.

Gemini I have limited time with so far but it 1st try fixed a blueprint loop problem with adding an attachment to multiple notifications that DS, Claude, and CGPT could not figure out for 2 hours. So it may have potential

1 Like

Again do we or don’t we. *Le sigh… *

It would DO ALL OF US well to remember we are here. ^^^ points at bloky textures…

We are in the bottom of the uncanny valley of AI.

Yes it has promise yes each model has quirks.

Yes you can get amazing results with most Frontline models now and we are in the period where models will seemingly leapfrog each other weekly at this point. (deepseek is due a new model by mid Feb. At which point you’ll see the release cycle start again…)

No NONE (yes none, zero zip nada.) of them are ready for off leash set and forget Ronco code-o-matric yet.

The problems are many but basically boil down to one of two classes.

  1. syntax confusion. Most models know python and Jinja2 cold. Guess what -HA jinja is NOT Jinja 2 and has no queuing differentiation for the model to tell the difference.

This leads the model to happily answer with python structure and cased vars. It uses append and update with impunity which breaks the hell out of HA scripts this is the fundamental hurdle. To solve this any prompt that addresses this should start with

You are coding HA Jinja. While iflt shares structure with Jinja2 and Python do NOT assume the structures and syntax matches ALWAYS use the documentation at (ha core docs for templating link) first and if it’s not documented there assume it is syntactically inaccurate.

  1. you have to point at good examples. there is a dirth of good training examples so it falls back to what it knows… Or God forbid trolls the community site for clues… Which…

Runs it into a hoarde of bad examples and wrecked yaml where people are asking for help… Out of context with bad code that barely works. The only solution for this is counter with good examples. (yes I yojr prompt because they weren’t trained)

Like example of proper use of namespace because (explanation here : link to drew article in the cookbook about using a namespace)

Example of how to use filters against a domain tk get a result set instead of a loop and why… With links to one of Taras’ articles discussing same

And on

And on

And on

If you want any prayer of having reproducible results you MUST hit these two items head on in any prompt. Yes your prompt for coding will grow a lot if you’re going to be good at it.

Keep this list and anytime you see it Bork something. Add your counter to your list of dos and do nots. Eventually your list will start to generate some decent code. But… You also need to know what to look for so yih can correct it.

Yes I just said you’re a teacher. Of code. To a bot. If you aren’t up to that task. Stop and wait for model improvement.

…Because it WILL Lie to you. Confidently. It doesn’t know what a lie is and that it’s lying but it will confidently throw out everything you just taught it and tell you it can pass a variable without a namespace even though you spent a half hour training otherwise because something in your new pattern matches a python structure it knows better than your examples.

Will it get better? Yep. Exponentially. Fast too. Think about the gap between early Tomb Raider and now. And how fast that went, relatively…

But until then- were watching Reboot. The story is cool but the graphics aren’t gonna hold up in 5 years. Don’t trust current as possible but also don’t judge future by blocky textures… :sunglasses:

4 Likes

He actually commented that he was OK with vibe coding as long as it’s not used for anything that matters

The correct and efficient operation of my home matters quite a bit to me.

I think it all depends on what you ask and what you give. And which model you use. But i only hear you talking about generics. Claude is not a model, gemini has multiple versions, Deepseek also has multiple versions. ChatGPT is not a model.

I’ve tried Gemini 2.5 pro, Claude Opus 4.5, Claude Sonnet 4 and 4.5, Claude Haiku 4.5, GPT 5.2 and GLM 4.7 for coding. And they can all make stupid and terrible code. But with the right tools, the right prompts and the right context i’ve found Claude Opus 4.5 to be acceptable.

I agree with @tom_l on this one. And there are far too many people (mostly shouting on youtube how they made something in one prompt) who just make things worse for everybody. Those are the people who can’t read and understand what an LLM produces. If you can’t do that or you are not willing to learn to understand it you are playing with fire.

@tom_l i’ve seen so many times models mistakenly use old version data because the context window was full and it “forgot” the rules i gave it for the tech stack. So yeah, you really hit the nail on the head there.

But, there is also a way to really help everybody. Because it is certainly possible to create beautiful things with the help of AI. And let me repeat that: with the help.

Joke of a study. And completely unrelated.

1 Like

Got some peer reviewed data to back up your baseless opinion?

How about the fact that:

  • a (probably non-technical) person working on home assistant just trying to get something to work
  • a dev working on their own open source package

Aren’t connected in any meaningful way.

1 Like

Not actually a fact. It is entirely relevant. And completely applicable. For the same reason we currently have this policy: Want to help others? Leave your AI at the door - Home Assistant

Don’t drink the LLM Koolaid.

1 Like

It really isn’t. A developer working on their own package knows it from inside out. They are already competent, they know where everything is. Someone new to home assistant does not know how it works. The amount of options are overwhelming, and that is where an AI like Claude is a tremendous help. That 3 year old rule needs updating, given how good AIs have become at coding. Especially claude!

The fact that the LLM will confidently bullshit in both cases is the issue.

So in this case where the user is less able to identify when this happens the issue is even worse.

There is an update to that policy coming soon. Something close to “no plagiarism”. I.e. only submit your own verified work. Simply supplying the straight untested output of an LLM will be prohibited. Or words to that effect. It is a work in progress.

1 Like