Skip to content

Commit 51e457c

Browse files
julienldclaude
andauthored
fix: use correct WebSocket command type for Supervisor API (#246)
* docs: update uvx instructions to use @latest Ensures users always get the latest version when running via uvx, avoiding issues like the read-only filesystem bug that was fixed in v4.7.4. Updated all uvx references in: - README.md (Claude Desktop, Claude Code, VSCode button, web clients) - docs/macOS-uv-guide.md - docs/Windows-uv-guide.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: use correct WebSocket command type and response structure for Supervisor API Two issues fixed: 1. Change `hassio/api` to `supervisor/api` - the correct WebSocket command type as defined in Home Assistant Core (WS_TYPE_API = "supervisor/api") 2. Fix response parsing - response structure is `result.addons` not `result.data.addons` The code was looking for a nested `.data` key that doesn't exist. This fixes the "Unknown command" error and empty add-ons list when calling ha_list_addons() and ha_list_available_addons() on Home Assistant OS installations. Fixes #243 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent d3f16e6 commit 51e457c

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/ha_mcp/tools/tools_addons.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ async def list_addons(
4343

4444
# Call Supervisor API to get installed add-ons
4545
result = await ws_client.send_command(
46-
"hassio/api",
46+
"supervisor/api",
4747
endpoint="/addons",
4848
method="GET",
4949
)
@@ -64,7 +64,8 @@ async def list_addons(
6464
"details": result,
6565
}
6666

67-
data = result.get("result", {}).get("data", {})
67+
# Response structure: result.addons (not result.data.addons)
68+
data = result.get("result", {})
6869
addons = data.get("addons", [])
6970

7071
# Format add-on information
@@ -151,7 +152,7 @@ async def list_available_addons(
151152

152153
# Call Supervisor API to get store information
153154
result = await ws_client.send_command(
154-
"hassio/api",
155+
"supervisor/api",
155156
endpoint="/store",
156157
method="GET",
157158
)
@@ -172,7 +173,8 @@ async def list_available_addons(
172173
"details": result,
173174
}
174175

175-
data = result.get("result", {}).get("data", {})
176+
# Response structure: result.addons/repositories (not result.data.*)
177+
data = result.get("result", {})
176178
repositories = data.get("repositories", [])
177179
addons = data.get("addons", [])
178180

0 commit comments

Comments
 (0)