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 從公開儲存庫中收錄這些內容。

檢舉或申請下架