Top 200 ReposEXPLORER
Browse agents, categories and pages
Back to results
Planned, not doneThe source describes an intention, not a finished result.

Debug a Motion-Sensor Automation in Home Assistant

Overview

Claude Code connects to Home Assistant's MCP server in read-only mode, reads the motion sensor's and light's history and the logs, and explains why an automation did not fire, so you can fix it yourself.

Problem or Objective

More in Home and Devices

AI Agents and Models

Tools and Integrations

Tools
Claude Code · Home Assistant
Prerequisites
A Home Assistant instance reachable over HTTPS, an administrator account for the logs and history tools, and a Claude Code plan or API key.

How It Works

In Home Assistant, set up the Model Context Protocol server integration and turn on the read-only option, so the main URL only offers tools that do not change anything. Make the instance reachable over HTTPS, then add it to Claude Code with claude mcp add and log in. Paste the automation's YAML into the chat and ask Claude Code to read the history of the motion sensor and the light around a time the light should have come on, plus any related log lines. Ask it to compare those states with the automation's trigger, conditions and mode, and to name the most likely cause, such as a condition that was false or a sensor that never changed state. Edit the automation yourself in Home Assistant, then walk past the sensor and check the result.

Implementation Workflow

Steps assembled from the agents, tools and prompt of this entry. Adapt them to your own setup.

  1. Choose the agentSet up Claude Code, Home Assistant.
  2. Connect the toolsConnect the tools this workflow relies on: Claude Code, Home Assistant.
  3. Check the prerequisitesA Home Assistant instance reachable over HTTPS, an administrator account for the logs and history tools, and a Claude Code plan or API key.
  4. Gather your detailsCollect what the prompt asks for: Motion sensor entity, Light entity, Time window to check, Automation YAML.
  5. Run the starter promptPaste the starter prompt below into Claude Code and adapt it to your case.
  6. Check against the documentationCompare what you get with the documentation at home-assistant.io before you rely on it.

Practical Starter Prompt: Find why a motion automation did not fire

Fill the fields to adapt the prompt. Empty fields stay as visible [placeholders].

Preview
Using the Home Assistant MCP tools in read-only mode, read the history of [Motion sensor entity] and [Light entity] between [Time window to check], and any related log entries. Compare what happened with this automation:

[Automation YAML]

Explain step by step whether the trigger fired, which condition blocked it if any, and what the mode setting did. Suggest one change to the YAML and explain it. Do not call any action or change anything; I will review your suggestion, then edit and test the automation myself.

Keep the MCP server on read-only while debugging. You make and test every change to the automation yourself in Home Assistant.

Expected Results and Benefits

This is a suggested workflow, not a reported result. The points below are what the cited documentation says the tools can do.

This is a suggested workflow, not a reported outcome. The Home Assistant page documents the MCP server, a Claude Code setup over HTTPS, an administrator tool set that reads entities, logs and history, and a read-only option. It does not mention automation traces, so open the trace view in Home Assistant yourself if the history and logs do not explain the problem.

Limitations and Considerations

The full Home Assistant tool set needs an administrator account and can perform any action, so keep the read-only option on while debugging. Claude Code needs an HTTPS address for the instance; check whether an HTTPS address on your own network works before exposing Home Assistant to the internet, which widens its exposure. Sensor history shows presence in your home, so treat chat logs as private. Results depend on your setup and were not independently reproduced by Top 200 Repos.

GitHub Repositories

AI Agent Repository

Source code of the agent that does the work.

Official Website

The official site of the main tool or project in this use case.

Visit Website (opens in a new tab)home-assistant.io

Related Videos

About anthropics/claude-code

About anthropics/claude-code

Independent creators. Listing a video implies no endorsement, sponsorship or partnership.

Sources

  1. Model Context Protocol - Home Assistant (opens in a new tab)

    Project documentation · home-assistant.io · Undated · Source checked 26 Nov 2026, 23:34 UTC

    What this source supports
    • With this integration, Home Assistant is the MCP server and offers AI tools that conversation agents and AI apps can use to read information, control entities, or manage Home Assistant.
    • The Home Assistant tool set looks into and manages Home Assistant itself: it can read all entities, logs, and history, list and reload integrations, and perform any action. Only administrators can use it.
    • A read-only option makes the main URL expose only AI tools that are marked as not changing anything, leaving out Call action, Reload config entry and the device control tools. This option is turned off by default.
    • Claude Code connects to MCP servers over HTTPS only, using the MCP server URL of a remotely accessible Home Assistant instance.
Report a problem

More with Claude Code

Planned, not done

Create Custom Store Tools Instead of Paying for Subscriptions

Use Claude Code to write small in-house tools for an online shop, such as a reply helper for support mail or a margin report, as an alternative to paying for separate apps, with testing before you rely on them.

code.claude.comanthropics/claude-code
Reported by source

Answer technical questions by letting async agents run experiments

Simon Willison sends research questions to cloud coding agents such as Claude Code for web and Codex Cloud, which write and run experiments in a dedicated repo and open a PR.

simonwillison.net · 6 Nov 2025anthropics/claude-code, openai/codex
Planned, not done

Structure Repeated Browser Research Into Evidence Tables

Give Claude Code the open-source Browser Use CLI with a local browser, ask the same research questions across a short list of pages, and keep every answer as a sourced table row.

github.comanthropics/claude-code, browser-use/browser-use

View all: Claude Code