{"id":7807,"date":"2026-04-09T23:03:36","date_gmt":"2026-04-09T23:03:36","guid":{"rendered":"https:\/\/robertjwallace.com\/?p=7807"},"modified":"2026-05-02T20:12:09","modified_gmt":"2026-05-02T20:12:09","slug":"my-smart-home-just-got-a-new-brain-using-claude-code-to-tidy-up-home-assistant","status":"publish","type":"post","link":"https:\/\/robertjwallace.com\/es\/my-smart-home-just-got-a-new-brain-using-claude-code-to-tidy-up-home-assistant\/","title":{"rendered":"My Smart Home Just Got a New Brain: Using Claude Code to Tidy Up Home Assistant"},"content":{"rendered":"<p class=\"\">I\u2019ve always loved the flexibility of Home Assistant, but let\u2019s be honest: maintaining a complex setup as it grows can feel like a second job. Between the custom YAML configurations, legacy devices, and the constant evolution of the HA dashboard, things get messy.<\/p>\n\n\n\n<p class=\"\">Recently, I decided to see if <strong>Claude Code<\/strong>\u2014Anthropic\u2019s agentic CLI tool\u2014could handle the &#8220;spring cleaning&#8221; for me. After a weekend of testing, I can say it\u2019s a game-changer for terminal-focused automation.<\/p>\n\n\n\n<!--more-->\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u26a0\ufe0f First Rule of AI Automation: Backup Everything<\/strong><\/h3>\n\n\n\n<p class=\"\">Before we talk about the cool stuff, a word of caution: Because we are using <code>sshfs<\/code>, Claude Code is <strong>writing directly to your live files<\/strong>. One small &#8220;hallucination&#8221; in a YAML indentation can take your whole system down.<\/p>\n\n\n\n<p class=\"\"><strong>Do not start this without a fresh snapshot.<\/strong> Go to <strong>Settings &gt; System &gt; Backups<\/strong> and create a full backup. Better yet, if you\u2019re on a Pi or Mini PC, clone the SD card or drive.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>The Setup: Bridging the Gap<\/strong><\/h3>\n\n\n\n<p class=\"\">My Home Assistant instance runs on a dedicated mini PC, but I wanted to use Claude Code from my main workstation.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>1. Mounting the Config via SSHFS<\/strong><\/h4>\n\n\n\n<p class=\"\">I used <code>sshfs<\/code> to make my remote <code>\/config<\/code> folder appear as a local directory on my Zorin machine. Note that I&#8217;m using a local IP here; you&#8217;ll want to use your own internal address.<\/p>\n\n\n\n<p class=\"\">Bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Mounting the remote mini PC config to a local folder\nmkdir ~\/ha-config\nsshfs root@192.168.xxx.xxx:\/config ~\/ha-config\n<\/code><\/pre>\n\n\n\n<p class=\"\"><em>Tip: If you&#8217;re using the &#8220;Advanced SSH &amp; Web Terminal&#8221; add-on in HA, make sure SFTP is enabled in the add-on&#8217;s configuration!<\/em><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>2. Launching the Assistant<\/strong><\/h4>\n\n\n\n<p class=\"\">Bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd ~\/ha-config\nclaude\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 1: The Security Audit (The &#8220;Secrets&#8221; Move)<\/strong><\/h3>\n\n\n\n<p class=\"\">While Claude was scanning my files, it noticed something I\u2019d overlooked: I had several API keys and authorization tokens hardcoded directly into my <code>configuration.yaml<\/code> and some custom integrations.<\/p>\n\n\n\n<p class=\"\"><strong>The Logic:<\/strong><\/p>\n\n\n\n<p class=\"\">Claude didn&#8217;t just point this out; it explained that this was a security risk (especially if I ever back up my config to GitHub). It suggested moving them to <code>secrets.yaml<\/code>.<\/p>\n\n\n\n<p class=\"\"><strong>The Execution:<\/strong><\/p>\n\n\n\n<p class=\"\">I gave it the go-ahead, and it was impressive to watch. It:<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li class=\"\">Created\/Updated my <code>secrets.yaml<\/code> file with the new keys.<\/li>\n\n\n\n<li class=\"\">Replaced the hardcoded strings in <code>configuration.yaml<\/code> with <code>!secret<\/code> pointers.<\/li>\n\n\n\n<li class=\"\">Verified the syntax was still valid for Home Assistant.<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 2: Dashboard Refresh<\/strong><\/h3>\n\n\n\n<p class=\"\">My &#8220;What is on&#8221; dashboard tab was a mess\u2014it was missing several newer devices I\u2019d added.<\/p>\n\n\n\n<p class=\"\"><strong>The Prompt:<\/strong><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"\"><em>&#8220;Look at <code>ui-lovelace.yaml<\/code>. In the &#8216;What is on&#8217; tab, find the current &#8216;Entities&#8217; card. Compare with entities in the system and see if I am missing any.  Then add the missing ones using conditional cards to show them only when they are on.<\/em><\/p>\n<\/blockquote>\n\n\n\n<p class=\"\">Because Claude Code uses <strong>&#8220;Solution Math&#8221;<\/strong>\u2014calculating the logical outcome rather than just matching text\u2014it understood the YAML structure perfectly. It didn&#8217;t just dump the entities at the bottom; it integrated them, respected the indentation, and even suggested a better icon for my solar production sensor.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Final Thoughts<\/strong><\/h3>\n\n\n\n<p class=\"\">We\u2019ve all used AI to &#8220;write a script,&#8221; but Claude Code feels different because of its <strong>Agency<\/strong>. It isn&#8217;t just a chatbot; it\u2019s an assistant that has access to your actual files. It can run a <code>ha core check<\/code> command to verify its own changes before you ever hit &#8220;Save.&#8221;<\/p>\n\n\n\n<p class=\"\">For a power user, it feels like having a senior developer sitting next to you who knows the Home Assistant documentation by heart. Just remember: <strong>Backup first, automate second.<\/strong><\/p>\n\n\n\n<p class=\"\"><strong>Have you tried using agentic AI for your home automation yet? I\u2019d love to hear about the prompts you\u2019re using to keep your house running smoothly.<\/strong><\/p>","protected":false},"excerpt":{"rendered":"<p>I\u2019ve always loved the flexibility of Home Assistant, but let\u2019s be honest: maintaining a complex setup as it grows can feel like a second job. Between the custom YAML configurations, legacy devices, and the constant evolution of the HA dashboard, things get messy. Recently, I decided to see if Claude Code\u2014Anthropic\u2019s agentic CLI tool\u2014could handle &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/robertjwallace.com\/es\/my-smart-home-just-got-a-new-brain-using-claude-code-to-tidy-up-home-assistant\/\" class=\"more-link\">Continuar leyendo<span class=\"screen-reader-text\"> &#8220;My Smart Home Just Got a New Brain: Using Claude Code to Tidy Up Home Assistant&#8221;<\/span><\/a><\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","_eb_attr":"","footnotes":""},"categories":[143],"tags":[],"class_list":["post-7807","post","type-post","status-publish","format-standard","hentry","category-computer-stuff"],"featured_image_src":null,"featured_image_src_square":null,"author_info":{"display_name":"Bob","author_link":"https:\/\/robertjwallace.com\/es\/author\/admin\/"},"_links":{"self":[{"href":"https:\/\/robertjwallace.com\/es\/wp-json\/wp\/v2\/posts\/7807","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/robertjwallace.com\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/robertjwallace.com\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/robertjwallace.com\/es\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/robertjwallace.com\/es\/wp-json\/wp\/v2\/comments?post=7807"}],"version-history":[{"count":2,"href":"https:\/\/robertjwallace.com\/es\/wp-json\/wp\/v2\/posts\/7807\/revisions"}],"predecessor-version":[{"id":7918,"href":"https:\/\/robertjwallace.com\/es\/wp-json\/wp\/v2\/posts\/7807\/revisions\/7918"}],"wp:attachment":[{"href":"https:\/\/robertjwallace.com\/es\/wp-json\/wp\/v2\/media?parent=7807"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/robertjwallace.com\/es\/wp-json\/wp\/v2\/categories?post=7807"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/robertjwallace.com\/es\/wp-json\/wp\/v2\/tags?post=7807"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}