ha-mcp / tests
AGENTS.md4.9k starsChanged 2 months agoMITView on GitHub
The suite runs on several backends, and a test that only makes sense on some of them is gated by a marker rather than a runtime skip. The markers and their exact skip conditions are defined in src/e2e/_conftest_collection.py::pytest_collection_modifyitems — read that docstring before adding a gate: Pick the marker by what the test needs, not by where it happens to pass: external_only is about needing an in-process server you can reconfigure, inaddon_only about needing the app (add-on) supervisor context. Read…
Trending
More talk lately.about the whole repository
Who's talking about homeassistant-ai/ha-mcp
- pail23/stiebel_eltron_isg_component“State class removed from _today energy sensors after updating to 2026.8”GitHub · Aug 14, 2026 · 6 reactions
- @syshack.ch“So cool - I installed claude code in the SSH core app (curl -fsSL claude.ai/install.sh | bash) and linked …”Bluesky · Aug 8, 2026 · 4 likes
- @burnsie.com“Absolutely! This thing is awesome and I use it for all sorts of @homeassistant.bsky.social tasks …”Bluesky · Mar 23, 2026 · 3 likes
- @bradsjm.bsky.social“Connecting Codex CLI using GPT 5.2 with this very powerful MCP server (github.com/homeassistan...) is a …”Bluesky · Dec 25, 2025 · 3 likes
- A Hacker News story“The Unofficial and Home Assistant MCP Server”Hacker News · Jun 16, 2026 · 2 points
The biggest 5 of 46 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 46
Talked about on GitHub, Bluesky and Hacker News (46 times).
On GitHub · 40
- Aug 14, 2026State class removed from _today energy sensors after updating to 2026.8 — pail23/stiebel_eltron_isg_component6 reactions · 4 comments
- Sep 27, 2026Enhancement: ha-mcp style in-process MCP onboarding for zero-config agent setup — ruaan-deysel/unraid-management-agent1 reaction · 3 comments
- May 12, 2026install for home-assistant only https://github.com/homeassistant-ai/ha-mcp — jeffborg/home-network1 reaction
- May 6, 2026Extend Assist with home management help, starting with documentation — OpenHomeFoundation/roadmap1 reaction · 6 comments
- Oct 4, 2026Add home assistant mcp — d-buckner/bloud0 reactions
35 more on GitHub
- Oct 3, 2026agent-skills.github.homeassistant-ai.ha-mcp: 8.5.0 → 8.6.0 — sudosubin/agents.nix0 reactions
- Oct 3, 2026feat(container): update image ghcr.io/homeassistant-ai/ha-mcp to v8.6.0 — Stormcargo/k8s-gitops0 reactions · 1 comment
- Oct 1, 2026Energy counters stay at 0 since mid-August (device reports Electric: 0 while running) — blues-sechseck/Mitsubishi-WF-RAC-Integration0 reactions · 1 comment
- Sep 30, 2026feat(container): update image ghcr.io/homeassistant-ai/ha-mcp (8.5.0 ➔ 8.6.0) — tscibilia/home-ops0 reactions · 1 comment
- Sep 30, 2026feat(container): update image ghcr.io/homeassistant-ai/ha-mcp (8.5.0 → 8.6.0) — joryirving/home-ops0 reactions · 2 comments
- Sep 30, 2026feat(container): update image ghcr.io/homeassistant-ai/ha-mcp (8.5.0 ➔ 8.6.0) — drag0n141/home-ops0 reactions · 1 comment
- Sep 28, 2026agent-skills.github.homeassistant-ai.ha-mcp: init at 8.5.0 — sudosubin/agents.nix0 reactions
- Sep 19, 2026[vote] hacs/homeassistant-ai/ha-mcp: 8.4.3 -> 8.5.0 — HA-Update-Manager/community-votes0 reactions · 1 comment
- Sep 19, 2026feat(container): update image ghcr.io/homeassistant-ai/ha-mcp to v8.5.0 — Stormcargo/k8s-gitops0 reactions · 1 comment
- Sep 16, 2026build(deps): bump homeassistant-ai/ha-mcp from 7.8.1 to 8.5.0 in /config/homeassistant — tun0/frigate-reid0 reactions
- Sep 16, 2026feat(container): update image ghcr.io/homeassistant-ai/ha-mcp (8.4.3 ➔ 8.5.0) — drag0n141/home-ops0 reactions · 1 comment
- Sep 9, 2026python3Packages.ha-mcp: 8.4.0 -> 8.4.3 — NixOS/nixpkgs0 reactions · 1 comment
- Sep 7, 2026build(deps): bump homeassistant-ai/ha-mcp from 7.8.1 to 8.4.3 in /config/homeassistant — tun0/frigate-reid0 reactions · 1 comment
- Sep 5, 2026fix(container): update image ghcr.io/homeassistant-ai/ha-mcp (8.4.2 ➔ 8.4.3) — tscibilia/home-ops0 reactions · 1 comment
- Sep 5, 2026fix(container): update image ghcr.io/homeassistant-ai/ha-mcp (8.4.2 ➔ 8.4.3) — drag0n141/home-ops0 reactions · 1 comment
- Sep 4, 2026build(deps): bump homeassistant-ai/ha-mcp from 7.8.1 to 8.4.2 in /config/homeassistant — tun0/frigate-reid0 reactions · 1 comment
- Sep 4, 2026fix(container): update image ghcr.io/homeassistant-ai/ha-mcp (8.4.1 ➔ 8.4.2) — drag0n141/home-ops0 reactions · 1 comment
- Sep 4, 2026fix(container): update image ghcr.io/homeassistant-ai/ha-mcp (8.4.1 ➔ 8.4.2) — tscibilia/home-ops0 reactions · 1 comment
- Sep 4, 2026fix(container): update image ghcr.io/homeassistant-ai/ha-mcp (8.4.1 → 8.4.2) — joryirving/home-ops0 reactions · 2 comments
- Sep 2, 2026build(deps): bump homeassistant-ai/ha-mcp from 7.8.1 to 8.4.1 in /config/homeassistant — tun0/frigate-reid0 reactions · 1 comment
- Sep 2, 2026fix(container): update image ghcr.io/homeassistant-ai/ha-mcp (8.4.0 ➔ 8.4.1) — drag0n141/home-ops0 reactions · 1 comment
- Sep 1, 2026[FIXTURE] Consolidate CI lanes — homeassistant-ai/ha-mcp-workflows-dev0 reactions · 1 comment
- Sep 1, 2026[FIXTURE] Add Traditional Chinese locale — homeassistant-ai/ha-mcp-workflows-dev0 reactions · 1 comment
- Sep 1, 2026[FIXTURE] Document ha_call_service parameters — homeassistant-ai/ha-mcp-workflows-dev0 reactions · 1 comment
- Sep 1, 2026[FIXTURE] Reduce CI runner contention without losing coverage — homeassistant-ai/ha-mcp-workflows-dev0 reactions · 1 comment
- Sep 1, 2026[FIXTURE] Discover HA-MCP natively inside Home Assistant — homeassistant-ai/ha-mcp-workflows-dev0 reactions · 1 comment
- Sep 1, 2026[FIXTURE] Let agents clean up blueprints reported as unused — homeassistant-ai/ha-mcp-workflows-dev0 reactions · 1 comment
- Sep 1, 2026[FIXTURE] Support safely removing unused blueprints — homeassistant-ai/ha-mcp-workflows-dev0 reactions · 1 comment
- Aug 31, 2026build(deps): bump homeassistant-ai/ha-mcp from 7.8.1 to 8.4.0 in /config/homeassistant — tun0/frigate-reid0 reactions · 1 comment
- Aug 29, 2026feat(container): update image ghcr.io/homeassistant-ai/ha-mcp (8.3.0 ➔ 8.4.0) — drag0n141/home-ops0 reactions · 1 comment
- Aug 24, 2026build(deps): bump homeassistant-ai/ha-mcp from 7.8.1 to 8.3.0 in /config/homeassistant — tun0/frigate-reid0 reactions · 1 comment
- Aug 15, 2026MCP write tool calls rejected: Unexpected keyword argument arguments / tool_call requires a name argument (reads work) — NousResearch/hermes-agent0 reactions · 2 comments
- Aug 13, 2026build(deps): bump homeassistant-ai/ha-mcp from 7.8.1 to 8.2.0 in /config/homeassistant — tun0/frigate-reid0 reactions · 1 comment
- Aug 10, 2026build(deps): bump homeassistant-ai/ha-mcp from 7.8.1 to 8.1.1 in /config/homeassistant — tun0/frigate-reid0 reactions · 1 comment
- Aug 5, 2026NR-65D 보일러 제보 입니다 — ripe-avocado/navien_smart_ha0 reactions · 1 comment
On Bluesky · 5
- Aug 8, 2026So cool - I installed claude code in the SSH core app (curl -fsSL claude.ai/install.sh | bash) and linked it with the… — @syshack.ch4 likes and reposts · 7 replies
- Mar 23, 2026Absolutely! This thing is awesome and I use it for all sorts of @homeassistant.bsky.social tasks github.com/homeassistan... — @burnsie.com3 likes and reposts · 1 reply
- Dec 25, 2025Connecting Codex CLI using GPT 5.2 with this very powerful MCP server (github.com/homeassistan...) is a game changer for my #homeassistant.… — @bradsjm.bsky.social3 likes and reposts · 1 reply
- Mar 4, 2026Claude is the way to configure Home Assistant: github.com/homeassistan... — @denovich.com1 likes and repost
- Dec 6, 2025github.com/homeassistan... — @rewse.jp0 likes and reposts · 1 reply
On Hacker News · 1
- Jun 16, 2026The Unofficial and Home Assistant MCP Server2 points
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository17 other files it gives its agents.
- AGENTS.mdAGENTS.md
- homeassistant-addon-webhook-proxy/AGENTS.mdAGENTS.md
- homeassistant-addon-webhook-proxy-dev/AGENTS.mdAGENTS.md
- site/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- homeassistant-addon-webhook-proxy/CLAUDE.mdCLAUDE.md
- homeassistant-addon-webhook-proxy-dev/CLAUDE.mdCLAUDE.md
- site/CLAUDE.mdCLAUDE.md
- tests/CLAUDE.mdCLAUDE.md
- bat-adhocSkill
- bat-story-evalSkill
- contrib-pr-reviewSkill
- contributors-updateSkill
- issue-analysisSkill
- issue-to-pr-resolverSkill
- my-pr-checkerSkill
- wtSkill
The file
We split this AGENTS.md into the rules it gives an agent
9 rules. About 0 are common, 4 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 64
Test legacy internals directly with the live ha_client when the contract under test is specific to that implementation (the reference-graph …
- Very specific: line 114
Every test under tests/ follows these.
- Distinctive: line 122
Prove the test catches the bug: Write the regression test first and watch it fail, as the root AGENTS.md requires.
- Distinctive: line 128
One property, one test: Test each property at the lowest layer that can see it: logic in unit tests.
- Very specific: line 148
A test supplies its own world: No reads from the real home directory or ~/.ha-mcp, no network beyond the test's own containers, no answer …
- Distinctive: line 174
FastMCP validates required params at schema level: Don't test for missing required params:
- Very specific: line 185
Poll after creating entities: After creating an entity (automation, script, helper, etc.), HA needs time to register it.
- Very specific: line 203
Every rendered <script> body in the repo (src/ha_mcp/settings_ui/ — page HTML in settings.html, client JS in settings_js/.
- Distinctive: line 240
When adding a new UI surface:
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Test Infrastructure and Rules
Custom Component (ha_mcp_tools)
- Component is installed into the Docker container by
_install_custom_componentinsrc/e2e/_conftest_seed.py - HA's
call_service(return_response=True)wraps results in{"changed_states": [], "service_response": {...}}. Most tools unwrap it withunwrap_service_response()(src/ha_mcp/tools/util_helpers.py);ha_call_serviceinstead splits it, projectingchanged_statesintoresultand surfacingservice_responseonce at the top level (issue #2085) hass.async_add_executor_jobonly passes positional args — uselambda:wrappers for calls needing kwargs (e.g.,mkdir(parents=True, exist_ok=True))- HA Docker image uses
annotatedyaml(PyYAML wrapper), NOTruamel.yaml— custom components needing ruamel must declare it inmanifest.jsonrequirements - Feature flags (
ENABLE_YAML_CONFIG_EDITING,HAMCP_ENABLE_FILESYSTEM_TOOLS) are set inha_container_with_fresh_configfixture
Backend Lanes and How to Gate a Test
The suite runs on several backends, and a test that only makes sense on some
of them is gated by a marker rather than a runtime skip. The markers and
their exact skip conditions are defined in
src/e2e/_conftest_collection.py::pytest_collection_modifyitems — read that docstring
before adding a gate:
| Marker | Runs on |
haos_only | HAOS backends only (HAOS_TEST_IMAGE_PATH set). Auto-applied to everything under src/e2e/haos_only/ — no marker needed there |
beta_haos_only | HAOS beta-image lanes where OS/Supervisor/Core version expectations are configured. If any expectation is set, the test runs so partial configuration fails visibly |
container_only | the testcontainer backend only (includes the container-embedded lane) |
embedded_only | the embedded testcontainer backend only (E2E_BACKEND=embedded) — the one lane whose session container has ha-mcp installed inside the HA image. Skips everywhere else, including haos_embedded |
external_only | anywhere the server-under-test runs IN the pytest process: plain testcontainer and HAOS external. Skips stdio, inaddon, container-embedded and HAOS-embedded, which cannot be reconfigured via test-process env / monkeypatch or reach an in-process mock. The name is historical — it does NOT mean "HAOS external only" |
inaddon_only | HAOS inaddon mode only (HAOS_TEST_MODE=inaddon), where is_running_in_addon() paths are live |
haos_stdio_only | HAOS stdio mode only (HAOS_TEST_MODE=stdio), where the installed ha-mcp command is exercised through a real subprocess transport |
haos_embedded_only | HAOS embedded mode only (HAOS_TEST_MODE=embedded), where the in-process server shares Home Assistant's process and event loop — for tests whose subject is that shared loop (#2357). Skips every other lane at collection, so no VM boots just to skip |
not_on_embedded / not_on_haos_embedded | everywhere except that lane, for tests the lane's own session backend already covers |
requires_tools_entry | every lane EXCEPT the no-tools lanes (E2E_NO_TOOLS_ENTRY=1), where the File & YAML Tools entry is absent (#2292) |
no_tools_only | the no-tools lanes only — the mirror of requires_tools_entry |
Pick the marker by what the test needs, not by where it happens to pass:
external_only is about needing an in-process server you can reconfigure,
inaddon_only about needing the app (add-on) supervisor context. Read the skip
expressions, not the summary docstring: external_only does not mean
"HAOS external only".
A marker-gated test changes the per-lane skip counts that
tests/src/e2e/basic/test_backend_dispatch_smoke.py caps. Record the
increments in a new tests/src/e2e/basic/skip_ceiling/pr<N>.json fragment
({"reason": ..., "deltas": {lane: n}}) rather than editing
_SKIP_CEILING_BASELINE; fragments from different PRs never conflict. Re-pin
the baseline only from a CI observation, deleting the fragments it absorbs.
Two different things share the ha_mcp_tools name — don't conflate them:
- The component itself (filesystem / registry tools) is installed on
every lane by
_install_custom_componentEXCEPT the no-tools lanes (E2E_NO_TOOLS_ENTRY=1, see below), where the "File & YAML Tools" config entry is absent and the privileged services never register. A test that relies on tools-entry behaviour must carryrequires_tools_entry; everywhere else a test may still rely on component-gated behaviour with no marker — e.g. a config entry'sunique_id, which Home Assistant's own API never exposes on any endpoint. Consequence forha_search: a query-driven call is served by the component's in-process scan, not the legacy REST path, so a test written for legacy-only behaviour passes vacuously. This holds whensearch_typesnames"dashboard": the component serves the surfaces its search command has while the dashboards leg serves that bucket, merged server-side (#2289). Components advertisingsearch_unifiedalso serve queryless listings, location filters, and result windows above 500, so an oversized limit does not select the legacy route. Test legacy internals directly with the liveha_clientwhen the contract under test is specific to that implementation (the reference-graph E2E does this). A dashboard-only old-schema request still uses its own orchestration because no component search surfaces remain after splitting. - The in-process "server" config entry of that same component (#1527) is the embedded backend only, seeded separately. That one IS lane-specific.
In production the component is optional (it ships via HACS), so server code reading component-only data must degrade honestly for installs without it rather than assume the e2e's always-present case.
No-tools lanes (E2E_NO_TOOLS_ENTRY=1, #2292)
The rest of the suite always has the "HA-MCP File & YAML Tools" config entry.
E2E_NO_TOOLS_ENTRY=1 runs a lane without that entry. The lanes that keep the
component match the state most real users are in: integration installed,
second entry never added.
It is orthogonal to the backend selectors, so each backend has its own shape:
| Lane | Topology |
container (E2E_BACKEND unset) | no component at all — _install_custom_component is skipped for ha_mcp_tools, so neither files nor entry exist. A user who never installed the integration |
container embedded | server entry only — component files are copied with seed_entry=False (no tools entry) and the in-process server entry is seeded as usual |
HAOS inaddon | no component in effect — remove_tools_entry_in_qcow2 drops the baked tools entry pre-boot; nothing else sets one up |
HAOS embedded | server entry only — same pre-boot removal, and the staged (disabled) server entry is deliberately kept |
The staging lives in _conftest_testcontainer._prepare_testcontainer_config (container) and
_conftest_haos._prepare_haos_image → haos_runtime.remove_tools_entry_in_qcow2
(HAOS). The qcow2 edit is offline and per-worker, like the recorder / HACS
refreshers, and raises rather than warning: a silent no-op would leave the
entry in place and the lane would re-test the ordinary topology while
reporting green.
Two markers gate on it, both dispatched from pytest_collection_modifyitems:
requires_tools_entry— the test needs the entry, so it skips on these lanes. Applied module-wide to the filesystem / YAML suites.no_tools_only— the test pins what happens WITHOUT the entry, so it skips everywhere else.src/e2e/workflows/filesystem/test_tools_entry_absent.pyis the module that carries it.
The server entry also registers the ha_mcp_tools/* WebSocket surface
(#2291), so on the two embedded shapes the shared
component capabilities answer while the privileged services stay gone —
that split is the whole point of the lanes, and test_tools_entry_absent.py
asserts both halves.
Test Design Rules
Every test under tests/ follows these. Reviewers check new and changed
tests against them.
- Test our code, not the platform. Assert on behaviour this repository owns, not that Python, FastMCP, pydantic or Home Assistant do what their docs say. A dependency may set up the failure; the assertion is on how our code handles it. See the FastMCP schema-validation note under E2E Test Patterns.
- Prove the test catches the bug. Write the regression test first
and watch it fail, as the root
AGENTS.mdrequires. When a test is added to a fix that already exists (for example during review), revert the fix, confirm the test fails, then restore it. A test that builds its input by hand, or covers only a pure helper, can pass with the fix reverted. - One property, one test. Test each property at the lowest layer that can see it: logic in unit tests; wiring, packaging and real Home Assistant behaviour in E2E. Two tests that assert the same property are one too many, whatever layer or client they use. Check for an existing test first. In a parametrized table, keep one case per branch, plus any value that failed in the wild. If deleting a case leaves coverage unchanged, it was a duplicate.
- Do not restate the implementation. Assert the property that must hold, not the code's own formula or literals. For example, assert that a truncated response is under its size limit, not that its length equals the number the code computed. This covers configuration too: a test that asserts a value chosen freely (a path, a timeout, a version number) fails on a change only because it restates the value, so the revert check in rule 2 proves nothing for it. Explain such a value in a comment, or test a property that holds across the file, such as every analysis output being gated. When something outside the file requires the value, such as a ruleset's required check name or a policy that a suite must run, assert that requirement.
- Make the untestable path testable. A failure path a test cannot reach gets a small, obvious seam the test can replace.
- A test supplies its own world. No reads from the real home directory
or
~/.ha-mcp, no network beyond the test's own containers, no answer taken from the wall clock, the local timezone or another test's leftovers. Code that reads the clock takesnowas a parameter, unless the test harness already controls the clock (the JSDOM harness below does). See Config-dir isolation below. - Name the defect. The test name, and its docstring or the framework's own description, say what breaks for the user, not the function name.
Test Patterns
- Tests expecting tool success: use
mcp.call_tool_success()insideMCPAssertionscontext - Tests expecting tool failure: use
mcp.call_tool_failure()insideMCPAssertionscontext. It rejects any resultassert_mcp_success()would accept — including the tools that succeed with nosuccesskey (pending_restart, bulk-operation payloads) — so it genuinely proves the call failed. Prefer also passingexpected_errorto pin which failure; about half the current call sites omit it and assert on the returned dict themselves instead, which is equally fine. safe_call_tool()is for calls whose outcome the test does not assert:finallycleanup (so a cleanup failure cannot mask the real assertion) and service-availability probes. It swallowsToolErrorand returns a parsed dict, so using it for an expected failure means nothing verifies the call failed at all.
E2E Test Patterns
FastMCP validates required params at schema level. Don't test for missing required params:
# BAD: Fails at schema validation
await mcp.call_tool("ha_config_get_script", {})
# GOOD: Test with valid params but invalid data
await mcp.call_tool("ha_config_get_script", {"script_id": "nonexistent"})HA automation config uses plural root keys (HA 2024.10+): triggers/actions/conditions (singular trigger/action/condition are still accepted as aliases). The tool canonicalizes to plural, so ha_config_get_automation returns the plural shape and python_transform operates on it.
Poll after creating entities. After creating an entity (automation, script, helper, etc.), HA needs time to register it. Never search/query immediately — use polling helpers from tests/src/e2e/utilities/wait_helpers.py:
from ..utilities.wait_helpers import wait_for_tool_result
data = await wait_for_tool_result(
mcp_client,
tool_name="ha_search",
arguments={"query": "my_sensor", "search_types": ["automation"], "limit": 10},
predicate=lambda d: len(d.get("automations", [])) > 0,
description="ha_search finds new automation",
)Other available helpers: wait_for_entity_state(), wait_for_condition(), wait_for_state_change(). See wait_helpers.py for the full set.
Exception handling in polling helpers. wait_helpers.py catches a narrow _POLLING_TRANSIENT_ERRORS tuple inside retry loops; bugs like TypeError / AttributeError / KeyError / AssertionError propagate immediately. Don't broaden to except Exception.
JS Behaviour Testing (tests/js/, tests/src/unit/_js_harness.py)
Every rendered <script> body in the repo (src/ha_mcp/settings_ui/ — page
HTML in settings.html, client JS in settings_js/;
src/ha_mcp/auth/consent_form.py; every .astro page under site/src/)
gets parse coverage automatically via
tests/src/unit/test_rendered_scripts_parse.py. The discovery walker in
_js_harness.py::discover_script_surfaces picks up new surfaces on its
next run — no registration needed when you add a new UI.
For behavioural tests, use the JSDOM harness:
from ._js_harness import extract_script_body, run_script
script = extract_script_body(rendered_html)
result = run_script(
script,
initial_html="<!DOCTYPE html>...",
fetch_map={"/api/foo": {"status": 200, "json": {...}}},
broadcast_events=[{"channel": "ch-name", "data": {"type": "..."}}],
invoke="await window.someExposedFn();",
)
assert result.reloads == 1
assert result.broadcasts_of_type("restart-required")The harness fakes setTimeout / setInterval / Date.now on a virtual clock, stubs fetch from a URL map, captures location.reload via JSDOM's jsdomError channel, and provides a BroadcastChannel shim. new Date() / performance.now() continue to report wall time — only the three sources above are faked.
Each pytest worker sends all its runs to one long-lived node process, and every run gets a fresh JSDOM window. A run that times out, crashes node or garbles its reply ends that process; the next run starts a new one. tests/src/unit/test_js_harness_worker.py covers this.
Astro <script> blocks without define:vars / is:inline are TypeScript by default — pass language="ts" to run_script. For Astro pages needing wizard data, use extract_astro_frontmatter_vars + astro_vars_prelude to inject production data.
CI installs Node + jsdom in the unit-tests job. Local devs without tests/js/node_modules/ get clean skips. Each harness run has a 15s node timeout; set HA_MCP_JS_HARNESS_TIMEOUT=<seconds> to raise it on slower hardware.
Transient UI + the fake clock: timed UI (e.g. the save toast, ~4s auto-dismiss) is gone from result.dom by capture time because the virtual clock fast-forwards. Stamp state into a data- attribute inside invoke to read it live. Avoid substring false-positives too — "ha-toast" in result.dom matches the always-present #ha-toast-region; assert the specific variant class.
Config-dir isolation: tests/src/unit/conftest.py gives every unit test its own empty HA_MCP_CONFIG_DIR and sets HA_MCP_DISABLE_SETTINGS_UI, so no unit test reads or writes ~/.ha-mcp or starts a settings sidecar. A sidecar or startup test that needs the sidecar unsets HA_MCP_DISABLE_SETTINGS_UI with monkeypatch; a test of the default data-dir resolution unsets HA_MCP_CONFIG_DIR and fakes Path.home. In E2E, src/e2e/_collection_data_dir.py does the same for collection, and the in_process_data_dir session fixture points the in-process server's HA_MCP_CONFIG_DIR and HAMCP_BACKUP_DIR at a temporary directory.
When adding a new UI surface:
- Python-rendered HTML: register the renderer in
_js_harness.py::_PY_RENDERERS. - Astro page: drop the
.astrofile undersite/src/; discovery walks automatically. - Behavioural tests: add a
test_<surface>_js_behavior.pymodule alongside the existing ones (test_settings_ui_js_behavior.py,test_astro_setup_js_behavior.py,test_astro_tools_js_behavior.py,test_astro_layout_js_behavior.py,test_consent_form_js_behavior.py) — one module per UI surface.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

