epijim@uk:~$

NAME

Letting Claude debug my smart home

— Using the Home Assistant MCP Server and SSH so Claude can see my house's state, history and config at once

SYNOPSIS

read --date 2026-12-06 --time ~6 min

Home AutomationAI

DESCRIPTION

Back in 2023 I wrote about setting up the smart home in our new house. Three years on, the house runs on a few hundred entities, a pile of dingz switches, Hue bulbs, Shellys, and more automations than I can keep in my head. Most of the time it just works. When it doesn’t, debugging it has always been the slow, annoying part.

This year I changed how I do that. I gave Claude two ways into Home Assistant: the Home Assistant MCP Server, so it can query live state and history, and SSH, so it can read the YAML, the logs and the devices behind it. With both at once it can do in a few minutes what used to take me an evening of clicking through the history panel.

Why two ways in

Debugging a smart home means answering two different kinds of question:

  1. What is the house actually doing? Which entity changed, when, and to what.
  2. Why is it set up to do that? Which automation, scene, group, integration or device setting caused it.

The Home Assistant UI is good at the first and awkward at the second. Looking at YAML in an editor is good at the second and useless for the first. The useful bit is having one thing that can line up both at the same time.

How Claude connects to Home Assistant: the MCP Server for live state and history, the Terminal & SSH add-on for config files, logs and the devices on the network.

The MCP Server

Home Assistant ships a Model Context Protocol Server integration. It exposes Home Assistant at /api/mcp, and an MCP client like Claude signs in with OAuth. With an admin account and the full tool set it can read every entity, the logs and the state history, and call services. That is the “what is the house doing” half.

SSH

The MCP Server doesn’t show Claude the files. For that I use the official Terminal & SSH add-on. Claude Code runs on my laptop in a clone of my config repo, and uses ssh to:

  • grep across /config for every place an entity is referenced
  • read automations.yaml, scenes, packages and custom components
  • tail home-assistant.log
  • talk directly to devices on the home network, like the dingz HTTP API

My config lives in git, so every change Claude makes lands as a reviewable commit rather than a silent edit on the server.

The kids’ lights

The bug that convinced me this was worth writing up was the lights in Malia’s and Timo’s rooms.

Their ceiling spots are Hue bulbs, but the bulbs get their power through an output on the dingz wall switch. So they can be controlled two ways: through Hue, or by the dingz switching its output. Every so often the spots would just go off, and stay off. I had looked at it a couple of times and blamed Hue.

Claude started with history rather than config, and spotted something I had glossed over. The bulbs weren’t going to off. They were going to unavailable. A Hue bulb that’s switched off is still on the network; a bulb that’s unavailable is one the Hue bridge can’t reach, and the most likely reason for a whole room of them is lost power. Nothing in Home Assistant was turning them off, so the next suspect was the dingz output feeding them.

Why "unavailable" mattered more than "off". The dingz output drops, the Hue bulb goes unavailable rather than off, and the watchdog automation puts the power back. Illustrative times, real entities and behaviour.

From there it went down to the device. Over SSH it could query the dingz HTTP API directly, which turned up two more things:

  • the dingz integration was addressing the wrong dimmer index on dingz firmware 2.4.3, so asking Home Assistant to switch that output back on didn’t reliably reach the right relay
  • that firmware returns a 404 if you send the time or reset_manual_time parameters, which our older REST commands did

The shape of the debugging session, reconstructed from the fix: history over MCP first, then the config and the dingz API over SSH, then a proposed fix.

The fix is a small watchdog automation. If any of the kids’ spots go unavailable for 20 seconds (and every five minutes, and on restart, just in case), it re-sends “relay on” straight to the dingz HTTP API. That’s harmless if the relay is already on. The clever bit, which I wouldn’t have thought of, is the second half: Hue bulbs default to on when power comes back. So if all of a room’s bulbs dropped out, it treats that as a probable power cut (it’s a rule of thumb: a Hue bridge outage would look the same), waits for them to reconnect and switches them back off, rather than lighting up a sleeping child’s room at full brightness.

- id: dingz_spots_power_watchdog
  alias: Keep Hue spots powered (dingz relays Malia + Timo)
  triggers:
  - trigger: state
    entity_id: [light.hue_color_spot_1, light.hue_ambiance_spot_1, ...]
    to: unavailable
    for: { seconds: 20 }
  - trigger: homeassistant
    event: start
  - trigger: time_pattern
    minutes: /5
  actions:
  - repeat:
      for_each: [Malia's room, Timo's room]   # dingz IP + that room's bulbs
      sequence:
      # any bulb unavailable -> re-send "relay on" via the dingz HTTP API
      # every bulb unavailable -> probably a power cut: wait for them to come
      #   back, then turn them off again (Hue defaults to ON)
      # either way, write a line to the system log saying what happened

The automation also logs what it did, so the next time it fires I can see whether it was a blip or a real power cut.

A dingz that stopped responding

The second example was a dingz that had become plain unreliable: sometimes it did what Home Assistant asked, sometimes it didn’t. Same approach: history to see when it stopped following commands, then SSH to look at the custom dingz integration and query the switch directly. The same debugging session updated the custom dingz integration and changed our REST commands to stop sending parameters the 2.4.3 firmware rejects.

What makes it work

A few things turned out to matter more than I expected.

  • History first, config second. “What state did it go to, and when?” stops it guessing. Here the answer, unavailable rather than off, pointed straight at power instead of at an automation.
  • Seeing everything at once. The bug wasn’t in any one place. It was in the overlap between Hue, a dingz output, a custom integration and a firmware update. Being able to look at state, config and the device together is what finds that.
  • It writes down why. Every change came with a description explaining the reasoning, which is more than past me ever left in automations.yaml.
  • Everything through git. Claude edits the repo, I review the diff, and it’s easy to roll back.

Security

Handing an AI the keys to the house deserves some care. Home Assistant is not exposed to the internet at all. Claude reaches it from inside the house: the MCP Server through its OAuth sign-in, and the box over SSH. When I need devices remotely, I push them into Apple Home rather than opening Home Assistant up. Every config change goes through git where I can see it. Locks and anything else that controls who can get into the house are out of scope: I don’t let Claude touch those.

Quicker fixes

The biggest change isn’t any one fix. It’s how much quicker fixes are now. Bugs like the kids’ lights used to sit on a mental to-do list for weeks, because finding them meant an evening of cross-referencing history graphs against YAML. With an assistant that can see the state, the history and the config at once, it’s a short conversation and a reviewed commit.

SEE ALSO

  • smarthome(1) ← previous: Smart Home 2.0
  • huelights(1) related: My R package for controlling the lights in my house from R

AUTHOR

James Black · epijim.uk