@orellbuehler/homeassistant-mcp 0.7.2 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -2
- package/dist/tools/registry.js +51 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ Point Claude (or any MCP client) at it and the agent can:
|
|
|
22
22
|
- **Never touch your devices** — there is deliberately no `call_service`, no `set_state`, and no
|
|
23
23
|
`fire_event`. The agent writes config; it cannot turn anything on or off.
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
43 tools, zero install (`npx`), works with Claude Code, Claude Desktop, Cursor, and any other MCP
|
|
26
26
|
client.
|
|
27
27
|
|
|
28
28
|
## Example prompts
|
|
@@ -107,7 +107,7 @@ available immediately. Verify with `claude mcp list` (should show `homeassistant
|
|
|
107
107
|
|
|
108
108
|
## Tools
|
|
109
109
|
|
|
110
|
-
|
|
110
|
+
43 tools in 12 groups. REST tools go through the
|
|
111
111
|
[Home Assistant REST API](https://www.home-assistant.io/integrations/api/); WebSocket tools use the
|
|
112
112
|
config registries that are not exposed over REST.
|
|
113
113
|
|
|
@@ -169,6 +169,7 @@ not. Debug the result with the trace tools below.
|
|
|
169
169
|
| ------------------------ | ---------------------------------------------------------------------------------------- |
|
|
170
170
|
| `list_registry_entities` | ALL registered entities, incl. disabled/unavailable (area, device, status). |
|
|
171
171
|
| `rename_entity` | Set an entity's registry `name` and/or `new_entity_id` (config edit, no device control). |
|
|
172
|
+
| `set_entity_enabled` | Enable/disable entities in the registry (batch, per-entity results). |
|
|
172
173
|
| `list_devices` | Devices (id, name, manufacturer, model, area). |
|
|
173
174
|
| `list_areas` | Areas (area_id, name, floor). |
|
|
174
175
|
| `list_labels` | Labels (label_id, name, color, icon). |
|
|
@@ -178,6 +179,11 @@ not. Debug the result with the trace tools below.
|
|
|
178
179
|
`rename_entity` writes the registry via `config/entity_registry/update` (requires an admin token):
|
|
179
180
|
`name` overrides the friendly name (null reverts to the integration's `original_name`) and
|
|
180
181
|
`new_entity_id` renames the entity_id within the same domain.
|
|
182
|
+
`set_entity_enabled` uses the same command (also admin-only) to set `disabled_by` to `null`
|
|
183
|
+
(enable) or `"user"` (disable) for a batch of entity_ids; one failure does not abort the rest, and
|
|
184
|
+
each entity comes back with its own `ok`/`error` and resulting `disabled_by`. Enabling is not
|
|
185
|
+
instant — HA loads the entity after its config entry reloads (`reload_delay`, usually 30 seconds) or
|
|
186
|
+
after a restart when the response sets `require_restart`.
|
|
181
187
|
|
|
182
188
|
**Energy dashboard** (WebSocket)
|
|
183
189
|
|
package/dist/tools/registry.js
CHANGED
|
@@ -63,6 +63,57 @@ export function registerRegistryTools(server, ws) {
|
|
|
63
63
|
return err(e);
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
|
+
server.tool("set_entity_enabled", "Enable or disable one or more entities in the entity registry via the WebSocket API (config/entity_registry/update with disabled_by = null to enable, 'user' to disable). This edits registry config only — it does not control any device. Each entity is updated independently: a failure on one is reported in its row and the rest still run. Enabling is NOT instant — HA only loads and starts polling a re-enabled entity after its config entry reloads (see 'reload_delay', usually 30 seconds) or, for integrations that cannot be unloaded, after a full restart ('require_restart'). Re-read list_registry_entities or list_entities after that delay.", {
|
|
67
|
+
entity_ids: z
|
|
68
|
+
.array(z.string())
|
|
69
|
+
.min(1)
|
|
70
|
+
.describe("entity_id(s) to enable or disable, e.g. ['sensor.temp', 'light.kitchen']"),
|
|
71
|
+
enabled: z
|
|
72
|
+
.boolean()
|
|
73
|
+
.describe("true to enable (disabled_by null), false to disable (disabled_by 'user')"),
|
|
74
|
+
}, async ({ entity_ids, enabled }) => {
|
|
75
|
+
try {
|
|
76
|
+
const results = [];
|
|
77
|
+
for (const entity_id of entity_ids) {
|
|
78
|
+
try {
|
|
79
|
+
const res = (await ws.command("config/entity_registry/update", {
|
|
80
|
+
entity_id,
|
|
81
|
+
disabled_by: enabled ? null : "user",
|
|
82
|
+
}));
|
|
83
|
+
const entry = res?.entity_entry ?? res;
|
|
84
|
+
const row = {
|
|
85
|
+
entity_id,
|
|
86
|
+
ok: true,
|
|
87
|
+
disabled_by: entry?.disabled_by ?? null,
|
|
88
|
+
};
|
|
89
|
+
if (res?.require_restart)
|
|
90
|
+
row.require_restart = true;
|
|
91
|
+
if (res?.reload_delay !== undefined)
|
|
92
|
+
row.reload_delay = res.reload_delay;
|
|
93
|
+
results.push(row);
|
|
94
|
+
}
|
|
95
|
+
catch (e) {
|
|
96
|
+
results.push({ entity_id, ok: false, error: String(e) });
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const failed = results.filter((r) => r.ok !== true).length;
|
|
100
|
+
const payload = {
|
|
101
|
+
enabled,
|
|
102
|
+
count: results.length,
|
|
103
|
+
succeeded: results.length - failed,
|
|
104
|
+
failed,
|
|
105
|
+
results,
|
|
106
|
+
};
|
|
107
|
+
if (enabled && failed < results.length) {
|
|
108
|
+
payload.note =
|
|
109
|
+
"Enabled entities are not available immediately: Home Assistant loads them after the config entry reloads ('reload_delay' seconds, usually 30) or after a restart where 'require_restart' is set.";
|
|
110
|
+
}
|
|
111
|
+
return ok(payload);
|
|
112
|
+
}
|
|
113
|
+
catch (e) {
|
|
114
|
+
return err(e);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
66
117
|
server.tool("list_devices", "List devices from the device registry via the WebSocket API (id, name, manufacturer, model, area_id). Useful for grouping entities by physical device when writing automations.", {}, async () => {
|
|
67
118
|
try {
|
|
68
119
|
const list = (await ws.command("config/device_registry/list"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orellbuehler/homeassistant-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Model Context Protocol server for Home Assistant: introspect entities, services, events, registries, render templates and validate configuration to help AI agents author HA configs and automations.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|