Write and debug your smart-home automations by chatting with Claude Code
Idea + starter prompt, not run by us yet
For: Home Assistant users who keep putting off fixing messy automations
Adam stores his automations as YAML files in git. Claude Code connects to Home Assistant through an MCP server, searching devices, reading traces and reloading config. Each change means editing the file, copying it over, reloading and committing. It traced a noisy camera automation to GPS updates and fixed it in under two minutes.
Steps
- Put your automations in a git repo so every change can be undone.
- Connect Claude Code to Home Assistant through an MCP server and start with read-only actions such as search and traces.
- For a new automation, ask for a plan first: which existing automations it reads and what conflicts it checks.
- Write a short skills file with your naming habits and device quirks so Claude matches your style.
- Test the result by triggering the automation yourself, for example by walking past the sensor.
Starter prompt
Trial first: work in a scratch copy of the repo, [home-assistant-trial], and write the new YAML there. Do not copy anything to my running Home Assistant. My Home Assistant automations live as YAML in [repo path]. I want a new one: [describe, e.g. turn on the shed light on motion after dark, and keep lights that were already on]. First read my existing automations that use [motion sensors or similar] and tell me about any conflicts. Ask me questions if anything is unclear and show me the plan. Then write the YAML in a new file and show me the diff. Stop and wait for my yes before you copy it to Home Assistant, reload anything or commit. A clean diff is not permission. Start with read-only actions such as search and traces.
Original post: blog.beguelin.com · found via agentusecases.ai. Written up in our own words. We haven't run it, so test it on made-up data first.