Smarthome Port

io.github.CloudCorpRecords由 GitHub 账号 CloudCorpRecords 发布v0.1.0更新于 Nov 3, 2026

Home Assistant 控制:实体状态、服务、历史记录、配置、模板和事件。

AI 翻译由 AI 模型根据下方的原文描述翻译,可能有误。

原文描述

Home Assistant control: entity states, services, history, config, templates, and events.

发布方自己的服务:Port

已验证STDIO仅桌面

概览

Smarthome Port 的本地 MCP 服务;无需登录;STDIO。

暂无 AI 概览:以下信息来自注册中心条目和服务本身。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Smarthome Port,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

smarthome-port

smarthome-port talks to a Home Assistant instance through its REST API. Everything in Home Assistant is an entity — light.kitchen, sensor.temp, switch.porch — and the API reflects that shape: you read entity states, call services on a domain (light.turn_on, switch.toggle), look back at recent history, read the core configuration, render Jinja templates on the server, and fire events onto the event bus. smarthome-port exposes those six operations, plus listings of entities and services, through one binary that serves a command-line interface and a stdio MCP server.

Two settings are required, and there is no built-in default for either:

  • HOME_ASSISTANT_URL — the base URL of the instance, for example http://homeassistant.local:8123. A trailing slash is stripped.
  • HOME_ASSISTANT_TOKEN — a long-lived access token (create one in Home Assistant under your profile). It is sent as an Authorization: Bearer header and never appears in output.

When either variable is missing, every call fails with an error that names the missing variable, before any request is made.

Only the REST API is covered. The websocket API is not implemented.

Install

bash
npx @reneturcios/smarthome-port entities

Or run the container image:

bash
docker run -i -e HOME_ASSISTANT_URL -e HOME_ASSISTANT_TOKEN ghcr.io/cloudcorprecords/smarthome-port

The container defaults to the MCP server (see below). Pass CLI arguments to use it as a CLI instead.

CLI

bash
export HOME_ASSISTANT_URL=http://homeassistant.local:8123export HOME_ASSISTANT_TOKEN=<your long-lived access token>
smarthome-port entitiessmarthome-port entities --domain lightsmarthome-port state sensor.tempsmarthome-port call light turn_on --entity light.kitchen --data '{"brightness_pct":50}'smarthome-port servicessmarthome-port services --domain lightsmarthome-port history sensor.temp --hours 6smarthome-port configsmarthome-port render "{{ states('sensor.temp') }}"smarthome-port fire my_event --data '{"device":"kitchen"}'
smarthome-port --version

Each command prints the upstream JSON payload (template rendering prints {"rendered": "..."}). Exit codes: 0 on success, 1 when a call fails (including missing configuration or an API error), 2 for usage errors.

MCP server

One bin serves both faces. The mcp subcommand starts a stdio MCP server:

bash
npx -y @reneturcios/smarthome-port mcp

MCP client configuration:

json
{  "mcpServers": {    "smarthome-port": {      "command": "npx",      "args": ["-y", "@reneturcios/smarthome-port", "mcp"],      "env": {        "HOME_ASSISTANT_URL": "http://homeassistant.local:8123",        "HOME_ASSISTANT_TOKEN": "..."      }    }  }}

Tools

ToolInputWhat it returns
list_entitiesdomain (optional)Entity states, filtered client-side to one domain when given.
get_entity_stateentity_id (required)The full state of one entity.
call_servicedomain, service (required), entity_id, service_data (optional)The service call result; service_data is merged with entity_id.
list_servicesdomain (optional)Services by domain, or only one domain's entry when given.
get_historyentity_id (required), hours (optional, default 24)Recent history for the entity over the window ending now.
get_config(none)The core configuration.
render_templatetemplate (required){"rendered": "..."} — the upstream reply is plain text.
fire_eventevent_type (required), event_data (optional)The upstream reply; event_data defaults to {}.

All calls go to {HOME_ASSISTANT_URL}/api. An entity_id must contain a dot (domain.object_id), and domain, service, and event_type must be non-empty — both are checked before any request. History timestamps are computed client-side from the current time. HTTP failures surface the status plus the upstream message when Home Assistant provides one.

Development

bash
npm installnpm run build   # tsc -> dist/npm test        # node test runner over test/*.test.ts, no network (fake fetch fixtures)npm run dev     # run the CLI from source via tsx

License

MIT — see LICENSE.

来源:README.md,提交 629fd2f

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.0最新Nov 3, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

其他 Port 集成