Configures Home Assistant MCP Server integration for NanoTars agents to control smart home devices, query states, and manage automations. Guides setup, verifies prerequisites, and sets environment variables.
npx claudepluginhub terrifiedbug/nanotars-skills --plugin nanotars-homeassistantThis skill uses the workspace's default tool permissions.
Configures Home Assistant integration for agent containers using HA's official MCP Server integration. Agents get native MCP tools to control devices, query states, and manage automations.
Controls Home Assistant smart home devices (lights, fans) and queries entity states using MCP protocol via mcporter CLI. Useful for HA automation in code sessions.
Controls Home Assistant entities like lights, switches, climate, scenes, scripts via REST API; runs automations and receives webhook events.
Adds n8n workflow automation integration to NanoTars agents, enabling webhook-triggered monitoring workflows to avoid token-intensive polling. Guides n8n MCP server setup, API key config, and env variables.
Share bugs, ideas, or general feedback.
Configures Home Assistant integration for agent containers using HA's official MCP Server integration. Agents get native MCP tools to control devices, query states, and manage automations.
Before installing, verify NanoTars is set up:
[ -d node_modules ] && echo "DEPS: ok" || echo "DEPS: missing"
docker image inspect nanoclaw-agent:latest &>/dev/null && echo "IMAGE: ok" || echo "IMAGE: not built"
if grep -q "ANTHROPIC_API_KEY\|CLAUDE_CODE_OAUTH_TOKEN" .env 2>/dev/null || [ -f "$HOME/.claude/.credentials.json" ]; then echo "AUTH: ok"; else echo "AUTH: missing"; fi
If any check fails, tell the user to run /nanotars-setup first and stop.
grep "^HA_URL=" .env 2>/dev/null && echo "HA_URL_SET" || echo "HA_URL_MISSING"
grep "^HA_TOKEN=" .env 2>/dev/null && echo "HA_TOKEN_SET" || echo "HA_TOKEN_MISSING"
[ -d plugins/homeassistant ] && echo "PLUGIN_EXISTS" || echo "PLUGIN_MISSING"
If already configured, ask the user if they want to reconfigure or just verify the setup.
Tell the user:
Enable the MCP Server integration in Home Assistant:
- Open your Home Assistant web UI
- Go to Settings > Devices & Services
- Click + Add Integration
- Search for "Model Context Protocol Server" and add it
- Once added, it exposes an MCP endpoint at
/api/mcpExpose entities to the agent:
- Go to Settings > Voice assistants
- Click Expose tab
- Select entities you want the agent to control (lights, switches, sensors, etc.)
- Only exposed entities will be available -- start conservative, expand later
Ask the user to confirm they've done this before proceeding.
Collect from the user:
Home Assistant URL -- e.g., http://192.168.1.100:8123 or https://ha.example.com
Long-Lived Access Token -- created in HA:
To create a long-lived access token:
- In Home Assistant, click your profile icon (bottom-left)
- Scroll to Long-Lived Access Tokens
- Click Create Token, name it "NanoTars"
- Copy the token immediately (it's only shown once)
Verify the HA instance is reachable and the token works:
curl -sf -o /dev/null -w "%{http_code}" \
"$HA_URL/api/" \
-H "Authorization: Bearer $HA_TOKEN"
Expected: 200. If it fails:
:8123) or the path is wrongThen test that the MCP endpoint exists:
curl -sf -o /dev/null -w "%{http_code}" \
"$HA_URL/api/mcp" \
-H "Authorization: Bearer $HA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"initialize","id":1,"params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"nanoclaw","version":"1.0"}}}'
Expected: 200. If 404, the MCP Server integration is not enabled in HA.
# Remove existing lines if present
sed -i '/^HA_URL=/d' .env
sed -i '/^HA_TOKEN=/d' .env
# Add the new configuration
echo "HA_URL=THE_URL_HERE" >> .env
echo "HA_TOKEN=THE_TOKEN_HERE" >> .env
Ask the user which groups should have access to Home Assistant:
main and family-chatIf the user wants to restrict access, update plugins/homeassistant/plugin.json after copying (Step 7) to set "groups" to the list of group folder names:
"groups": ["main", "family-chat"]
If all groups (or the user doesn't care), leave as "groups": ["*"].
Restricting access means only those groups' agents will have smart home controls. Other groups won't see the Home Assistant tools or credentials.
Also ask about channel types. If the user wants this plugin available on all channel types (WhatsApp, Discord, etc.), leave "channels": ["*"]. To restrict, set "channels" to specific types (e.g., ["whatsapp"]). Most users will want the default.
cp -r ${CLAUDE_PLUGIN_ROOT}/files/ plugins/homeassistant/
npm run build
nanotars restart # or launchctl on macOS
Send a WhatsApp message like:
The agent now has native MCP tools for Home Assistant. Only the entities you exposed in Step 2 are accessible.
To give the agent access to more devices:
plugins/homeassistant/mcp.json has the home-assistant entry, HA MCP Server integration is enabled, and entities are exposedcurl $HA_URL/api/), not just from the user's local networkIf this plugin is already installed and you want different credentials for a specific group (e.g., a work account for one group, personal for another):
Check which groups exist:
ls -d groups/*/
Ask the user which group should get separate credentials.
Collect the new Home Assistant credentials for that group.
Write to the group's .env file (creates if needed):
echo 'HA_URL=https://other-ha.example.com' >> groups/{folder}/.env
echo 'HA_TOKEN=eyJ...' >> groups/{folder}/.env
These values override the global .env for that group's containers only.
Restart NanoTars:
nanotars restart
rm -rf plugins/homeassistant/sed -i '/^HA_URL=/d' .env
sed -i '/^HA_TOKEN=/d' .env