Mcp Hass

作者 aahl47edd621dff4无许可证162 个星标收录于 2026年10月8日更新于 2026年10月8日仓库3周前更新

The skill for control Home Assistant smart home devices and query states using MCP protocol.

AI 生成的概览

通过 MCP 协议控制 Home Assistant 智能家居设备并查询其状态。

功能
该技能指导智能体使用 mcporter 命令行工具连接 Home Assistant 的 MCP 服务器。内容涵盖启用 MCP 集成、配置 HASS_BASE_URL 与 HASS_ACCESS_TOKEN 环境变量,以及读取实时上下文、开关设备的示例命令。它还演示如何设置灯光亮度与颜色、风扇转速,以及如何列出可用工具及其参数结构。
适用场景
当用户希望在智能体会话中控制 Home Assistant 设备或查看其当前状态时使用。适用于开关灯和风扇、调节亮度或转速,以及查看有哪些 Home Assistant 实体可用等请求。
运行要求
需要一个可访问且已启用 MCP 服务器集成的 Home Assistant 实例、HASS_BASE_URL 与 HASS_ACCESS_TOKEN 环境变量,以及运行 npx mcporter 所需的网络访问。该技能不附带脚本,仅为说明文档。

Home Assistant

Control Home Assistant smart home and query states using MCP protocol.

Prerequisites

Enable MCP server in Home Assistant:

  • Browse to your Home Assistant instance.
  • Go to Settings > Devices & services.
  • In the bottom right corner, select the + Add Integration button.
  • From the list, select Model Context Protocol.
  • Follow the instructions on screen to complete the setup.

Config

When prompted that the MCP server does not exist, remind the user to configure the HASS_BASE_URL and HASS_ACCESS_TOKEN environment variables by executing the following command to add the configuration:

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

Usage

shell
# Get statesnpx -y mcporter call home-assistant.GetLiveContext
# Turn on the devicenpx -y mcporter call home-assistant.HassTurnOn(name: "Bedroom Light")npx -y mcporter call home-assistant.HassTurnOn(name: "Light", area: "Bedroom")
# Turn off the devicenpx -y mcporter call home-assistant.HassTurnOff(name: "Bedroom Light")npx -y 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 colornpx -y 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.npx -y mcporter call home-assistant.HassFanSetSpeed(name: "Fan", area: "Bedroom", percentage: 80)

Execute the following command to learn about specific usage methods:

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

About mcporter

来源与署名

来源:aahl/skills位于skills/mcp-hass提交47edd62

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架