网淘吧来吧,欢迎您!

🏠 Home Assistant via MCP protocol技能使用说明

2026-03-29 新闻来源:网淘吧 围观:21
电脑广告
手机广告

Home Assistant

使用MCP协议控制Home Assistant智能家居并查询状态。

前提条件

在Home Assistant中启用MCP服务器:

🏠 Home Assistant via MCP protocol

  • 浏览到您的Home Assistant实例。
  • 前往 设置 > 设备与服务。
  • 在右下角,选择+ 添加集成按钮。
  • 从列表中,选择"Model Context Protocol"。
  • 按照屏幕上的说明完成设置。

使用

# Get states
mcporter call home-assistant.GetLiveContext

# Turn on the device
mcporter call home-assistant.HassTurnOn(name: "Bedroom Light")
mcporter call home-assistant.HassTurnOn(name: "Light", area: "Bedroom")

# Turn off the device
mcporter call home-assistant.HassTurnOff(name: "Bedroom Light")
mcporter call home-assistant.HassTurnOff(area: "Bedroom", domain: ["light"])

# Control light
# brightness: The percentage of the light, where 0 is off and 100 is fully lit.
# color: Name of color
mcporter call home-assistant.HassLightSet(name: "Bedroom Light", brightness: 50)

# Control fan
# percentage: The percentage of the fan, where 0 is off and 100 is full speed.
mcporter call home-assistant.HassFanSetSpeed(name: "Fan", area: "Bedroom", percentage: 80)

执行以下命令以了解具体使用方法:

  • mcporter list home-assistant --schema --all-parameters

配置

当提示MCP服务器不存在时,提醒用户通过执行以下命令添加配置来设置HASS_BASE_URLHASS_ACCESS_TOKEN环境变量:

mcporter config add home-assistant \
  --transport http \
  --url "${HASS_BASE_URL:-http://homeassistant.local:8123}/api/mcp" \
  --header "Authorization=Bearer \${HASS_ACCESS_TOKEN}"

关于mcporter

免责申明
部分文章来自各大搜索引擎,如有侵权,请与我联系删除。
打赏
文章底部电脑广告
手机广告位-内容正文底部

相关文章

您是本站第326357名访客 今日有221篇新文章/评论