这是一个用于通过AI助手控制Home Assistant设备的Model Context Protocol (MCP)集成。
<a href="https://glama.ai/mcp/servers/@hpohlmann/home-assistant-mcp"> <img width="380" height="200" src="https://gips3.baidu.com/it/u=120649279,730517625&fm=3081&app=3081&f=PNG?w=760&h=400" alt="Home Assistant MCP 服务器" /> </a>此MCP允许AI助手控制您的Home Assistant设备。它提供了以下工具:
要通过Smithery自动安装Claude Desktop的Home Assistant集成:
npx -y @smithery/cli install @hpohlmann/home-assistant-mcp --client claude
cd home-assistant
python -m venv .venv
source .venv/bin/activate # 在Windows上:.venv\Scripts\activate
pip install -U pip
pip install uv
uv pip install -e .
在Cursor的MCP配置中添加以下配置:
{
"mcpServers": {
"home_assistant": {
"command": "uv",
"args": [
"--directory",
"/path/to/your/home-assistant-mcp",
"run",
"main.py"
],
"env": {
"HOME_ASSISTANT_TOKEN": "your_home_assistant_token_here"
},
"inheritEnv": true
}
}
}
替换:
/path/to/your/home-assistant 为实际目录路径your_home_assistant_token_here 为您自己的Home Assistant长效访问令牌默认情况下,MCP尝试连接到位于http://homeassistant.local:8123的Home Assistant。
如果您的Home Assistant位于不同的URL,请修改app/config.py中的HA_URL变量。
配置完成后,您可以使用Cursor AI来控制您的Home Assistant设备:
MCP现在支持高级灯光控制功能:
颜色控制:为兼容灯光设置任意RGB颜色
set_device_color("light.living_room", 255, 0, 0) 设为红色亮度控制:调整灯光亮度
set_device_color("light.dining_room", 0, 0, 255, brightness=128) 设为中等亮度蓝色当前实现需要两步过程来控制设备:
计划增强功能是创建一种更动态的方式来向控制设备工具暴露实体,使AI能够:
这将显著减少行动时间并创建通过AI助手控制Home Assistant设备时更加无缝的用户体验。